aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-10-16 18:56:47 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-10-16 18:56:47 -0400
commit46d087e17a549a3b1bb9797714d5c3df440b67f5 (patch)
treea536a9dacf59e53d4288b839d80e20a392ac1190 /src
parent2b12b94e08f4ffdbb35d6f623604657944450a82 (diff)
downloadtanzanite-46d087e17a549a3b1bb9797714d5c3df440b67f5.tar.gz
tanzanite-46d087e17a549a3b1bb9797714d5c3df440b67f5.tar.bz2
tanzanite-46d087e17a549a3b1bb9797714d5c3df440b67f5.zip
moderation changes + appeals progress
Diffstat (limited to 'src')
-rw-r--r--src/commands/config/disable.ts18
-rw-r--r--src/commands/moderation/ban.ts30
-rw-r--r--src/commands/moderation/block.ts30
-rw-r--r--src/commands/moderation/kick.ts26
-rw-r--r--src/commands/moderation/massBan.ts2
-rw-r--r--src/commands/moderation/mute.ts34
-rw-r--r--src/commands/moderation/role.ts41
-rw-r--r--src/commands/moderation/timeout.ts30
-rw-r--r--src/commands/moderation/unban.ts32
-rw-r--r--src/commands/moderation/unblock.ts32
-rw-r--r--src/commands/moderation/untimeout.ts26
-rw-r--r--src/commands/moderation/warn.ts28
-rw-r--r--src/listeners/bush/supportThread.ts2
-rw-r--r--src/listeners/member-custom/massBan.ts2
14 files changed, 50 insertions, 283 deletions
diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts
index 776ecf0..ef994dd 100644
--- a/src/commands/config/disable.ts
+++ b/src/commands/config/disable.ts
@@ -8,6 +8,7 @@ import {
type CommandMessage,
type SlashMessage
} from '#lib';
+import { input } from '#lib/utils/Format.js';
import assert from 'assert/strict';
import { ApplicationCommandOptionType, AutocompleteInteraction } from 'discord.js';
@@ -87,21 +88,24 @@ export default class DisableCommand extends BotCommand {
const success = global
? await this.client.utils.setGlobal('disabledCommands', newValue).catch(() => false)
: await message.guild.setSetting('disabledCommands', newValue, message.member!).catch(() => false);
- if (!success)
+
+ const actionStem = action.substring(0, action.length - 2);
+
+ if (!success) {
return await message.util.reply({
- content: `${emojis.error} There was an error${global ? ' globally' : ''} **${action.substring(
- 0,
- action.length - 2
- )}ing** the **${commandID}** command.`,
+ content: `${emojis.error} There was an error${global ? ' globally' : ''} **${actionStem}ing** the ${input(
+ commandID
+ )} command.`,
allowedMentions: AllowedMentions.none()
});
- else
+ } else {
return await message.util.reply({
- content: `${emojis.success} Successfully **${action.substring(0, action.length - 2)}ed** the **${commandID}** command${
+ content: `${emojis.success} Successfully **${actionStem}ed** the ${input(commandID)} command${
global ? ' globally' : ''
}.`,
allowedMentions: AllowedMentions.none()
});
+ }
}
public override async autocomplete(interaction: AutocompleteInteraction) {
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index ae77cde..851c2e9 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -1,20 +1,18 @@
import {
AllowedMentions,
Arg,
- banResponse,
BotCommand,
castDurationContent,
emojis,
- format,
+ formatBanResponse,
Moderation,
type ArgType,
- type BanResponse,
type CommandMessage,
type OptArgType,
type SlashMessage
} from '#lib';
import assert from 'assert/strict';
-import { ApplicationCommandOptionType, type User } from 'discord.js';
+import { ApplicationCommandOptionType } from 'discord.js';
export default class BanCommand extends BotCommand {
public constructor() {
@@ -113,30 +111,8 @@ export default class BanCommand extends BotCommand {
const responseCode = member ? await member.customBan(opts) : await message.guild.customBan({ user, ...opts });
return await message.util.reply({
- content: BanCommand.formatCode(user, responseCode),
+ content: formatBanResponse(user, responseCode),
allowedMentions: AllowedMentions.none()
});
}
-
- public static formatCode(user: User, code: BanResponse): string {
- const victim = format.input(user.tag);
- switch (code) {
- case banResponse.ALREADY_BANNED:
- return `${emojis.error} ${victim} is already banned.`;
- case banResponse.MISSING_PERMISSIONS:
- return `${emojis.error} Could not ban ${victim} because I am missing the **Ban Members** permission.`;
- case banResponse.ACTION_ERROR:
- return `${emojis.error} An error occurred while trying to ban ${victim}.`;
- case banResponse.PUNISHMENT_ENTRY_ADD_ERROR:
- return `${emojis.error} While banning ${victim}, there was an error creating a ban entry, please report this to my developers.`;
- case banResponse.MODLOG_ERROR:
- return `${emojis.error} While banning ${victim}, there was an error creating a modlog entry, please report this to my developers.`;
- case banResponse.DM_ERROR:
- return `${emojis.warn} Banned ${victim} however I could not send them a dm.`;
- case banResponse.SUCCESS:
- return `${emojis.success} Successfully banned ${victim}.`;
- default:
- return `${emojis.error} An error occurred: ${format.input(code)}}`;
- }
- }
}
diff --git a/src/commands/moderation/block.ts b/src/commands/moderation/block.ts
index da1dec8..989eb39 100644
--- a/src/commands/moderation/block.ts
+++ b/src/commands/moderation/block.ts
@@ -1,19 +1,17 @@
import {
AllowedMentions,
- blockResponse,
BotCommand,
castDurationContent,
emojis,
- format,
+ formatBlockResponse,
Moderation,
type ArgType,
- type BlockResponse,
type CommandMessage,
type OptArgType,
type SlashMessage
} from '#lib';
import assert from 'assert/strict';
-import { ApplicationCommandOptionType, type GuildMember } from 'discord.js';
+import { ApplicationCommandOptionType } from 'discord.js';
export default class BlockCommand extends BotCommand {
public constructor() {
@@ -97,30 +95,8 @@ export default class BlockCommand extends BotCommand {
});
return await message.util.reply({
- content: BlockCommand.formatCode(member, responseCode),
+ content: formatBlockResponse(member, responseCode),
allowedMentions: AllowedMentions.none()
});
}
-
- public static formatCode(member: GuildMember, code: BlockResponse): string {
- const victim = format.input(member.user.tag);
- switch (code) {
- case blockResponse.MISSING_PERMISSIONS:
- return `${emojis.error} Could not block ${victim} because I am missing the **Manage Channel** permission.`;
- case blockResponse.INVALID_CHANNEL:
- return `${emojis.error} Could not block ${victim}, you can only block users in text or thread channels.`;
- case blockResponse.ACTION_ERROR:
- return `${emojis.error} An unknown error occurred while trying to block ${victim}.`;
- case blockResponse.MODLOG_ERROR:
- return `${emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
- case blockResponse.PUNISHMENT_ENTRY_ADD_ERROR:
- return `${emojis.error} There was an error creating a punishment entry, please report this to my developers.`;
- case blockResponse.DM_ERROR:
- return `${emojis.warn} Blocked ${victim} however I could not send them a dm.`;
- case blockResponse.SUCCESS:
- return `${emojis.success} Successfully blocked ${victim}.`;
- default:
- return `${emojis.error} An error occurred: ${format.input(code)}}`;
- }
- }
}
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index d757e91..e4aebbd 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -2,17 +2,15 @@ import {
AllowedMentions,
BotCommand,
emojis,
- format,
- kickResponse,
+ formatKickResponse,
Moderation,
type ArgType,
type CommandMessage,
- type KickResponse,
type OptArgType,
type SlashMessage
} from '#lib';
import assert from 'assert/strict';
-import { ApplicationCommandOptionType, type GuildMember } from 'discord.js';
+import { ApplicationCommandOptionType } from 'discord.js';
export default class KickCommand extends BotCommand {
public constructor() {
@@ -82,26 +80,8 @@ export default class KickCommand extends BotCommand {
});
return await message.util.reply({
- content: KickCommand.formatCode(member, responseCode),
+ content: formatKickResponse(member, responseCode),
allowedMentions: AllowedMentions.none()
});
}
-
- public static formatCode(member: GuildMember, code: KickResponse): string {
- const victim = format.input(member.user.tag);
- switch (code) {
- case kickResponse.MISSING_PERMISSIONS:
- return `${emojis.error} Could not kick ${victim} because I am missing the **Kick Members** permission.`;
- case kickResponse.ACTION_ERROR:
- return `${emojis.error} An error occurred while trying to kick ${victim}.`;
- case kickResponse.MODLOG_ERROR:
- return `${emojis.error} While muting ${victim}, there was an error creating a modlog entry, please report this to my developers.`;
- case kickResponse.DM_ERROR:
- return `${emojis.warn} Kicked ${victim} however I could not send them a dm.`;
- case kickResponse.SUCCESS:
- return `${emojis.success} Successfully kicked ${victim}.`;
- default:
- return `${emojis.error} An error occurred: ${format.input(code)}}`;
- }
- }
}
diff --git a/src/commands/moderation/massBan.ts b/src/commands/moderation/massBan.ts
index 445506f..bb8d435 100644
--- a/src/commands/moderation/massBan.ts
+++ b/src/commands/moderation/massBan.ts
@@ -105,7 +105,7 @@ export default class MassBanCommand extends BotCommand {
map
);
- const success = (res: BanResponse): boolean => [banResponse.SUCCESS, banResponse.DM_ERROR].includes(res as any);
+ const success = (res: BanResponse): boolean => [banResponse.Success, banResponse.DmError].includes(res as any);
const lines = res.map((_, i) => {
const id = ids[i];
diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts
index a64dc99..7e494bb 100644
--- a/src/commands/moderation/mute.ts
+++ b/src/commands/moderation/mute.ts
@@ -3,17 +3,15 @@ import {
BotCommand,
castDurationContent,
emojis,
- format,
+ formatMuteResponse,
Moderation,
- muteResponse,
type ArgType,
type CommandMessage,
- type MuteResponse,
type OptArgType,
type SlashMessage
} from '#lib';
import assert from 'assert/strict';
-import { ApplicationCommandOptionType, type GuildMember } from 'discord.js';
+import { ApplicationCommandOptionType } from 'discord.js';
export default class MuteCommand extends BotCommand {
public constructor() {
@@ -91,34 +89,8 @@ export default class MuteCommand extends BotCommand {
});
return await message.util.reply({
- content: MuteCommand.formatCode(this.client.utils.prefix(message), member, responseCode),
+ content: formatMuteResponse(this.client.utils.prefix(message), member, responseCode),
allowedMentions: AllowedMentions.none()
});
}
-
- public static formatCode(prefix: string, member: GuildMember, code: MuteResponse): string {
- const victim = format.input(member.user.tag);
- switch (code) {
- case muteResponse.MISSING_PERMISSIONS:
- return `${emojis.error} Could not mute ${victim} because I am missing the **Manage Roles** permission.`;
- case muteResponse.NO_MUTE_ROLE:
- return `${emojis.error} Could not mute ${victim}, you must set a mute role with \`${prefix}config muteRole\`.`;
- case muteResponse.MUTE_ROLE_INVALID:
- return `${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 muteResponse.MUTE_ROLE_NOT_MANAGEABLE:
- return `${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 muteResponse.ACTION_ERROR:
- return `${emojis.error} Could not mute ${victim}, there was an error assigning them the mute role.`;
- case muteResponse.MODLOG_ERROR:
- return `${emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
- case muteResponse.PUNISHMENT_ENTRY_ADD_ERROR:
- return `${emojis.error} There was an error creating a punishment entry, please report this to my developers.`;
- case muteResponse.DM_ERROR:
- return `${emojis.warn} Muted ${victim} however I could not send them a dm.`;
- case muteResponse.SUCCESS:
- return `${emojis.success} Successfully muted ${victim}.`;
- default:
- return `${emojis.error} An error occurred: ${format.input(code)}}`;
- }
- }
}
diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts
index a664aa4..fcd4b4b 100644
--- a/src/commands/moderation/role.ts
+++ b/src/commands/moderation/role.ts
@@ -1,12 +1,9 @@
import {
- addRoleResponse,
AllowedMentions,
BotCommand,
emojis,
- format,
- humanizeDuration,
+ formatRoleResponse,
mappings,
- removeRoleResponse,
type ArgType,
type CommandMessage,
type OptArgType,
@@ -175,38 +172,10 @@ export default class RoleCommand extends BotCommand {
duration: args.duration
});
- const responseMessage = (): string => {
- const victim = format.input(args.member.user.tag);
- switch (responseCode) {
- case addRoleResponse.MISSING_PERMISSIONS:
- return `${emojis.error} I don't have the **Manage Roles** permission.`;
- case addRoleResponse.USER_HIERARCHY:
- return `${emojis.error} <@&${args.role.id}> is higher or equal to your highest role.`;
- case addRoleResponse.ROLE_MANAGED:
- return `${emojis.error} <@&${args.role.id}> is managed by an integration and cannot be managed.`;
- case addRoleResponse.CLIENT_HIERARCHY:
- return `${emojis.error} <@&${args.role.id}> is higher or equal to my highest role.`;
- case addRoleResponse.MODLOG_ERROR:
- return `${emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
- case addRoleResponse.PUNISHMENT_ENTRY_ADD_ERROR:
- case removeRoleResponse.PUNISHMENT_ENTRY_REMOVE_ERROR:
- return `${emojis.error} There was an error ${
- args.action === 'add' ? 'creating' : 'removing'
- } a punishment entry, please report this to my developers.`;
- case addRoleResponse.ACTION_ERROR:
- return `${emojis.error} An error occurred while trying to ${args.action} <@&${args.role.id}> ${
- args.action === 'add' ? 'to' : 'from'
- } ${victim}.`;
- case addRoleResponse.SUCCESS:
- return `${emojis.success} Successfully ${args.action === 'add' ? 'added' : 'removed'} <@&${args.role.id}> ${
- args.action === 'add' ? 'to' : 'from'
- } ${victim}${args.duration ? ` for ${humanizeDuration(args.duration)}` : ''}.`;
- default:
- return `${emojis.error} An error occurred: ${format.input(responseCode)}}`;
- }
- };
-
- await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
+ await message.util.reply({
+ content: formatRoleResponse(args.role.id, args.action, args.duration, args.member, responseCode),
+ allowedMentions: AllowedMentions.none()
+ });
}
private punishmentRoleNames = [
diff --git a/src/commands/moderation/timeout.ts b/src/commands/moderation/timeout.ts
index db6ab56..43f169e 100644
--- a/src/commands/moderation/timeout.ts
+++ b/src/commands/moderation/timeout.ts
@@ -3,16 +3,14 @@ import {
BotCommand,
castDurationContent,
emojis,
- format,
+ formatTimeoutResponse,
Moderation,
- timeoutResponse,
type ArgType,
type CommandMessage,
- type SlashMessage,
- type TimeoutResponse
+ type SlashMessage
} from '#lib';
import assert from 'assert/strict';
-import { ApplicationCommandOptionType, type GuildMember } from 'discord.js';
+import { ApplicationCommandOptionType } from 'discord.js';
export default class TimeoutCommand extends BotCommand {
public constructor() {
@@ -92,28 +90,8 @@ export default class TimeoutCommand extends BotCommand {
});
return await message.util.reply({
- content: TimeoutCommand.formatCode(member, responseCode),
+ content: formatTimeoutResponse(member, responseCode),
allowedMentions: AllowedMentions.none()
});
}
-
- public static formatCode(member: GuildMember, code: TimeoutResponse): string {
- const victim = format.input(member.user.tag);
- switch (code) {
- case timeoutResponse.MISSING_PERMISSIONS:
- return `${emojis.error} Could not timeout ${victim} because I am missing the **Timeout Members** permission.`;
- case timeoutResponse.INVALID_DURATION:
- return `${emojis.error} The duration you specified is too long, the longest you can timeout someone for is 28 days.`;
- case timeoutResponse.ACTION_ERROR:
- return `${emojis.error} An unknown error occurred while trying to timeout ${victim}.`;
- case timeoutResponse.MODLOG_ERROR:
- return `${emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
- case timeoutResponse.DM_ERROR:
- return `${emojis.warn} Timed out ${victim} however I could not send them a dm.`;
- case timeoutResponse.SUCCESS:
- return `${emojis.success} Successfully timed out ${victim}.`;
- default:
- return `${emojis.error} An error occurred: ${format.input(code)}}`;
- }
- }
}
diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts
index 537e176..3037fd0 100644
--- a/src/commands/moderation/unban.ts
+++ b/src/commands/moderation/unban.ts
@@ -2,17 +2,14 @@ import {
AllowedMentions,
Arg,
BotCommand,
- emojis,
- format,
- unbanResponse,
+ formatUnbanResponse,
type ArgType,
type CommandMessage,
type OptArgType,
- type SlashMessage,
- type UnbanResponse
+ type SlashMessage
} from '#lib';
import assert from 'assert/strict';
-import { ApplicationCommandOptionType, type User } from 'discord.js';
+import { ApplicationCommandOptionType } from 'discord.js';
export default class UnbanCommand extends BotCommand {
public constructor() {
@@ -62,29 +59,8 @@ export default class UnbanCommand extends BotCommand {
});
return await message.util.reply({
- content: UnbanCommand.formatCode(user, responseCode),
+ content: formatUnbanResponse(user, responseCode),
allowedMentions: AllowedMentions.none()
});
}
-
- public static formatCode(user: User, code: UnbanResponse): string {
- const victim = format.input(user.tag);
- switch (code) {
- case unbanResponse.MISSING_PERMISSIONS:
- return `${emojis.error} Could not unban ${victim} because I am missing the **Ban Members** permission.`;
- case unbanResponse.ACTION_ERROR:
- return `${emojis.error} An error occurred while trying to unban ${victim}.`;
- case unbanResponse.PUNISHMENT_ENTRY_REMOVE_ERROR:
- return `${emojis.error} While unbanning ${victim}, there was an error removing their ban entry, please report this to my developers.`;
- case unbanResponse.MODLOG_ERROR:
- return `${emojis.error} While unbanning ${victim}, there was an error creating a modlog entry, please report this to my developers.`;
- case unbanResponse.NOT_BANNED:
- return `${emojis.warn} ${victim} is not banned but I tried to unban them anyways.`;
- case unbanResponse.DM_ERROR:
- case unbanResponse.SUCCESS:
- return `${emojis.success} Successfully unbanned ${victim}.`;
- default:
- return `${emojis.error} An error occurred: ${format.input(code)}}`;
- }
- }
}
diff --git a/src/commands/moderation/unblock.ts b/src/commands/moderation/unblock.ts
index 4fdfc28..70bf530 100644
--- a/src/commands/moderation/unblock.ts
+++ b/src/commands/moderation/unblock.ts
@@ -2,17 +2,15 @@ import {
AllowedMentions,
BotCommand,
emojis,
- format,
+ formatUnblockResponse,
Moderation,
- unblockResponse,
type ArgType,
type CommandMessage,
type OptArgType,
- type SlashMessage,
- type UnblockResponse
+ type SlashMessage
} from '#lib';
import assert from 'assert/strict';
-import { ApplicationCommandOptionType, type GuildMember } from 'discord.js';
+import { ApplicationCommandOptionType } from 'discord.js';
export default class UnblockCommand extends BotCommand {
public constructor() {
@@ -94,30 +92,8 @@ export default class UnblockCommand extends BotCommand {
});
return await message.util.reply({
- content: UnblockCommand.formatCode(member, responseCode),
+ content: formatUnblockResponse(member, responseCode),
allowedMentions: AllowedMentions.none()
});
}
-
- public static formatCode(member: GuildMember, code: UnblockResponse): string {
- const victim = format.input(member.user.tag);
- switch (code) {
- case unblockResponse.MISSING_PERMISSIONS:
- return `${emojis.error} Could not unblock ${victim} because I am missing the **Manage Channel** permission.`;
- case unblockResponse.INVALID_CHANNEL:
- return `${emojis.error} Could not unblock ${victim}, you can only unblock users in text or thread channels.`;
- case unblockResponse.ACTION_ERROR:
- return `${emojis.error} An unknown error occurred while trying to unblock ${victim}.`;
- case unblockResponse.MODLOG_ERROR:
- return `${emojis.error} There was an error creating a modlog entry, please report this to my developers.`;
- case unblockResponse.PUNISHMENT_ENTRY_REMOVE_ERROR:
- return `${emojis.error} There was an error creating a punishment entry, please report this to my developers.`;
- case unblockResponse.DM_ERROR:
- return `${emojis.warn} Unblocked ${victim} however I could not send them a dm.`;
- case unblockResponse.SUCCESS:
- return `${emojis.success} Successfully unblocked ${victim}.`;
- default:
- return `${emojis.error} An error occurred: ${format.input(code)}}`;
- }
- }
}
diff --git a/src/commands/moderation/untimeout.ts b/src/commands/moderation/untimeout.ts
index 64364e5..2bfa410 100644
--- a/src/commands/moderation/untimeout.ts
+++ b/src/commands/moderation/untimeout.ts
@@ -2,17 +2,15 @@ import {
AllowedMentions,
BotCommand,
emojis,
- format,
+ formatUntimeoutResponse,
Moderation,
- removeTimeoutResponse,
type ArgType,
type CommandMessage,
type OptArgType,
- type RemoveTimeoutResponse,
type SlashMessage
} from '#lib';
import assert from 'assert/strict';
-import { ApplicationCommandOptionType, type GuildMember } from 'discord.js';
+import { ApplicationCommandOptionType } from 'discord.js';
export default class UntimeoutCommand extends BotCommand {
public constructor() {
@@ -91,26 +89,8 @@ export default class UntimeoutCommand extends BotCommand {
});
return await message.util.reply({
- content: UntimeoutCommand.formatCode(member, responseCode),
+ content: formatUntimeoutResponse(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)}}`;
- }
- }
}
diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts
index a7ed814..fc459c5 100644
--- a/src/commands/moderation/warn.ts
+++ b/src/commands/moderation/warn.ts
@@ -2,18 +2,15 @@ import {
AllowedMentions,
BotCommand,
emojis,
- format,
+ formatWarnResponse,
Moderation,
- ordinal,
- warnResponse,
type ArgType,
type CommandMessage,
type OptArgType,
- type SlashMessage,
- type WarnResponse
+ type SlashMessage
} from '#lib';
import assert from 'assert/strict';
-import { ApplicationCommandOptionType, type GuildMember } from 'discord.js';
+import { ApplicationCommandOptionType } from 'discord.js';
export default class WarnCommand extends BotCommand {
public constructor() {
@@ -81,25 +78,8 @@ export default class WarnCommand extends BotCommand {
});
return await message.util.reply({
- content: WarnCommand.formatCode(caseNum, member, responseCode),
+ content: formatWarnResponse(caseNum, member, responseCode),
allowedMentions: AllowedMentions.none()
});
}
-
- public static formatCode(caseNum: number | null, member: GuildMember, code: WarnResponse): string {
- const victim = format.input(member.user.tag);
- switch (code) {
- case warnResponse.MODLOG_ERROR:
- return `${emojis.error} While warning ${victim}, there was an error creating a modlog entry, please report this to my developers.`;
- case warnResponse.ACTION_ERROR:
- case warnResponse.DM_ERROR:
- return `${emojis.warn} ${victim} has been warned for the ${ordinal(
- caseNum ?? 0
- )} time, however I could not send them a dm.`;
- case warnResponse.SUCCESS:
- return `${emojis.success} Successfully warned ${victim} for the ${ordinal(caseNum ?? 0)} time.`;
- default:
- return `${emojis.error} An error occurred: ${format.input(code)}}`;
- }
- }
}
diff --git a/src/listeners/bush/supportThread.ts b/src/listeners/bush/supportThread.ts
index ea39f3b..467cf42 100644
--- a/src/listeners/bush/supportThread.ts
+++ b/src/listeners/bush/supportThread.ts
@@ -18,7 +18,7 @@ export default class SupportThreadListener extends BotListener {
if (message.author.bot && (message.author.id !== '444871677176709141' || !message.content.includes('uploaded a log,')))
return;
- if (message.guild.id !== mappings.guilds["Moulberry's Bush"]) return; // mb
+ if (message.guild.id !== mappings.guilds["Moulberry's Bush"]) return;
if (message.channel.id !== mappings.channels['neu-support']) return;
if (
diff --git a/src/listeners/member-custom/massBan.ts b/src/listeners/member-custom/massBan.ts
index 501902e..177a5b3 100644
--- a/src/listeners/member-custom/massBan.ts
+++ b/src/listeners/member-custom/massBan.ts
@@ -22,7 +22,7 @@ export default class MassBanListener extends BotListener {
const logChannel = await guild.getLogChannel('moderation');
if (!logChannel) return;
- const success = (res: BanResponse): boolean => [banResponse.SUCCESS, banResponse.DM_ERROR].includes(res as any);
+ const success = (res: BanResponse): boolean => [banResponse.Success, banResponse.DmError].includes(res as any);
const lines = results.map(
(reason, user) => `${success(reason) ? emojis.success : emojis.error} ${user}${success(reason) ? '' : ` - ${reason}`}`