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

View file

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

View file

@ -16,9 +16,9 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Use Node.js - name: Use Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v1
with: with:
node-version: 18.x node-version: 18.x
- run: yarn install --frozen-lockfile - run: npm ci
- run: yarn build - run: npm run build
- run: yarn test - 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) { private async SendAuditForUser(interaction: CommandInteraction) {
if (!interaction.guildId) return; if (!interaction.guildId) return;
const user = interaction.options.get('target', true).user!; const user = interaction.options.getUser('target');
if (!user) { if (!user) {
await interaction.reply("User not found."); await interaction.reply("User not found.");
@ -190,7 +190,7 @@ export default class Audits extends Command {
private async AddAudit(interaction: CommandInteraction) { private async AddAudit(interaction: CommandInteraction) {
if (!interaction.guildId) return; 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 auditType = interaction.options.get('type');
const reasonInput = interaction.options.get('reason'); const reasonInput = interaction.options.get('reason');

View file

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

4666
yarn.lock

File diff suppressed because it is too large Load diff