diff options
Diffstat (limited to 'src/commands/moderation/mute.ts')
-rw-r--r-- | src/commands/moderation/mute.ts | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index eeffc6c..e731e30 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -15,7 +15,7 @@ export default class MuteCommand extends BushCommand { aliases: ['mute'], category: 'moderation', description: 'Mute a user.', - usage: ['mute <member> [reason] [duration]'], + usage: ['mute <member> [reasonAndDuration]'], examples: ['mute ironm00n 1 day commands in #general'], args: [ { @@ -27,7 +27,7 @@ export default class MuteCommand extends BushCommand { slashType: 'USER' }, { - id: 'reason', + id: 'reason_and_duration', description: 'The reason and duration of the mute.', type: 'contentWithDuration', match: 'rest', @@ -56,12 +56,16 @@ export default class MuteCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, - args: { user: ArgType<'user'>; reason: OptionalArgType<'contentWithDuration'> | string; force?: ArgType<'boolean'> } + args: { + user: ArgType<'user'>; + reason_and_duration: OptionalArgType<'contentWithDuration'> | string; + force?: ArgType<'boolean'>; + } ) { - const reason = args.reason - ? typeof args.reason === 'string' - ? await util.arg.cast('contentWithDuration', message, args.reason) - : args.reason + const reason = args.reason_and_duration + ? typeof args.reason_and_duration === 'string' + ? await util.arg.cast('contentWithDuration', message, args.reason_and_duration) + : args.reason_and_duration : { duration: null, contentWithoutTime: '' }; if (reason.duration === null) reason.duration = 0; @@ -85,13 +89,13 @@ export default class MuteCommand extends BushCommand { const parsedReason = reason?.contentWithoutTime ?? ''; - const responseCode = await member.mute({ + const responseCode = await member.bushMute({ reason: parsedReason, moderator: message.member, duration: time ?? 0 }); - const responseMessage = () => { + const responseMessage = (): string => { const prefix = util.prefix(message); const victim = util.format.input(member.user.tag); switch (responseCode) { |