diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-08-31 21:17:27 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-08-31 21:17:27 -0400 |
commit | 46bbadd71aa99bc657931971f9f5ad5659f0c17c (patch) | |
tree | b95c77578ca0f7d17405be5f89373de3f91af187 /src | |
parent | f850b708da87e56f2a1469b65560f8342e2c0f2b (diff) | |
download | tanzanite-46bbadd71aa99bc657931971f9f5ad5659f0c17c.tar.gz tanzanite-46bbadd71aa99bc657931971f9f5ad5659f0c17c.tar.bz2 tanzanite-46bbadd71aa99bc657931971f9f5ad5659f0c17c.zip |
refactoring and fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/info/snowflake.ts (renamed from src/commands/info/snowflakeInfo.ts) | 2 | ||||
-rw-r--r-- | src/commands/moderation/removeReactionEmoji.ts | 2 | ||||
-rw-r--r-- | src/commands/moulberry-bush/moulHammerCommand.ts | 38 | ||||
-rw-r--r-- | src/listeners/commands/commandCooldown.ts | 27 | ||||
-rw-r--r-- | src/listeners/commands/slashNotFound.ts | 15 |
5 files changed, 82 insertions, 2 deletions
diff --git a/src/commands/info/snowflakeInfo.ts b/src/commands/info/snowflake.ts index 603993a..8d6129b 100644 --- a/src/commands/info/snowflakeInfo.ts +++ b/src/commands/info/snowflake.ts @@ -17,7 +17,7 @@ import { } from 'discord.js'; import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; -export default class SnowflakeInfoCommand extends BushCommand { +export default class SnowflakeCommand extends BushCommand { public constructor() { super('snowflake', { aliases: ['snowflake', 'info', 'sf'], diff --git a/src/commands/moderation/removeReactionEmoji.ts b/src/commands/moderation/removeReactionEmoji.ts index 34073e6..d4c0cb6 100644 --- a/src/commands/moderation/removeReactionEmoji.ts +++ b/src/commands/moderation/removeReactionEmoji.ts @@ -3,7 +3,7 @@ import { Emoji, Snowflake } from 'discord.js'; export default class RemoveReactionEmojiCommand extends BushCommand { public constructor() { - super('removereactionemoji', { + super('removeReactionEmoji', { aliases: ['removereactionemoji', 'rre'], category: 'moderation', description: { diff --git a/src/commands/moulberry-bush/moulHammerCommand.ts b/src/commands/moulberry-bush/moulHammerCommand.ts new file mode 100644 index 0000000..bc60372 --- /dev/null +++ b/src/commands/moulberry-bush/moulHammerCommand.ts @@ -0,0 +1,38 @@ +import { MessageEmbed, User } from 'discord.js'; +import { BushCommand, BushMessage } from '../../lib'; + +export default class MoulHammerCommand extends BushCommand { + public constructor() { + super('moulHammer', { + aliases: ['moulhammer'], + category: "Moulberry's Bush", + description: { + content: 'A command to moul hammer members.', + usage: 'moulHammer <user>', + examples: ['moulHammer @IRONM00N'] + }, + clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES'], + userPermissions: ['SEND_MESSAGES'], + args: [ + { + id: 'user', + type: 'user', + prompt: { + start: 'What user would you like to moul hammer?', + retry: '{error} Choose a valid user to moul hammer' + } + } + ], + restrictedGuilds: ['516977525906341928'] + }); + } + + public override async exec(message: BushMessage, { user }: { user: User }): Promise<void> { + await message.delete(); + const embed = new MessageEmbed() + .setTitle('L') + .setDescription(`${user.username} got moul'ed <:wideberry1:756223352598691942><:wideberry2:756223336832303154>`) + .setColor(this.client.util.colors.purple); + await message.util.send({ embeds: [embed] }); + } +} diff --git a/src/listeners/commands/commandCooldown.ts b/src/listeners/commands/commandCooldown.ts new file mode 100644 index 0000000..5cb3fa9 --- /dev/null +++ b/src/listeners/commands/commandCooldown.ts @@ -0,0 +1,27 @@ +import { Message } from 'discord.js'; +import { BushCommandHandlerEvents, BushListener } from '../../lib'; + +export default class CommandCooldownListener extends BushListener { + public constructor() { + super('commandCooldown', { + emitter: 'commandHandler', + event: 'cooldown', + category: 'commands' + }); + } + + public override async exec(...[message, command, remaining]: BushCommandHandlerEvents['cooldown']): Promise<void> { + void client.console.info( + 'commandCooldown', + `<<${message.author.tag}>> tried to run <<${ + command ?? message.util!.parsed?.command + }>> but it is on cooldown for <<${Math.round(remaining / 1000)}>> seconds.` + ); + message.util!.isSlash + ? message.util?.reply({ + content: `⏳ This command is on cooldown for ${Math.round(remaining / 1000)} seconds.`, + ephemeral: true + }) + : await (message as Message).react('⏳').catch(() => null); + } +} diff --git a/src/listeners/commands/slashNotFound.ts b/src/listeners/commands/slashNotFound.ts new file mode 100644 index 0000000..118d549 --- /dev/null +++ b/src/listeners/commands/slashNotFound.ts @@ -0,0 +1,15 @@ +import { BushCommandHandlerEvents, BushListener } from '../../lib'; + +export default class SlashNotFoundListener extends BushListener { + public constructor() { + super('slashNotFound', { + emitter: 'commandHandler', + event: 'slashNotFound', + category: 'commands' + }); + } + + public override async exec(...[interaction]: BushCommandHandlerEvents['slashNotFound']): Promise<void> { + void client.console.info('slashNotFound', `<<${interaction?.commandName}>> could not be found.`); + } +} |