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 | |
parent | f850b708da87e56f2a1469b65560f8342e2c0f2b (diff) | |
download | tanzanite-46bbadd71aa99bc657931971f9f5ad5659f0c17c.tar.gz tanzanite-46bbadd71aa99bc657931971f9f5ad5659f0c17c.tar.bz2 tanzanite-46bbadd71aa99bc657931971f9f5ad5659f0c17c.zip |
refactoring and fixes
-rw-r--r-- | .vscode/settings.json | 2 | ||||
-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 | ||||
-rw-r--r-- | yarn.lock | 32 |
7 files changed, 99 insertions, 19 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json index 3e23797..144c4ca 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -120,4 +120,4 @@ } ], "compile-hero.disable-compile-files-on-did-save-code": true -} +}
\ No newline at end of file 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.`); + } +} @@ -359,16 +359,16 @@ __metadata: linkType: hard "@types/node@npm:*": - version: 16.7.8 - resolution: "@types/node@npm:16.7.8" - checksum: 060ea222ce8f3eb05bd86a7785ca5807503a50602dd805c5be997a5ae684fa6224c9ad8890bcc5551c05d14a8bcd735f94567691342d197f5f7f7f893ed0d46b + version: 16.7.10 + resolution: "@types/node@npm:16.7.10" + checksum: 0518803caa1a14f4070e770a280eda1c4b4581a425cbda481cdd54b1f34a7ea497ff067fd23b90e3d4f4fdcfba15c1316182875e9cf9f5b2e880de1e595de053 languageName: node linkType: hard "@types/node@npm:^14.14.22": - version: 14.17.12 - resolution: "@types/node@npm:14.17.12" - checksum: 7efbce3781a0ea5d7a39bca3c5ed9c4e4d99fed3483fb2a89670aeb049cd9d25f1ddecd8fb58420fd92de371278721ddd6e3ad95c4f55992592f1ac5d1dedf98 + version: 14.17.14 + resolution: "@types/node@npm:14.17.14" + checksum: 66ed675a324fdddc4f693f1b240c0d81a9f53e1c68f7de8b84d02d65c0b447f9fa30d318481d04e1502f68dd37091b5cadc59633b57246582ad25e3fa835cd7d languageName: node linkType: hard @@ -1001,9 +1001,9 @@ __metadata: linkType: hard "core-util-is@npm:~1.0.0": - version: 1.0.2 - resolution: "core-util-is@npm:1.0.2" - checksum: 7a4c925b497a2c91421e25bf76d6d8190f0b2359a9200dbeed136e63b2931d6294d3b1893eda378883ed363cd950f44a12a401384c609839ea616befb7927dab + version: 1.0.3 + resolution: "core-util-is@npm:1.0.3" + checksum: 9de8597363a8e9b9952491ebe18167e3b36e7707569eed0ebf14f8bba773611376466ae34575bca8cfe3c767890c859c74056084738f09d4e4a6f902b2ad7d99 languageName: node linkType: hard @@ -1117,12 +1117,12 @@ discord-akairo-message-util@NotEnoughUpdates/discord-akairo-message-util: discord-akairo@NotEnoughUpdates/discord-akairo: version: 8.2.2 - resolution: "discord-akairo@https://github.com/NotEnoughUpdates/discord-akairo.git#commit=8da50867c05265aa01fbc08fd510af4c81f64651" + resolution: "discord-akairo@https://github.com/NotEnoughUpdates/discord-akairo.git#commit=11b02374dfe1f2f9c0487f2bb8e4f9fbf7c148a4" dependencies: discord-akairo-message-util: NotEnoughUpdates/discord-akairo-message-util lodash: ^4.17.21 source-map-support: ^0.5.19 - checksum: c96a613e59726a25a65c8a15e24850447d1c43da7ab52e4a88c1eee55b3a981a98a41f2c41e6e3fad7a3865566f4345f92211d6d4b4198059e88fe9e2c247203 + checksum: 2edc0da34e5d8804ea92a6f2a0bd566738ae931ef3583bb475204bba1e6a218ec72b27d144c2f7132963504748d2679c39d9deff0f0005dace946cc9473d83bb languageName: node linkType: hard @@ -1142,7 +1142,7 @@ discord-akairo@NotEnoughUpdates/discord-akairo: discord.js@NotEnoughUpdates/discord.js: version: 13.2.0-dev - resolution: "discord.js@https://github.com/NotEnoughUpdates/discord.js.git#commit=adfd990b6de491c01adb414b231a7a5f3c62042e" + resolution: "discord.js@https://github.com/NotEnoughUpdates/discord.js.git#commit=b3c676e3286dd3ce39f63231216d2e480e28b567" dependencies: "@discordjs/builders": ^0.5.0 "@discordjs/collection": ^0.2.1 @@ -1152,7 +1152,7 @@ discord.js@NotEnoughUpdates/discord.js: discord-api-types: ^0.22.0 node-fetch: ^2.6.1 ws: ^7.5.1 - checksum: 5bb831df1083ed06ce59fd1500158981f6697d15194b46840d133e1ee32659291c497bb7bddcdabe1f0ce9cf5129febd07f2956039f842e21efa7a8c7bba25e4 + checksum: 730499fb8c30f648343abdda44d12767819da80a55deb9358942ef9a63280fe354c2b2a638cef9bd5ac946e5efc2f87f29b3a03e6f43d150a3618b252aef445e languageName: node linkType: hard @@ -2154,8 +2154,8 @@ discord.js@NotEnoughUpdates/discord.js: linkType: hard "minipass-fetch@npm:^1.3.2": - version: 1.3.4 - resolution: "minipass-fetch@npm:1.3.4" + version: 1.4.1 + resolution: "minipass-fetch@npm:1.4.1" dependencies: encoding: ^0.1.12 minipass: ^3.1.0 @@ -2164,7 +2164,7 @@ discord.js@NotEnoughUpdates/discord.js: dependenciesMeta: encoding: optional: true - checksum: 67cb59d30ba646d652a250e08833bb54463ef1fead6eea5b835a53e3f6b32410356b81948ba7be7634cbb1ab37ba497d3e1ddf203b9f0d0d7637728075f67124 + checksum: ec93697bdb62129c4e6c0104138e681e30efef8c15d9429dd172f776f83898471bc76521b539ff913248cc2aa6d2b37b652c993504a51cc53282563640f29216 languageName: node linkType: hard |