aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/untimeout.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-07-06 22:10:58 +0200
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-07-06 22:10:58 +0200
commitadbb5e939cebcf4c0479d66162377957f2a845af (patch)
treee69b237c79fac2701f162fce6076ec1f85f617a9 /src/commands/moderation/untimeout.ts
parent22b3a8af49dc16bf5d8f9c3ce48b4770505ea33b (diff)
downloadtanzanite-adbb5e939cebcf4c0479d66162377957f2a845af.tar.gz
tanzanite-adbb5e939cebcf4c0479d66162377957f2a845af.tar.bz2
tanzanite-adbb5e939cebcf4c0479d66162377957f2a845af.zip
feat(automod): unmute button
Diffstat (limited to 'src/commands/moderation/untimeout.ts')
-rw-r--r--src/commands/moderation/untimeout.ts43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/commands/moderation/untimeout.ts b/src/commands/moderation/untimeout.ts
index c6860c5..aa6665d 100644
--- a/src/commands/moderation/untimeout.ts
+++ b/src/commands/moderation/untimeout.ts
@@ -9,10 +9,11 @@ import {
type ArgType,
type CommandMessage,
type OptArgType,
+ type RemoveTimeoutResponse,
type SlashMessage
} from '#lib';
import assert from 'assert';
-import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
+import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js';
export default class UntimeoutCommand extends BushCommand {
public constructor() {
@@ -84,23 +85,27 @@ export default class UntimeoutCommand extends BushCommand {
moderator: message.member
});
- const responseMessage = (): string => {
- const victim = format.input(member.user.tag);
- switch (responseCode) {
- case removeTimeoutResponse.MISSING_PERMISSIONS:
- return `${emojis.error} Could not untimeout ${victim} because I am missing the **Timeout Members** permission.`;
- case removeTimeoutResponse.ACTION_ERROR:
- return `${emojis.error} An unknown error occurred while trying to timeout ${victim}.`;
- case removeTimeoutResponse.MODLOG_ERROR:
- return `${emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
- case removeTimeoutResponse.DM_ERROR:
- return `${emojis.warn} Removed ${victim}'s timeout however I could not send them a dm.`;
- case removeTimeoutResponse.SUCCESS:
- return `${emojis.success} Successfully removed ${victim}'s timeout.`;
- default:
- return `${emojis.error} An error occurred: ${format.input(responseCode)}}`;
- }
- };
- return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
+ return await message.util.reply({
+ content: UntimeoutCommand.formatCode(member, responseCode),
+ allowedMentions: AllowedMentions.none()
+ });
+ }
+
+ public static formatCode(member: GuildMember, code: RemoveTimeoutResponse): string {
+ const victim = format.input(member.user.tag);
+ switch (code) {
+ case removeTimeoutResponse.MISSING_PERMISSIONS:
+ return `${emojis.error} Could not untimeout ${victim} because I am missing the **Timeout Members** permission.`;
+ case removeTimeoutResponse.ACTION_ERROR:
+ return `${emojis.error} An unknown error occurred while trying to timeout ${victim}.`;
+ case removeTimeoutResponse.MODLOG_ERROR:
+ return `${emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
+ case removeTimeoutResponse.DM_ERROR:
+ return `${emojis.warn} Removed ${victim}'s timeout however I could not send them a dm.`;
+ case removeTimeoutResponse.SUCCESS:
+ return `${emojis.success} Successfully removed ${victim}'s timeout.`;
+ default:
+ return `${emojis.error} An error occurred: ${format.input(code)}}`;
+ }
}
}