aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/mute.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-14 13:12:32 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-14 13:12:32 -0400
commit070b5f326d0647e7b105f99811e4bdc915c8652e (patch)
tree15c5e3366acb9f6056de83924db6dd9db961061a /src/commands/moderation/mute.ts
parentcdb8b0297f806cb3147b3759b0fd234bffbcc3f9 (diff)
downloadtanzanite-070b5f326d0647e7b105f99811e4bdc915c8652e.tar.gz
tanzanite-070b5f326d0647e7b105f99811e4bdc915c8652e.tar.bz2
tanzanite-070b5f326d0647e7b105f99811e4bdc915c8652e.zip
revamped role command and some other stuff
Diffstat (limited to 'src/commands/moderation/mute.ts')
-rw-r--r--src/commands/moderation/mute.ts68
1 files changed, 26 insertions, 42 deletions
diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts
index 0eae547..7443c55 100644
--- a/src/commands/moderation/mute.ts
+++ b/src/commands/moderation/mute.ts
@@ -1,4 +1,4 @@
-import { BushCommand, BushGuildMember, BushMessage, BushSlashMessage, BushUser } from '@lib';
+import { AllowedMentions, BushCommand, BushGuildMember, BushMessage, BushSlashMessage, BushUser } from '@lib';
import { Argument } from 'discord-akairo';
export default class MuteCommand extends BushCommand {
@@ -73,51 +73,35 @@ export default class MuteCommand extends BushCommand {
}
const parsedReason = reason.contentWithoutTime;
- const response = await member.mute({
+ const responseCode = await member.mute({
reason: parsedReason,
moderator: message.author,
duration: time
});
- switch (response) {
- case 'missing permissions':
- return message.util.reply(
- `${error} Could not mute ${victimBoldTag} because I am missing the \`Manage Roles\` permission.`
- );
- case 'no mute role':
- return message.util.reply(
- `${error} Could not mute ${victimBoldTag}, you must set a mute role with \`${message.guild.getSetting(
- 'prefix'
- )}muterole\`.`
- );
- case 'invalid mute role':
- return message.util.reply(
- `${error} Could not mute ${victimBoldTag} because the current mute role no longer exists. Please set a new mute role with \`${message.guild.getSetting(
- 'prefix'
- )}muterole\`.`
- );
- case 'mute role not manageable':
- return message.util.reply(
- `${error} Could not mute ${victimBoldTag} because I cannot assign the current mute role, either change the role's position or set a new mute role with \`${message.guild.getSetting(
- 'prefix'
- )}muterole\`.`
- );
- case 'error giving mute role':
- return message.util.reply(`${error} Could not mute ${victimBoldTag}, there was an error assigning them the mute role.`);
- case 'error creating modlog entry':
- return message.util.reply(
- `${error} While muting ${victimBoldTag}, there was an error creating a modlog entry, please report this to my developers.`
- );
- case 'error creating mute entry':
- return message.util.reply(
- `${error} While muting ${victimBoldTag}, there was an error creating a mute entry, please report this to my developers.`
- );
- case 'failed to dm':
- return message.util.reply(
- `${this.client.util.emojis.warn} Muted **${member.user.tag}** however I could not send them a dm.`
- );
- case 'success':
- return message.util.reply(`${this.client.util.emojis.success} Successfully muted **${member.user.tag}**.`);
- }
+ const responseMessage = () => {
+ const prefix = message.guild.getSetting('prefix');
+ switch (responseCode) {
+ case 'missing permissions':
+ return `${error} Could not mute ${victimBoldTag} because I am missing the \`Manage Roles\` permission.`;
+ case 'no mute role':
+ return `${error} Could not mute ${victimBoldTag}, you must set a mute role with \`${prefix}muterole\`.`;
+ case 'invalid mute role':
+ return `${error} Could not mute ${victimBoldTag} because the current mute role no longer exists. Please set a new mute role with \`${prefix}muterole\`.`;
+ case 'mute role not manageable':
+ return `${error} Could not mute ${victimBoldTag} because I cannot assign the current mute role, either change the role's position or set a new mute role with \`${prefix}muterole\`.`;
+ case 'error giving mute role':
+ return `${error} Could not mute ${victimBoldTag}, there was an error assigning them the mute role.`;
+ case 'error creating modlog entry':
+ return `${error} There was an error creating a modlog entry, please report this to my developers.`;
+ case 'error creating mute entry':
+ return `${error} There was an error creating a punishment entry, please report this to my developers.`;
+ case 'failed to dm':
+ return `${this.client.util.emojis.warn} Muted **${member.user.tag}** however I could not send them a dm.`;
+ case 'success':
+ return `${this.client.util.emojis.success} Successfully muted **${member.user.tag}**.`;
+ }
+ };
+ return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
}
}