aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/block.ts
diff options
context:
space:
mode:
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() });