Compare commits

..

No commits in common. "739bd0713d5631bb26d8311c8c0811ed358b4699" and "581c275adf04196b20805ba8c4c353d350e51752" have entirely different histories.

7 changed files with 8858 additions and 4723 deletions

View file

@ -14,12 +14,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v1
with:
node-version: 18.x
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test
- run: npm ci
- run: npm run build
- run: npm test
- name: "Copy files over to location"
run: cp -r . ${{ secrets.PROD_REPO_PATH }}
@ -63,5 +63,5 @@ jobs:
&& (pm2 delete vylbot_prod || true) \
&& docker compose up -d \
&& sleep 10 \
&& yarn db:up \
&& pm2 start --name vylbot_prod dist/vylbot.js
&& npm run db:up \
&& pm2 start --name vylbot_prod dist/vylbot.js

View file

@ -14,12 +14,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v1
with:
node-version: 18.x
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test
- run: npm ci
- run: npm run build
- run: npm test
- name: "Copy files over to location"
run: cp -r . ${{ secrets.STAGE_REPO_PATH }}
@ -63,5 +63,5 @@ jobs:
&& (pm2 delete vylbot_stage || true) \
&& docker compose up -d \
&& sleep 10 \
&& yarn db:up \
&& pm2 start --name vylbot_stage dist/vylbot.js
&& npm run db:up \
&& pm2 start --name vylbot_stage dist/vylbot.js

View file

@ -16,9 +16,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v1
with:
node-version: 18.x
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test
- run: npm ci
- run: npm run build
- run: npm test

8815
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -92,7 +92,7 @@ export default class Audits extends Command {
private async SendAuditForUser(interaction: CommandInteraction) {
if (!interaction.guildId) return;
const user = interaction.options.get('target', true).user!;
const user = interaction.options.getUser('target');
if (!user) {
await interaction.reply("User not found.");
@ -190,7 +190,7 @@ export default class Audits extends Command {
private async AddAudit(interaction: CommandInteraction) {
if (!interaction.guildId) return;
const user = interaction.options.get('target', true).user!;
const user = interaction.options.getUser('target');
const auditType = interaction.options.get('type');
const reasonInput = interaction.options.get('reason');
@ -208,4 +208,4 @@ export default class Audits extends Command {
await interaction.reply(`Created new audit with ID \`${audit.AuditId}\``);
}
}
}

View file

@ -130,9 +130,7 @@ describe("user", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("user"),
get: jest.fn().mockReturnValue({
user: user
}),
getUser: jest.fn().mockReturnValue(user),
},
guildId: "guildId",
reply: jest.fn().mockImplementation((options) => {
@ -152,8 +150,8 @@ describe("user", () => {
expect(AuditTools.TypeToFriendlyText).toHaveBeenCalledTimes(1);
expect(AuditTools.TypeToFriendlyText).toHaveBeenCalledWith(AuditType.Warn);
expect(interaction.options.get).toHaveBeenCalledTimes(1);
expect(interaction.options.get).toHaveBeenCalledWith("target", true);
expect(interaction.options.getUser).toHaveBeenCalledTimes(1);
expect(interaction.options.getUser).toHaveBeenCalledWith("target");
expect(interaction.reply).toHaveBeenCalledTimes(1);
expect(repliedWith).toBeDefined();
@ -195,9 +193,7 @@ describe("user", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("user"),
get: jest.fn().mockReturnValue({
user: null
}),
getUser: jest.fn().mockReturnValue(null),
},
guildId: "guildId",
reply: jest.fn(),
@ -206,7 +202,7 @@ describe("user", () => {
const audits = new Audits();
await audits.execute(interaction);
expect(interaction.options.get).toHaveBeenCalledTimes(1);
expect(interaction.options.getUser).toHaveBeenCalledTimes(1);
expect(interaction.reply).toHaveBeenCalledTimes(1);
expect(interaction.reply).toHaveBeenCalledWith("User not found.");
@ -217,9 +213,7 @@ describe("user", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("user"),
get: jest.fn().mockReturnValue({
user: {},
}),
getUser: jest.fn().mockReturnValue({}),
},
guildId: "guildId",
reply: jest.fn(),
@ -232,7 +226,7 @@ describe("user", () => {
expect(Audit.FetchAuditsByUserId).toHaveBeenCalledTimes(1);
expect(interaction.options.get).toHaveBeenCalledTimes(1);
expect(interaction.options.getUser).toHaveBeenCalledTimes(1);
expect(interaction.reply).toHaveBeenCalledTimes(1);
expect(interaction.reply).toHaveBeenCalledWith("There are no audits for this user.");
@ -243,9 +237,7 @@ describe("user", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("user"),
get: jest.fn().mockReturnValue({
user: {},
}),
getUser: jest.fn().mockReturnValue({}),
},
guildId: "guildId",
reply: jest.fn(),
@ -258,7 +250,7 @@ describe("user", () => {
expect(Audit.FetchAuditsByUserId).toHaveBeenCalledTimes(1);
expect(interaction.options.get).toHaveBeenCalledTimes(1);
expect(interaction.options.getUser).toHaveBeenCalledTimes(1);
expect(interaction.reply).toHaveBeenCalledTimes(1);
expect(interaction.reply).toHaveBeenCalledWith("There are no audits for this user.");
@ -601,9 +593,8 @@ describe("add", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("add"),
get: jest.fn()
.mockReturnValueOnce({ user })
.mockReturnValueOnce(type)
getUser: jest.fn().mockReturnValue(user),
get: jest.fn().mockReturnValueOnce(type)
.mockReturnValue(reason),
},
user: {
@ -646,9 +637,8 @@ describe("add", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("add"),
get: jest.fn()
.mockReturnValueOnce({ user: null })
.mockReturnValue({}),
getUser: jest.fn().mockReturnValue(null),
get: jest.fn().mockReturnValue({}),
},
reply: jest.fn(),
} as unknown as CommandInteraction;
@ -666,9 +656,8 @@ describe("add", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("add"),
get: jest.fn()
.mockReturnValueOnce({ user: null })
.mockReturnValueOnce(null)
getUser: jest.fn().mockReturnValue(null),
get: jest.fn().mockReturnValueOnce(null)
.mockReturnValue({}),
},
reply: jest.fn(),
@ -687,11 +676,10 @@ describe("add", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("add"),
get: jest.fn()
.mockReturnValueOnce({ user: null })
.mockReturnValueOnce({
value: undefined
})
getUser: jest.fn().mockReturnValue(null),
get: jest.fn().mockReturnValueOnce({
value: undefined
})
.mockReturnValue({}),
},
reply: jest.fn(),
@ -720,9 +708,8 @@ describe("add", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("add"),
get: jest.fn()
.mockReturnValueOnce({ user })
.mockReturnValueOnce(type)
getUser: jest.fn().mockReturnValue(user),
get: jest.fn().mockReturnValueOnce(type)
.mockReturnValue(null),
},
user: {
@ -765,9 +752,8 @@ describe("add", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("add"),
get: jest.fn()
.mockReturnValueOnce({ user })
.mockReturnValueOnce(type)
getUser: jest.fn().mockReturnValue(user),
get: jest.fn().mockReturnValueOnce(type)
.mockReturnValue(reason),
},
user: {
@ -789,4 +775,4 @@ describe("add", () => {
expect(savedAudit).toBeDefined();
expect(savedAudit!.Reason).toBe("");
});
});
});

4666
yarn.lock

File diff suppressed because it is too large Load diff