aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/unmute.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/moderation/unmute.ts')
-rw-r--r--src/commands/moderation/unmute.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts
index fb4bb55..de16cb5 100644
--- a/src/commands/moderation/unmute.ts
+++ b/src/commands/moderation/unmute.ts
@@ -9,6 +9,7 @@ import {
type BushSlashMessage,
type OptionalArgType
} from '#lib';
+import assert from 'assert';
import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
export default class UnmuteCommand extends BushCommand {
@@ -60,10 +61,11 @@ export default class UnmuteCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
{ 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;
+ assert(message.inGuild());
+ assert(message.member);
- if (!message.member) throw new Error(`message.member is null`);
+ const error = util.emojis.error;
+ const member = message.guild.members.cache.get(user.id) as BushGuildMember;
const useForce = force && message.author.isOwner();
const canModerateResponse = await Moderation.permissionCheck(message.member, member, 'unmute', true, useForce);