aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/removeReactionEmoji.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-19 18:52:41 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-19 18:52:41 -0500
commite78beed6c7e094ef48aad5d18da01b2bbed4536c (patch)
tree32676793af5f7bdc39d438ff284fa5b959274e96 /src/commands/moderation/removeReactionEmoji.ts
parenta3103b629250de3fb97a40a4f9ff7e7ba28f4d16 (diff)
downloadtanzanite-e78beed6c7e094ef48aad5d18da01b2bbed4536c.tar.gz
tanzanite-e78beed6c7e094ef48aad5d18da01b2bbed4536c.tar.bz2
tanzanite-e78beed6c7e094ef48aad5d18da01b2bbed4536c.zip
fix: a ton of shit
Diffstat (limited to 'src/commands/moderation/removeReactionEmoji.ts')
-rw-r--r--src/commands/moderation/removeReactionEmoji.ts18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/commands/moderation/removeReactionEmoji.ts b/src/commands/moderation/removeReactionEmoji.ts
index 092b8ac..f511007 100644
--- a/src/commands/moderation/removeReactionEmoji.ts
+++ b/src/commands/moderation/removeReactionEmoji.ts
@@ -1,6 +1,6 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
-import { ApplicationCommandOptionType, Message, PermissionFlagsBits, type Emoji } from 'discord.js';
+import { ApplicationCommandOptionType, Message, PermissionFlagsBits } from 'discord.js';
export default class RemoveReactionEmojiCommand extends BushCommand {
public constructor() {
@@ -45,23 +45,19 @@ export default class RemoveReactionEmojiCommand extends BushCommand {
assert(message.channel);
const resolvedMessage = args.message instanceof Message ? args.message : await message.channel.messages.fetch(args.message);
- const id = !(['string'] as const).includes(typeof args.emoji);
- const emojiID = !id ? `${args.emoji}` : (args.emoji as Emoji).id;
- const success = await resolvedMessage.reactions.cache
+ const emojiID = typeof args.emoji === 'string' ? `${args.emoji}` : args.emoji.id;
+ const success = !!(await resolvedMessage.reactions.cache
?.get(emojiID!)
?.remove()
- ?.catch(() => {});
+ ?.catch(() => undefined));
+
if (success) {
return await message.util.reply(
- `${util.emojis.success} Removed all reactions of \`${id ? emojiID : args.emoji}\` from the message with the id of \`${
- resolvedMessage.id
- }\`.`
+ `${util.emojis.success} Removed all reactions of \`${emojiID}\` from the message with the id of \`${resolvedMessage.id}\`.`
);
} else {
return await message.util.reply(
- `${util.emojis.error} There was an error removing all reactions of \`${
- id ? emojiID : args.emoji
- }\` from the message with the id of \`${resolvedMessage.id}\`.`
+ `${util.emojis.error} There was an error removing all reactions of \`${emojiID}\` from the message with the id of \`${resolvedMessage.id}\`.`
);
}
}