aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/mute.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-26 18:45:31 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-26 18:45:31 -0400
commitcca0b7a03bcd61af12b7f9bff51276f6c70beeb3 (patch)
tree2b2adebc166ac033520e5b582773e63fbdc5ddb9 /src/commands/moderation/mute.ts
parent13ba1ad552047eb9386e91d542a975c4bef58b08 (diff)
downloadtanzanite-cca0b7a03bcd61af12b7f9bff51276f6c70beeb3.tar.gz
tanzanite-cca0b7a03bcd61af12b7f9bff51276f6c70beeb3.tar.bz2
tanzanite-cca0b7a03bcd61af12b7f9bff51276f6c70beeb3.zip
refactor: this.client.util -> util
Diffstat (limited to 'src/commands/moderation/mute.ts')
-rw-r--r--src/commands/moderation/mute.ts29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts
index 2004eb8..0b10ee1 100644
--- a/src/commands/moderation/mute.ts
+++ b/src/commands/moderation/mute.ts
@@ -60,10 +60,11 @@ export default class MuteCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
{ user, reason, force }: { user: BushUser; reason?: { duration: number; contentWithoutTime: string }; force: boolean }
): Promise<unknown> {
- const error = this.client.util.emojis.error;
const member = message.guild.members.cache.get(user.id) as BushGuildMember;
+ if (!member) message.util.reply(`${util.emojis.error} You cannot kick members that are not in the server.`);
+
const useForce = force && message.author.isOwner();
- const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'mute', true, useForce);
+ const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'mute', true, useForce);
const victimBoldTag = `**${member.user.tag}**`;
if (canModerateResponse !== true) {
@@ -85,29 +86,29 @@ export default class MuteCommand extends BushCommand {
duration: time
});
- const responseMessage = () => {
- const prefix = message.guild.getSetting('prefix');
+ const responseMessage = async () => {
+ const prefix = await message.guild.getSetting('prefix');
switch (responseCode) {
case 'missing permissions':
- return `${error} Could not mute ${victimBoldTag} because I am missing the \`Manage Roles\` permission.`;
+ return `${util.emojis.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\`.`;
+ return `${util.emojis.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\`.`;
+ return `${util.emojis.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\`.`;
+ return `${util.emojis.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.`;
+ return `${util.emojis.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.`;
+ return `${util.emojis.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.`;
+ return `${util.emojis.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.`;
+ return `${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 `${util.emojis.success} Successfully muted **${member.user.tag}**.`;
}
};
- return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
+ return await message.util.reply({ content: await responseMessage(), allowedMentions: AllowedMentions.none() });
}
}