diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-12-29 16:15:06 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-12-29 16:15:06 -0500 |
commit | 08d7e6eb125c5ff6846c3a92491de79d291b8e12 (patch) | |
tree | 4abdaeee3ad258ef8fa0d7b517ea49d262d18b0b /src/commands/moderation | |
parent | f9cf43fc47be2d497d92d728ea892246df96d736 (diff) | |
download | tanzanite-08d7e6eb125c5ff6846c3a92491de79d291b8e12.tar.gz tanzanite-08d7e6eb125c5ff6846c3a92491de79d291b8e12.tar.bz2 tanzanite-08d7e6eb125c5ff6846c3a92491de79d291b8e12.zip |
misc improvements & typings changes
Diffstat (limited to 'src/commands/moderation')
-rw-r--r-- | src/commands/moderation/_activePunishments.ts (renamed from src/commands/moderation/activePunishments.ts) | 0 | ||||
-rw-r--r-- | src/commands/moderation/removeReactionEmoji.ts | 6 | ||||
-rw-r--r-- | src/commands/moderation/unmute.ts | 8 | ||||
-rw-r--r-- | src/commands/moderation/warn.ts | 8 |
4 files changed, 12 insertions, 10 deletions
diff --git a/src/commands/moderation/activePunishments.ts b/src/commands/moderation/_activePunishments.ts index d40f2ba..d40f2ba 100644 --- a/src/commands/moderation/activePunishments.ts +++ b/src/commands/moderation/_activePunishments.ts diff --git a/src/commands/moderation/removeReactionEmoji.ts b/src/commands/moderation/removeReactionEmoji.ts index bede2cf..919ee40 100644 --- a/src/commands/moderation/removeReactionEmoji.ts +++ b/src/commands/moderation/removeReactionEmoji.ts @@ -1,4 +1,5 @@ -import { ArgType, BushCommand, type BushMessage } from '#lib'; +import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; +import assert from 'assert'; import { Message, type Emoji } from 'discord.js'; export default class RemoveReactionEmojiCommand extends BushCommand { @@ -37,9 +38,10 @@ export default class RemoveReactionEmojiCommand extends BushCommand { } public override async exec( - message: BushMessage, + message: BushMessage | BushSlashMessage, args: { message: ArgType<'guildMessage'> | string; emoji: ArgType<'emoji'> | ArgType<'snowflake'> } ) { + 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); diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts index d36a5db..e7a19d6 100644 --- a/src/commands/moderation/unmute.ts +++ b/src/commands/moderation/unmute.ts @@ -1,12 +1,12 @@ import { AllowedMentions, - ArgType, BushCommand, Moderation, - OptionalArgType, + type ArgType, type BushGuildMember, type BushMessage, - type BushSlashMessage + type BushSlashMessage, + type OptionalArgType } from '#lib'; export default class UnmuteCommand extends BushCommand { @@ -56,7 +56,7 @@ export default class UnmuteCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, - { user, reason, force }: { user: ArgType<'user'>; reason: OptionalArgType<'string'>; force: boolean } + { user, reason, force = false }: { user: ArgType<'user'>; reason: OptionalArgType<'string'>; force?: boolean } ) { const error = util.emojis.error; const member = message.guild!.members.cache.get(user.id) as BushGuildMember; diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts index 95e409d..5093c9b 100644 --- a/src/commands/moderation/warn.ts +++ b/src/commands/moderation/warn.ts @@ -1,12 +1,12 @@ import { AllowedMentions, - ArgType, BushCommand, Moderation, - OptionalArgType, + type ArgType, type BushGuildMember, type BushMessage, - type BushSlashMessage + type BushSlashMessage, + type OptionalArgType } from '#lib'; export default class WarnCommand extends BushCommand { @@ -55,7 +55,7 @@ export default class WarnCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, - { user, reason, force }: { user: ArgType<'user'>; reason: OptionalArgType<'string'>; force?: boolean } + { user, reason, force = false }: { user: ArgType<'user'>; reason: OptionalArgType<'string'>; force?: boolean } ) { const member = message.guild!.members.cache.get(user.id) as BushGuildMember; if (!member) return message.util.reply(`${util.emojis.error} I cannot warn users that are not in the server.`); |