diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-06 18:30:23 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-06 18:30:23 -0400 |
commit | c260809dadd1f45107a2b70ab6cb6c3ce12d1160 (patch) | |
tree | 67293be341953e00f6eaf9e3f56121cbd6ddb8b9 /src/commands/moulberry-bush/rule.ts | |
parent | 1dee5bcda6a43eaa7fcc88ed3b0e458f32104de4 (diff) | |
download | tanzanite-c260809dadd1f45107a2b70ab6cb6c3ce12d1160.tar.gz tanzanite-c260809dadd1f45107a2b70ab6cb6c3ce12d1160.tar.bz2 tanzanite-c260809dadd1f45107a2b70ab6cb6c3ce12d1160.zip |
kick command
Diffstat (limited to 'src/commands/moulberry-bush/rule.ts')
-rw-r--r-- | src/commands/moulberry-bush/rule.ts | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index 516aadf..f8d312f 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -1,6 +1,6 @@ import { Argument, Constants } from 'discord-akairo'; import { MessageEmbed, User } from 'discord.js'; -import { AllowedMentions, BushCommand, BushMessage } from '../../lib'; +import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage } from '../../lib'; const rules = [ { @@ -106,7 +106,10 @@ export default class RuleCommand extends BushCommand { }); } - public async exec(message: BushMessage, { rule, user }: { rule: undefined | number; user: User }): Promise<unknown> { + public async exec( + message: BushMessage | BushSlashMessage, + { rule, user }: { rule: undefined | number; user: User } + ): Promise<unknown> { const rulesEmbed = new MessageEmbed() .setColor('#ef3929') .setFooter(`Triggered by ${message.author.tag}`, message.author.avatarURL({ dynamic: true })) @@ -130,21 +133,19 @@ export default class RuleCommand extends BushCommand { return; async function respond(): Promise<unknown> { if (!user) { - return ( - // If the original message was a reply -> imitate it - message.reference?.messageID && !message.util.isSlash - ? await message.channel.messages.fetch(message.reference.messageID).then(async (message) => { - await message.util.reply({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() }); - }) - : await message.util.send({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() }) - ); + // If the original message was a reply -> imitate it + (message as BushMessage).reference?.messageID && !message.util.isSlash + ? await message.channel.messages.fetch((message as BushMessage).reference.messageID).then(async (message) => { + await message.util.reply({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() }); + }) + : await message.util.send({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() }); } else { - return message.reference?.messageID && !message.util.isSlash + return (message as BushMessage).reference?.messageID && !message.util.isSlash ? await message.util.send({ content: `<@!${user.id}>`, embeds: [rulesEmbed], allowedMentions: AllowedMentions.users(), - reply: { messageReference: message.reference.messageID } + reply: { messageReference: (message as BushMessage).reference.messageID } }) : await message.util.send({ content: `<@!${user.id}>`, |