aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/moderation/ban.ts13
-rw-r--r--src/commands/moderation/block.ts15
-rw-r--r--src/commands/moderation/evidence.ts4
-rw-r--r--src/commands/moderation/hideCase.ts4
-rw-r--r--src/commands/moderation/kick.ts22
-rw-r--r--src/commands/moderation/mute.ts19
-rw-r--r--src/commands/moderation/role.ts30
-rw-r--r--src/commands/moderation/timeout.ts22
-rw-r--r--src/commands/moderation/unban.ts23
-rw-r--r--src/commands/moderation/unblock.ts15
-rw-r--r--src/commands/moderation/unmute.ts19
-rw-r--r--src/commands/moderation/untimeout.ts19
-rw-r--r--src/commands/moderation/warn.ts8
13 files changed, 127 insertions, 86 deletions
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index f21ccdc..7f0b91f 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -1,5 +1,6 @@
import {
AllowedMentions,
+ banResponse,
BushCommand,
Moderation,
type ArgType,
@@ -126,17 +127,17 @@ export default class BanCommand extends BushCommand {
const responseMessage = (): string => {
const victim = util.format.input(user.tag);
switch (responseCode) {
- case 'missing permissions':
+ case banResponse.MISSING_PERMISSIONS:
return `${util.emojis.error} Could not ban ${victim} because I am missing the **Ban Members** permission.`;
- case 'error banning':
+ case banResponse.ACTION_ERROR:
return `${util.emojis.error} An error occurred while trying to ban ${victim}.`;
- case 'error creating ban entry':
+ case banResponse.PUNISHMENT_ENTRY_ADD_ERROR:
return `${util.emojis.error} While banning ${victim}, there was an error creating a ban entry, please report this to my developers.`;
- case 'error creating modlog entry':
+ case banResponse.MODLOG_ERROR:
return `${util.emojis.error} While banning ${victim}, there was an error creating a modlog entry, please report this to my developers.`;
- case 'failed to dm':
+ case banResponse.DM_ERROR:
return `${util.emojis.warn} Banned ${victim} however I could not send them a dm.`;
- case 'success':
+ case banResponse.SUCCESS:
return `${util.emojis.success} Successfully banned ${victim}.`;
}
};
diff --git a/src/commands/moderation/block.ts b/src/commands/moderation/block.ts
index d53ffd5..57f909a 100644
--- a/src/commands/moderation/block.ts
+++ b/src/commands/moderation/block.ts
@@ -1,5 +1,6 @@
import {
AllowedMentions,
+ blockResponse,
BushCommand,
BushTextChannel,
BushThreadChannel,
@@ -105,19 +106,19 @@ export default class BlockCommand extends BushCommand {
const responseMessage = (): string => {
const victim = util.format.input(member.user.tag);
switch (responseCode) {
- case 'missing permissions':
+ case blockResponse.MISSING_PERMISSIONS:
return `${util.emojis.error} Could not block ${victim} because I am missing the **Manage Channel** permission.`;
- case 'invalid channel':
+ case blockResponse.INVALID_CHANNEL:
return `${util.emojis.error} Could not block ${victim}, you can only block users in text or thread channels.`;
- case 'error blocking':
+ case blockResponse.ACTION_ERROR:
return `${util.emojis.error} An unknown error occurred while trying to block ${victim}.`;
- case 'error creating modlog entry':
+ case blockResponse.MODLOG_ERROR:
return `${util.emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
- case 'error creating block entry':
+ case blockResponse.PUNISHMENT_ENTRY_ADD_ERROR:
return `${util.emojis.error} There was an error creating a punishment entry, please report this to my developers.`;
- case 'failed to dm':
+ case blockResponse.DM_ERROR:
return `${util.emojis.warn} Blocked ${victim} however I could not send them a dm.`;
- case 'success':
+ case blockResponse.SUCCESS:
return `${util.emojis.success} Successfully blocked ${victim}.`;
}
};
diff --git a/src/commands/moderation/evidence.ts b/src/commands/moderation/evidence.ts
index 714a2e5..cff63ed 100644
--- a/src/commands/moderation/evidence.ts
+++ b/src/commands/moderation/evidence.ts
@@ -7,8 +7,8 @@ export default class EvidenceCommand extends BushCommand {
aliases: ['evidence'],
category: 'moderation',
description: 'Add evidence to a modlog case.',
- usage: ['evidence <case_id> <evidence>'],
- examples: ['evidence 9210b1ea-91f5-4ea2-801b-02b394469c77 was spamming in #general'],
+ usage: ['evidence <caseId> <evidence>'],
+ examples: ['evidence IgQvFpzgIKJ77mZ62TEuG was spamming in #general'],
args: [
{
id: 'case_id',
diff --git a/src/commands/moderation/hideCase.ts b/src/commands/moderation/hideCase.ts
index 04160fd..e12d8c8 100644
--- a/src/commands/moderation/hideCase.ts
+++ b/src/commands/moderation/hideCase.ts
@@ -6,8 +6,8 @@ export default class HideCaseCommand extends BushCommand {
aliases: ['hide-case', 'hide_case', 'show-case', 'show_case', 'cover-up-mod-abuse', 'cover_up_mod_abuse'],
category: 'moderation',
description: 'Hide a particular modlog case from the modlog command unless the `--hidden` flag is specified',
- usage: ['hide-case <case_id>'],
- examples: ['hide-case 9210b1ea-91f5-4ea2-801b-02b394469c77'],
+ usage: ['hide-case <caseId>'],
+ examples: ['hide-case Xurm---HdRyHlrKLsOcIO'],
args: [
{
id: 'case_id',
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index 6d96ae9..af486ac 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -1,4 +1,12 @@
-import { AllowedMentions, BushCommand, Moderation, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import {
+ AllowedMentions,
+ BushCommand,
+ kickResponse,
+ Moderation,
+ type ArgType,
+ type BushMessage,
+ type BushSlashMessage
+} from '#lib';
export default class KickCommand extends BushCommand {
public constructor() {
@@ -68,15 +76,15 @@ export default class KickCommand extends BushCommand {
const responseMessage = (): string => {
const victim = util.format.input(member.user.tag);
switch (responseCode) {
- case 'missing permissions':
- return `${util.emojis.error} Could not kick ${victim} because I am missing the \`Kick Members\` permission.`;
- case 'error kicking':
+ case kickResponse.MISSING_PERMISSIONS:
+ return `${util.emojis.error} Could not kick ${victim} because I am missing the **Kick Members** permission.`;
+ case kickResponse.ACTION_ERROR:
return `${util.emojis.error} An error occurred while trying to kick ${victim}.`;
- case 'error creating modlog entry':
+ case kickResponse.MODLOG_ERROR:
return `${util.emojis.error} While muting ${victim}, there was an error creating a modlog entry, please report this to my developers.`;
- case 'failed to dm':
+ case kickResponse.DM_ERROR:
return `${util.emojis.warn} Kicked ${victim} however I could not send them a dm.`;
- case 'success':
+ case kickResponse.SUCCESS:
return `${util.emojis.success} Successfully kicked ${victim}.`;
}
};
diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts
index e731e30..40e13e7 100644
--- a/src/commands/moderation/mute.ts
+++ b/src/commands/moderation/mute.ts
@@ -2,6 +2,7 @@ import {
AllowedMentions,
BushCommand,
Moderation,
+ muteResponse,
type ArgType,
type BushMessage,
type BushSlashMessage,
@@ -99,23 +100,23 @@ export default class MuteCommand extends BushCommand {
const prefix = util.prefix(message);
const victim = util.format.input(member.user.tag);
switch (responseCode) {
- case 'missing permissions':
+ case muteResponse.MISSING_PERMISSIONS:
return `${util.emojis.error} Could not mute ${victim} because I am missing the **Manage Roles** permission.`;
- case 'no mute role':
+ case muteResponse.NO_MUTE_ROLE:
return `${util.emojis.error} Could not mute ${victim}, you must set a mute role with \`${prefix}config muteRole\`.`;
- case 'invalid mute role':
+ case muteResponse.MUTE_ROLE_INVALID:
return `${util.emojis.error} Could not mute ${victim} because the current mute role no longer exists. Please set a new mute role with \`${prefix}config muteRole\`.`;
- case 'mute role not manageable':
+ case muteResponse.MUTE_ROLE_NOT_MANAGEABLE:
return `${util.emojis.error} Could not mute ${victim} because I cannot assign the current mute role, either change the role's position or set a new mute role with \`${prefix}config muteRole\`.`;
- case 'error giving mute role':
+ case muteResponse.ACTION_ERROR:
return `${util.emojis.error} Could not mute ${victim}, there was an error assigning them the mute role.`;
- case 'error creating modlog entry':
+ case muteResponse.MODLOG_ERROR:
return `${util.emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
- case 'error creating mute entry':
+ case muteResponse.PUNISHMENT_ENTRY_ADD_ERROR:
return `${util.emojis.error} There was an error creating a punishment entry, please report this to my developers.`;
- case 'failed to dm':
+ case muteResponse.DM_ERROR:
return `${util.emojis.warn} Muted ${victim} however I could not send them a dm.`;
- case 'success':
+ case muteResponse.SUCCESS:
return `${util.emojis.success} Successfully muted ${victim}.`;
}
};
diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts
index 6cb8d2f..f0d0448 100644
--- a/src/commands/moderation/role.ts
+++ b/src/commands/moderation/role.ts
@@ -1,4 +1,13 @@
-import { AllowedMentions, BushCommand, type ArgType, type BushMessage, type BushSlashMessage, type OptionalArgType } from '#lib';
+import {
+ addRoleResponse,
+ AllowedMentions,
+ BushCommand,
+ removeRoleResponse,
+ type ArgType,
+ type BushMessage,
+ type BushSlashMessage,
+ type OptionalArgType
+} from '#lib';
import { type ArgumentOptions, type Flag } from 'discord-akairo';
import { type Snowflake } from 'discord.js';
@@ -170,25 +179,26 @@ export default class RoleCommand extends BushCommand {
const responseMessage = (): string => {
const victim = util.format.input(args.member.user.tag);
switch (responseCode) {
- case 'user hierarchy':
+ case addRoleResponse.MISSING_PERMISSIONS:
+ return `${util.emojis.error} I don't have the **Manage Roles** permission.`;
+ case addRoleResponse.USER_HIERARCHY:
return `${util.emojis.error} <@&${args.role.id}> is higher or equal to your highest role.`;
- case 'role managed':
+ case addRoleResponse.ROLE_MANAGED:
return `${util.emojis.error} <@&${args.role.id}> is managed by an integration and cannot be managed.`;
- case 'client hierarchy':
+ case addRoleResponse.CLIENT_HIERARCHY:
return `${util.emojis.error} <@&${args.role.id}> is higher or equal to my highest role.`;
- case 'error creating modlog entry':
+ case addRoleResponse.MODLOG_ERROR:
return `${util.emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
- case 'error creating role entry':
- case 'error removing role entry':
+ case addRoleResponse.PUNISHMENT_ENTRY_ADD_ERROR:
+ case removeRoleResponse.PUNISHMENT_ENTRY_REMOVE_ERROR:
return `${util.emojis.error} There was an error ${
args.action === 'add' ? 'creating' : 'removing'
} a punishment entry, please report this to my developers.`;
- case 'error adding role':
- case 'error removing role':
+ case addRoleResponse.ACTION_ERROR:
return `${util.emojis.error} An error occurred while trying to ${args.action} <@&${args.role.id}> ${
args.action === 'add' ? 'to' : 'from'
} ${victim}.`;
- case 'success':
+ case addRoleResponse.SUCCESS:
return `${util.emojis.success} Successfully ${args.action === 'add' ? 'added' : 'removed'} <@&${args.role.id}> ${
args.action === 'add' ? 'to' : 'from'
} ${victim}${args.duration ? ` for ${util.humanizeDuration(args.duration)}` : ''}.`;
diff --git a/src/commands/moderation/timeout.ts b/src/commands/moderation/timeout.ts
index 3968bde..ec79271 100644
--- a/src/commands/moderation/timeout.ts
+++ b/src/commands/moderation/timeout.ts
@@ -1,4 +1,12 @@
-import { AllowedMentions, BushCommand, Moderation, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import {
+ AllowedMentions,
+ BushCommand,
+ Moderation,
+ timeoutResponse,
+ type ArgType,
+ type BushMessage,
+ type BushSlashMessage
+} from '#lib';
import assert from 'assert';
export default class TimeoutCommand extends BushCommand {
@@ -81,17 +89,17 @@ export default class TimeoutCommand extends BushCommand {
const responseMessage = (): string => {
const victim = util.format.input(member.user.tag);
switch (responseCode) {
- case 'missing permissions':
+ case timeoutResponse.MISSING_PERMISSIONS:
return `${util.emojis.error} Could not timeout ${victim} because I am missing the **Timeout Members** permission.`;
- case 'duration too long':
+ case timeoutResponse.INVALID_DURATION:
return `${util.emojis.error} The duration you specified is too long, the longest you can timeout someone for is 28 days.`;
- case 'error timing out':
+ case timeoutResponse.ACTION_ERROR:
return `${util.emojis.error} An unknown error occurred while trying to timeout ${victim}.`;
- case 'error creating modlog entry':
+ case timeoutResponse.MODLOG_ERROR:
return `${util.emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
- case 'failed to dm':
+ case timeoutResponse.DM_ERROR:
return `${util.emojis.warn} Timed out ${victim} however I could not send them a dm.`;
- case 'success':
+ case timeoutResponse.SUCCESS:
return `${util.emojis.success} Successfully timed out ${victim}.`;
}
};
diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts
index bbce4e0..c939792 100644
--- a/src/commands/moderation/unban.ts
+++ b/src/commands/moderation/unban.ts
@@ -1,4 +1,12 @@
-import { AllowedMentions, BushCommand, type ArgType, type BushMessage, type BushSlashMessage, type OptionalArgType } from '#lib';
+import {
+ AllowedMentions,
+ BushCommand,
+ unbanResponse,
+ type ArgType,
+ type BushMessage,
+ type BushSlashMessage,
+ type OptionalArgType
+} from '#lib';
export default class UnbanCommand extends BushCommand {
public constructor() {
@@ -47,17 +55,18 @@ export default class UnbanCommand extends BushCommand {
const responseMessage = (): string => {
const victim = util.format.input(user.tag);
switch (responseCode) {
- case 'missing permissions':
+ case unbanResponse.MISSING_PERMISSIONS:
return `${util.emojis.error} Could not unban ${victim} because I am missing the **Ban Members** permission.`;
- case 'error unbanning':
+ case unbanResponse.ACTION_ERROR:
return `${util.emojis.error} An error occurred while trying to unban ${victim}.`;
- case 'error removing ban entry':
+ case unbanResponse.PUNISHMENT_ENTRY_REMOVE_ERROR:
return `${util.emojis.error} While unbanning ${victim}, there was an error removing their ban entry, please report this to my developers.`;
- case 'error creating modlog entry':
+ case unbanResponse.MODLOG_ERROR:
return `${util.emojis.error} While unbanning ${victim}, there was an error creating a modlog entry, please report this to my developers.`;
- case 'user not banned':
+ case unbanResponse.NOT_BANNED:
return `${util.emojis.warn} ${victim} is not banned but I tried to unban them anyways.`;
- case 'success':
+ case unbanResponse.DM_ERROR:
+ case unbanResponse.SUCCESS:
return `${util.emojis.success} Successfully unbanned ${victim}.`;
}
};
diff --git a/src/commands/moderation/unblock.ts b/src/commands/moderation/unblock.ts
index 4cc8b49..454de8b 100644
--- a/src/commands/moderation/unblock.ts
+++ b/src/commands/moderation/unblock.ts
@@ -4,6 +4,7 @@ import {
BushTextChannel,
BushThreadChannel,
Moderation,
+ unblockResponse,
type ArgType,
type BushMessage,
type BushSlashMessage,
@@ -87,19 +88,19 @@ export default class UnblockCommand extends BushCommand {
const responseMessage = (): string => {
const victim = util.format.input(member.user.tag);
switch (responseCode) {
- case 'missing permissions':
+ case unblockResponse.MISSING_PERMISSIONS:
return `${util.emojis.error} Could not unblock ${victim} because I am missing the **Manage Channel** permission.`;
- case 'invalid channel':
+ case unblockResponse.INVALID_CHANNEL:
return `${util.emojis.error} Could not unblock ${victim}, you can only unblock users in text or thread channels.`;
- case 'error unblocking':
+ case unblockResponse.ACTION_ERROR:
return `${util.emojis.error} An unknown error occurred while trying to unblock ${victim}.`;
- case 'error creating modlog entry':
+ case unblockResponse.MODLOG_ERROR:
return `${util.emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
- case 'error removing block entry':
+ case unblockResponse.PUNISHMENT_ENTRY_REMOVE_ERROR:
return `${util.emojis.error} There was an error creating a punishment entry, please report this to my developers.`;
- case 'failed to dm':
+ case unblockResponse.DM_ERROR:
return `${util.emojis.warn} Unblocked ${victim} however I could not send them a dm.`;
- case 'success':
+ case unblockResponse.SUCCESS:
return `${util.emojis.success} Successfully unblocked ${victim}.`;
}
};
diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts
index 631f213..3bd399f 100644
--- a/src/commands/moderation/unmute.ts
+++ b/src/commands/moderation/unmute.ts
@@ -2,6 +2,7 @@ import {
AllowedMentions,
BushCommand,
Moderation,
+ unmuteResponse,
type ArgType,
type BushGuildMember,
type BushMessage,
@@ -79,23 +80,23 @@ export default class UnmuteCommand extends BushCommand {
const prefix = util.prefix(message);
const victim = util.format.input(member.user.tag);
switch (responseCode) {
- case 'missing permissions':
+ case unmuteResponse.MISSING_PERMISSIONS:
return `${error} Could not unmute ${victim} because I am missing the **Manage Roles** permission.`;
- case 'no mute role':
+ case unmuteResponse.NO_MUTE_ROLE:
return `${error} Could not unmute ${victim}, you must set a mute role with \`${prefix}config muteRole\`.`;
- case 'invalid mute role':
+ case unmuteResponse.MUTE_ROLE_INVALID:
return `${error} Could not unmute ${victim} because the current mute role no longer exists. Please set a new mute role with \`${prefix}config muteRole\`.`;
- case 'mute role not manageable':
+ case unmuteResponse.MUTE_ROLE_NOT_MANAGEABLE:
return `${error} Could not unmute ${victim} because I cannot assign the current mute role, either change the role's position or set a new mute role with \`${prefix}config muteRole\`.`;
- case 'error removing mute role':
+ case unmuteResponse.ACTION_ERROR:
return `${error} Could not unmute ${victim}, there was an error removing their mute role.`;
- case 'error creating modlog entry':
+ case unmuteResponse.MODLOG_ERROR:
return `${error} While muting ${victim}, there was an error creating a modlog entry, please report this to my developers.`;
- case 'error removing mute entry':
+ case unmuteResponse.PUNISHMENT_ENTRY_REMOVE_ERROR:
return `${error} While muting ${victim}, there was an error removing their mute entry, please report this to my developers.`;
- case 'failed to dm':
+ case unmuteResponse.DM_ERROR:
return `${util.emojis.warn} unmuted ${victim} however I could not send them a dm.`;
- case 'success':
+ case unmuteResponse.SUCCESS:
return `${util.emojis.success} Successfully unmuted ${victim}.`;
}
};
diff --git a/src/commands/moderation/untimeout.ts b/src/commands/moderation/untimeout.ts
index b5ea5be..c5518b4 100644
--- a/src/commands/moderation/untimeout.ts
+++ b/src/commands/moderation/untimeout.ts
@@ -2,6 +2,7 @@ import {
AllowedMentions,
BushCommand,
Moderation,
+ removeTimeoutResponse,
type ArgType,
type BushMessage,
type BushSlashMessage,
@@ -81,18 +82,16 @@ export default class UntimeoutCommand extends BushCommand {
const responseMessage = (): string => {
const victim = util.format.input(member.user.tag);
switch (responseCode) {
- case 'missing permissions':
- return `${util.emojis.error} Could not timeout ${victim} because I am missing the **Timeout Members** permission.`;
- case 'duration too long':
- return `${util.emojis.error} The duration you specified is too long, the longest you can timeout someone for is 28 days.`;
- case 'error removing timeout':
+ case removeTimeoutResponse.MISSING_PERMISSIONS:
+ return `${util.emojis.error} Could not untimeout ${victim} because I am missing the **Timeout Members** permission.`;
+ case removeTimeoutResponse.ACTION_ERROR:
return `${util.emojis.error} An unknown error occurred while trying to timeout ${victim}.`;
- case 'error creating modlog entry':
+ case removeTimeoutResponse.MODLOG_ERROR:
return `${util.emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
- case 'failed to dm':
- return `${util.emojis.warn} Timed out ${victim} however I could not send them a dm.`;
- case 'success':
- return `${util.emojis.success} Successfully timed out ${victim}.`;
+ case removeTimeoutResponse.DM_ERROR:
+ return `${util.emojis.warn} Removed ${victim}'s timeout however I could not send them a dm.`;
+ case removeTimeoutResponse.SUCCESS:
+ return `${util.emojis.success} Successfully removed ${victim}'s timeout.`;
}
};
return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts
index 05b1e36..aebf300 100644
--- a/src/commands/moderation/warn.ts
+++ b/src/commands/moderation/warn.ts
@@ -2,6 +2,7 @@ import {
AllowedMentions,
BushCommand,
Moderation,
+ warnResponse,
type ArgType,
type BushGuildMember,
type BushMessage,
@@ -75,13 +76,14 @@ export default class WarnCommand extends BushCommand {
const responseMessage = (): string => {
const victim = util.format.input(member.user.tag);
switch (response) {
- case 'error creating modlog entry':
+ case warnResponse.MODLOG_ERROR:
return `${util.emojis.error} While warning ${victim}, there was an error creating a modlog entry, please report this to my developers.`;
- case 'failed to dm':
+ case warnResponse.ACTION_ERROR:
+ case warnResponse.DM_ERROR:
return `${util.emojis.warn} ${victim} has been warned for the ${util.ordinal(
caseNum ?? 0
)} time, however I could not send them a dm.`;
- case 'success':
+ case warnResponse.SUCCESS:
return `${util.emojis.success} Successfully warned ${victim} for the ${util.ordinal(caseNum ?? 0)} time.`;
}
};