aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/block.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/block.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/block.ts')
-rw-r--r--src/commands/moderation/block.ts33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/commands/moderation/block.ts b/src/commands/moderation/block.ts
index 16beb6f..fc93fb1 100644
--- a/src/commands/moderation/block.ts
+++ b/src/commands/moderation/block.ts
@@ -2,7 +2,12 @@ import {
AllowedMentions,
blockResponse,
BushCommand,
+ castDurationContent,
+ clientSendAndPermCheck,
+ emojis,
+ format,
Moderation,
+ userGuildPermCheck,
type ArgType,
type CommandMessage,
type OptArgType,
@@ -51,8 +56,8 @@ export default class BlockCommand extends BushCommand {
],
slash: true,
channel: 'guild',
- clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels]),
- userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages]),
+ clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels]),
+ userPermissions: (m) => userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages]),
lock: 'channel'
});
}
@@ -70,13 +75,13 @@ export default class BlockCommand extends BushCommand {
assert(message.channel);
if (!message.channel.isTextBased())
- return message.util.send(`${util.emojis.error} This command can only be used in text based channels.`);
+ return message.util.send(`${emojis.error} This command can only be used in text based channels.`);
- const { duration, content } = await util.castDurationContent(args.reason_and_duration, message);
+ const { duration, content } = await castDurationContent(args.reason_and_duration, message);
const member = await message.guild.members.fetch(args.user.id).catch(() => null);
if (!member)
- return await message.util.reply(`${util.emojis.error} The user you selected is not in the server or is not a valid user.`);
+ return await message.util.reply(`${emojis.error} The user you selected is not in the server or is not a valid user.`);
const useForce = args.force && message.author.isOwner();
const canModerateResponse = await Moderation.permissionCheck(message.member, member, 'block', true, useForce);
@@ -93,24 +98,24 @@ export default class BlockCommand extends BushCommand {
});
const responseMessage = (): string => {
- const victim = util.format.input(member.user.tag);
+ const victim = format.input(member.user.tag);
switch (responseCode) {
case blockResponse.MISSING_PERMISSIONS:
- return `${util.emojis.error} Could not block ${victim} because I am missing the **Manage Channel** permission.`;
+ return `${emojis.error} Could not block ${victim} because I am missing the **Manage Channel** permission.`;
case blockResponse.INVALID_CHANNEL:
- return `${util.emojis.error} Could not block ${victim}, you can only block users in text or thread channels.`;
+ return `${emojis.error} Could not block ${victim}, you can only block users in text or thread channels.`;
case blockResponse.ACTION_ERROR:
- return `${util.emojis.error} An unknown error occurred while trying to block ${victim}.`;
+ return `${emojis.error} An unknown error occurred while trying to block ${victim}.`;
case blockResponse.MODLOG_ERROR:
- return `${util.emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
+ return `${emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
case blockResponse.PUNISHMENT_ENTRY_ADD_ERROR:
- return `${util.emojis.error} There was an error creating a punishment entry, please report this to my developers.`;
+ return `${emojis.error} There was an error creating a punishment entry, please report this to my developers.`;
case blockResponse.DM_ERROR:
- return `${util.emojis.warn} Blocked ${victim} however I could not send them a dm.`;
+ return `${emojis.warn} Blocked ${victim} however I could not send them a dm.`;
case blockResponse.SUCCESS:
- return `${util.emojis.success} Successfully blocked ${victim}.`;
+ return `${emojis.success} Successfully blocked ${victim}.`;
default:
- return `${util.emojis.error} An error occurred: ${util.format.input(responseCode)}}`;
+ return `${emojis.error} An error occurred: ${format.input(responseCode)}}`;
}
};
return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });