aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/lockdown.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-16 14:32:18 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-16 14:32:18 -0400
commit0e87bbd3940d89defcb04926587b35c8f4d1947f (patch)
treee50860d4dc25a11d4c3977b583284c4bcad1b077 /src/commands/moderation/lockdown.ts
parent661e4c9935aeb8760dafc7ced4bbec6cc356a033 (diff)
downloadtanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.tar.gz
tanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.tar.bz2
tanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.zip
remove util classes, move config out of src
Diffstat (limited to 'src/commands/moderation/lockdown.ts')
-rw-r--r--src/commands/moderation/lockdown.ts31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/commands/moderation/lockdown.ts b/src/commands/moderation/lockdown.ts
index 7d8211c..76d61d0 100644
--- a/src/commands/moderation/lockdown.ts
+++ b/src/commands/moderation/lockdown.ts
@@ -1,7 +1,12 @@
import {
AllowedMentions,
+ Arg,
BushCommand,
+ clientSendAndPermCheck,
+ colors,
ConfirmationPrompt,
+ emojis,
+ format,
type ArgType,
type CommandMessage,
type OptArgType,
@@ -31,7 +36,7 @@ export default class LockdownCommand extends BushCommand {
{
id: 'channel',
description: 'Specify a different channel to lockdown instead of the one you trigger the command in.',
- type: util.arg.union('textChannel', 'newsChannel', 'threadChannel', 'voiceChannel'),
+ type: Arg.union('textChannel', 'newsChannel', 'threadChannel', 'voiceChannel'),
prompt: 'What channel would you like to lockdown?',
slashType: ApplicationCommandOptionType.Channel,
channelTypes: [
@@ -65,7 +70,7 @@ export default class LockdownCommand extends BushCommand {
],
slash: true,
channel: 'guild',
- clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels]),
+ clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels]),
userPermissions: [PermissionFlagsBits.ManageChannels],
lock: 'channel'
});
@@ -95,7 +100,7 @@ export default class LockdownCommand extends BushCommand {
if (message.util.isSlashMessage(message)) await message.interaction.deferReply();
if (args.channel && args.all)
- return await message.util.reply(`${util.emojis.error} You can't specify a channel and set all to true at the same time.`);
+ return await message.util.reply(`${emojis.error} You can't specify a channel and set all to true at the same time.`);
const channel = args.channel ?? message.channel;
@@ -108,14 +113,14 @@ export default class LockdownCommand extends BushCommand {
)
)
return await message.util.reply(
- `${util.emojis.error} You can only ${action} text channels, news channels, and thread channels.`
+ `${emojis.error} You can only ${action} text channels, news channels, and thread channels.`
);
if (args.all) {
const confirmation = await ConfirmationPrompt.send(message, {
content: `Are you sure you want to ${action} all channels?`
});
- if (!confirmation) return message.util.sendNew(`${util.emojis.error} Lockdown cancelled.`);
+ if (!confirmation) return message.util.sendNew(`${emojis.error} Lockdown cancelled.`);
}
const response = await message.guild.lockdown({
@@ -128,33 +133,33 @@ export default class LockdownCommand extends BushCommand {
if (response instanceof Collection) {
return await message.util.sendNew({
- content: `${util.emojis.error} The following channels failed to ${action}:`,
+ content: `${emojis.error} The following channels failed to ${action}:`,
embeds: [
{
description: response.map((e, c) => `<#${c}> : ${e.message}`).join('\n'),
- color: util.colors.warn
+ color: colors.warn
}
]
});
} else {
let messageResponse;
if (response === 'all not chosen and no channel specified') {
- messageResponse = `${util.emojis.error} You must specify a channel to ${action}.`;
+ messageResponse = `${emojis.error} You must specify a channel to ${action}.`;
} else if (response.startsWith('invalid channel configured: ')) {
const channels = response.replace('invalid channel configured: ', '');
const actionFormatted = `${action.replace('down', '')}ed`;
- messageResponse = `${util.emojis.error} Some of the channels configured to be ${actionFormatted} cannot be resolved: ${channels}}`;
+ messageResponse = `${emojis.error} Some of the channels configured to be ${actionFormatted} cannot be resolved: ${channels}}`;
} else if (response === 'no channels configured') {
- messageResponse = `${util.emojis.error} The all option is selected but there are no channels configured to be locked down.`;
+ messageResponse = `${emojis.error} The all option is selected but there are no channels configured to be locked down.`;
} else if (response === 'moderator not found') {
- messageResponse = `${util.emojis.error} For some reason I could not resolve you?`;
+ messageResponse = `${emojis.error} For some reason I could not resolve you?`;
} else if (response.startsWith('success: ')) {
const num = Number.parseInt(response.replace('success: ', ''));
- messageResponse = `${util.emojis.success} Successfully ${
+ messageResponse = `${emojis.success} Successfully ${
action === 'lockdown' ? 'locked down' : 'unlocked'
} **${num}** channel${num > 0 ? 's' : ''}.`;
} else {
- return `${util.emojis.error} An error occurred: ${util.format.input(response)}}`;
+ return `${emojis.error} An error occurred: ${format.input(response)}}`;
}
assert(messageResponse);