diff options
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/moderation/ban.ts | 8 | ||||
-rw-r--r-- | src/commands/moderation/kick.ts | 2 | ||||
-rw-r--r-- | src/commands/moderation/mute.ts | 2 | ||||
-rw-r--r-- | src/commands/moderation/unban.ts | 1 | ||||
-rw-r--r-- | src/commands/moderation/unmute.ts | 14 | ||||
-rw-r--r-- | src/commands/moderation/warn.ts | 2 |
6 files changed, 21 insertions, 8 deletions
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index 2c3e429..5a1b5d9 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -95,10 +95,13 @@ export default class BanCommand extends BushCommand { if (!user) return message.util.reply(`${util.emojis.error} Invalid user.`); const useForce = force && message.author.isOwner(); if (!message.member) throw new Error(`message.member is null`); - const canModerateResponse = member ? util.moderationPermissionCheck(message.member, member, 'ban', true, useForce) : true; + + const canModerateResponse = member + ? await util.moderationPermissionCheck(message.member, member, 'ban', true, useForce) + : true; if (canModerateResponse !== true) { - return message.util.reply(canModerateResponse); + return await message.util.reply(canModerateResponse); } if (message.util.parsed?.alias === 'dban' && !days) days = 1; @@ -147,7 +150,6 @@ export default class BanCommand extends BushCommand { return `${util.emojis.success} Successfully banned **${user.tag}**.`; } }; - client.console.debug(responseCode); return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() }); } } diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index 341d83c..e7f9708 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -67,7 +67,7 @@ export default class KickCommand extends BushCommand { ); if (!message.member) throw new Error(`message.member is null`); const useForce = force && message.author.isOwner(); - const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'kick', true, useForce); + const canModerateResponse = await util.moderationPermissionCheck(message.member, member, 'kick', true, useForce); if (canModerateResponse !== true) { return message.util.reply(canModerateResponse); diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index ea2ff41..849873e 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -68,7 +68,7 @@ export default class MuteCommand extends BushCommand { if (!message.member) throw new Error(`message.member is null`); const useForce = force && message.author.isOwner(); - const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'mute', true, useForce); + const canModerateResponse = await util.moderationPermissionCheck(message.member, member, 'mute', true, useForce); const victimBoldTag = `**${member.user.tag}**`; if (canModerateResponse !== true) { diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts index f13e7f6..3436da6 100644 --- a/src/commands/moderation/unban.ts +++ b/src/commands/moderation/unban.ts @@ -58,6 +58,7 @@ export default class UnbanCommand extends BushCommand { if (!(user instanceof User)) { user = util.resolveUser(user, client.users.cache) as BushUser; } + const responseCode = await message.guild!.unban({ user, moderator: message.author, diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts index acbda3e..3383583 100644 --- a/src/commands/moderation/unmute.ts +++ b/src/commands/moderation/unmute.ts @@ -28,6 +28,11 @@ export default class UnmuteCommand extends BushCommand { retry: '{error} Choose a valid unmute reason.', optional: true } + }, + { + id: 'force', + flag: '--force', + match: 'flag' } ], slash: true, @@ -53,12 +58,17 @@ export default class UnmuteCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, - { user, reason }: { user: BushUser; reason?: string } + { user, reason, force }: { user: BushUser; reason?: string; force: boolean } ): Promise<unknown> { const error = util.emojis.error; const member = message.guild!.members.cache.get(user.id) as BushGuildMember; + if (!message.member) throw new Error(`message.member is null`); - const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'unmute'); + + const useForce = force && message.author.isOwner(); + + const canModerateResponse = await util.moderationPermissionCheck(message.member, member, 'unmute', true, useForce); + const victimBoldTag = `**${member.user.tag}**`; if (canModerateResponse !== true) { diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts index a9469cf..0fa83f3 100644 --- a/src/commands/moderation/warn.ts +++ b/src/commands/moderation/warn.ts @@ -62,7 +62,7 @@ export default class WarnCommand extends BushCommand { const member = message.guild!.members.cache.get(user.id) as BushGuildMember; const useForce = force && message.author.isOwner(); if (!message.member) throw new Error(`message.member is null`); - const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'warn', true, useForce); + const canModerateResponse = await util.moderationPermissionCheck(message.member, member, 'warn', true, useForce); const victimBoldTag = `**${member.user.tag}**`; if (canModerateResponse !== true) { |