diff --git a/src/commands/timeout.ts b/src/commands/timeout.ts index 52fe1e7..65e3ba0 100644 --- a/src/commands/timeout.ts +++ b/src/commands/timeout.ts @@ -49,11 +49,6 @@ export default class Timeout extends Command { return; } - if (targetUser.user.bot) { - await interaction.reply('Cannot timeout bots.'); - return; - } - // General Variables const targetMember = targetUser.member as GuildMember; const reason = reasonInput && reasonInput.value ? reasonInput.value.toString() : null; diff --git a/src/helpers/StringTools.ts b/src/helpers/StringTools.ts index 0254dc5..5119f94 100644 --- a/src/helpers/StringTools.ts +++ b/src/helpers/StringTools.ts @@ -35,8 +35,4 @@ export default class StringTools { return result; } - - public static ReplaceAll(str: string, find: string, replace: string) { - return str.replace(new RegExp(find, 'g'), replace); - } } \ No newline at end of file diff --git a/src/helpers/TimeLengthInput.ts b/src/helpers/TimeLengthInput.ts index 95befa6..7c167d2 100644 --- a/src/helpers/TimeLengthInput.ts +++ b/src/helpers/TimeLengthInput.ts @@ -1,10 +1,8 @@ -import StringTools from "./StringTools"; - export default class TimeLengthInput { public readonly value: string; constructor(input: string) { - this.value = StringTools.ReplaceAll(input, ',', ''); + this.value = input; } public GetDays(): number { diff --git a/src/vylbot.ts b/src/vylbot.ts index 8cfd848..c1d2997 100644 --- a/src/vylbot.ts +++ b/src/vylbot.ts @@ -2,7 +2,6 @@ import { CoreClient } from "./client/client"; import * as dotenv from "dotenv"; import registry from "./registry"; import { IntentsBitField } from "discord.js"; -import StringTools from "./helpers/StringTools"; dotenv.config(); diff --git a/tests/commands/timeout.test.ts b/tests/commands/timeout.test.ts index 1646734..c64ceb5 100644 --- a/tests/commands/timeout.test.ts +++ b/tests/commands/timeout.test.ts @@ -360,43 +360,6 @@ describe('execute', () => { expect(interaction.reply).toBeCalledWith('Fields are required.'); }); - test('GIVEN targetUser is a bot, EXPECT error', async () => { - const interaction = { - reply: jest.fn(), - guild: mock(), - guildId: 'guildId', - options: { - get: jest.fn((value: string): CommandInteractionOption | null => { - switch (value) { - case 'target': - return { - user: { - bot: true, - } as User, - member: {} as GuildMember - } as CommandInteractionOption; - case 'length': - return { - value: '1m', - } as CommandInteractionOption; - case 'reason': - return { - value: 'Test reason', - } as CommandInteractionOption; - default: - return null; - } - }), - } - } as unknown as CommandInteraction; - - const command = new Timeout(); - - await command.execute(interaction); - - expect(interaction.reply).toBeCalledWith('Cannot timeout bots.'); - }); - test('GIVEN targetMember IS NOT manageable by the bot, EXPECT insufficient permissions error', async () => { const command = new Timeout();