diff options
Diffstat (limited to 'src')
201 files changed, 709 insertions, 790 deletions
@@ -1,6 +1,6 @@ console.log('Tanzanite is Starting'); -import { init } from '../lib/utils/BushLogger.js'; +import { init } from '../lib/utils/Logger.js'; // creates proxies on console.log and console.warn // also starts a REPL session init(); @@ -9,12 +9,12 @@ import { config } from '#config'; import { dirname } from 'path'; import { fileURLToPath } from 'url'; import { Sentry } from '../lib/common/Sentry.js'; -import { BushClient } from '../lib/extensions/discord-akairo/BushClient.js'; +import { TanzaniteClient } from '../lib/extensions/discord-akairo/TanzaniteClient.js'; const isDry = process.argv.includes('dry'); if (!isDry && config.credentials.sentryDsn !== null) new Sentry(dirname(fileURLToPath(import.meta.url)) || process.cwd(), config); -BushClient.extendStructures(); -const client = new BushClient(config); +TanzaniteClient.extendStructures(); +const client = new TanzaniteClient(config); // @ts-ignore: for debugging purposes global.client = client; diff --git a/src/commands/_fake-command/ironmoon.ts b/src/commands/_fake-command/ironmoon.ts index cb50c7e..bb4fd88 100644 --- a/src/commands/_fake-command/ironmoon.ts +++ b/src/commands/_fake-command/ironmoon.ts @@ -1,6 +1,6 @@ -import { BushCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, type CommandMessage, type SlashMessage } from '#lib'; -export default class IronmoonCommand extends BushCommand { +export default class IronmoonCommand extends BotCommand { public constructor() { super('ironmoon', { category: 'fake-commands', diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts index 0b09e54..e17a85b 100644 --- a/src/commands/admin/channelPermissions.ts +++ b/src/commands/admin/channelPermissions.ts @@ -1,6 +1,6 @@ import { Arg, - BushCommand, + BotCommand, ButtonPaginator, clientSendAndPermCheck, emojis, @@ -12,7 +12,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; -export default class ChannelPermissionsCommand extends BushCommand { +export default class ChannelPermissionsCommand extends BotCommand { public constructor() { super('channelPermissions', { aliases: ['channel-perms', 'cperms', 'cperm', 'chanperms', 'chanperm', 'channel-permissions'], diff --git a/src/commands/admin/roleAll.ts b/src/commands/admin/roleAll.ts index dda536f..3675891 100644 --- a/src/commands/admin/roleAll.ts +++ b/src/commands/admin/roleAll.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, type ArgType, @@ -10,7 +10,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; -export default class RoleAllCommand extends BushCommand { +export default class RoleAllCommand extends BotCommand { public constructor() { super('roleAll', { aliases: ['role-all', 'rall'], diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts index a098f9d..5419658 100644 --- a/src/commands/config/blacklist.ts +++ b/src/commands/config/blacklist.ts @@ -2,7 +2,7 @@ import { addOrRemoveFromArray, AllowedMentions, Arg, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, format, @@ -13,7 +13,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, GuildMember, PermissionFlagsBits, User } from 'discord.js'; -export default class BlacklistCommand extends BushCommand { +export default class BlacklistCommand extends BotCommand { public constructor() { super('blacklist', { aliases: ['blacklist', 'unblacklist'], diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index 39a44d1..a37d67c 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -1,6 +1,6 @@ import { addOrRemoveFromArray, - BushCommand, + BotCommand, clientSendAndPermCheck, colors, emojis, @@ -47,7 +47,7 @@ export type Action = typeof allActions[number]; type SlashArgType = 'ROLE' | 'STRING' | 'CHANNEL' | 'USER'; type BaseSettingTypes = 'string' | 'channel' | 'role' | 'user' | 'custom'; -export default class ConfigCommand extends BushCommand { +export default class ConfigCommand extends BotCommand { public constructor() { super('config', { aliases: ['config', 'settings', 'setting', 'configure'], diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts index f9abb4a..a4a876c 100644 --- a/src/commands/config/disable.ts +++ b/src/commands/config/disable.ts @@ -2,7 +2,7 @@ import { addOrRemoveFromArray, AllowedMentions, Arg, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, type ArgType, @@ -15,7 +15,7 @@ import { default as Fuse } from 'fuse.js'; assert(Fuse); -export default class DisableCommand extends BushCommand { +export default class DisableCommand extends BotCommand { private static blacklistedCommands = ['eval', 'disable']; public constructor() { @@ -72,7 +72,7 @@ export default class DisableCommand extends BushCommand { let action = (args.action ?? message.util?.parsed?.alias ?? 'toggle') as 'disable' | 'enable' | 'toggle'; const global = args.global && message.author.isOwner(); const commandID = - args.command instanceof BushCommand ? args.command.id : (await Arg.cast('commandAlias', message, args.command))?.id; + args.command instanceof BotCommand ? args.command.id : (await Arg.cast('commandAlias', message, args.command))?.id; if (!commandID) return await message.util.reply(`${emojis.error} Invalid command.`); diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts index 0036349..55f99bd 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, clientSendAndPermCheck, colors, emojis, @@ -20,7 +20,7 @@ import { type SelectMenuInteraction } from 'discord.js'; -export default class FeaturesCommand extends BushCommand { +export default class FeaturesCommand extends BotCommand { public constructor() { super('features', { aliases: ['features'], diff --git a/src/commands/config/log.ts b/src/commands/config/log.ts index f79f60e..f058670 100644 --- a/src/commands/config/log.ts +++ b/src/commands/config/log.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, guildLogsArr, @@ -13,7 +13,7 @@ import assert from 'assert/strict'; import { ArgumentGeneratorReturn } from 'discord-akairo'; import { ApplicationCommandOptionType, ChannelType, PermissionFlagsBits } from 'discord.js'; -export default class LogCommand extends BushCommand { +export default class LogCommand extends BotCommand { public constructor() { super('log', { aliases: ['log', 'logging'], diff --git a/src/commands/dev/__template.ts b/src/commands/dev/__template.ts index df4d146..fbb88ac 100644 --- a/src/commands/dev/__template.ts +++ b/src/commands/dev/__template.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, type ArgType, @@ -9,7 +9,7 @@ import { } from '#lib'; import { ApplicationCommandOptionType } from 'discord.js'; -export default class TemplateCommand extends BushCommand { +export default class TemplateCommand extends BotCommand { public constructor() { super('template', { aliases: ['template'], diff --git a/src/commands/dev/dm.ts b/src/commands/dev/dm.ts index c1340b1..e51651e 100644 --- a/src/commands/dev/dm.ts +++ b/src/commands/dev/dm.ts @@ -1,7 +1,7 @@ -import { BushCommand, clientSendAndPermCheck, emojis, format, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, emojis, format, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; import { ApplicationCommandOptionType } from 'discord.js'; -export default class DMCommand extends BushCommand { +export default class DMCommand extends BotCommand { public constructor() { super('dm', { aliases: ['dm'], diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index dd21454..3929f99 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -2,10 +2,10 @@ import { ActivePunishment, assertAll, - BushCommand, - BushInspectOptions, + BotCommand, CodeBlockLang, colors, + CustomInspectOptions, emojis, getMethods, Global, @@ -56,9 +56,9 @@ const { transpile } = ts, /* eslint-enable @typescript-eslint/no-unused-vars */ // prettier-ignore -assertAll(ActivePunishment, BushCommand, Global, Guild, Level, ModLog, Shared, StickyRole, Snowflake_, canvas, exec, ActionRow, ButtonComponent, ButtonInteraction, Collection, Collector, CommandInteraction, ContextMenuCommandInteraction, DMChannel, Embed, Emoji, InteractionCollector, Message, Attachment, MessageCollector, OAuth2Scopes, PermissionFlagsBits, PermissionsBitField, ReactionCollector, SelectMenuComponent, path, ts, fileURLToPath, promisify, assert, transpile, sh, SnowflakeUtil, __dirname); +assertAll(ActivePunishment, BotCommand, Global, Guild, Level, ModLog, Shared, StickyRole, Snowflake_, canvas, exec, ActionRow, ButtonComponent, ButtonInteraction, Collection, Collector, CommandInteraction, ContextMenuCommandInteraction, DMChannel, Embed, Emoji, InteractionCollector, Message, Attachment, MessageCollector, OAuth2Scopes, PermissionFlagsBits, PermissionsBitField, ReactionCollector, SelectMenuComponent, path, ts, fileURLToPath, promisify, assert, transpile, sh, SnowflakeUtil, __dirname); -export default class EvalCommand extends BushCommand { +export default class EvalCommand extends BotCommand { public constructor() { super('eval', { aliases: ['eval', 'ev', 'evaluate'], @@ -316,7 +316,7 @@ export default class EvalCommand extends BushCommand { } } -type CodeBlockOptions = BushInspectOptions & { inspectStrings?: boolean }; +type CodeBlockOptions = CustomInspectOptions & { inspectStrings?: boolean }; interface CodeBlockCustomOptions extends CodeBlockOptions { prototype?: boolean; methods?: boolean; diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts index 12ad6f7..43ccf94 100644 --- a/src/commands/dev/javascript.ts +++ b/src/commands/dev/javascript.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, clientSendAndPermCheck, colors, emojis, @@ -13,7 +13,7 @@ import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js'; import { VM } from 'vm2'; assert(VM); -export default class JavascriptCommand extends BushCommand { +export default class JavascriptCommand extends BotCommand { public constructor() { super('javascript', { aliases: ['javascript', 'js'], diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts index 8125015..2d5b9d9 100644 --- a/src/commands/dev/reload.ts +++ b/src/commands/dev/reload.ts @@ -1,6 +1,6 @@ -import { BushCommand, clientSendAndPermCheck, emojis, formatError, shell, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, emojis, formatError, shell, type CommandMessage, type SlashMessage } from '#lib'; -export default class ReloadCommand extends BushCommand { +export default class ReloadCommand extends BotCommand { public constructor() { super('reload', { aliases: ['reload'], diff --git a/src/commands/dev/say.ts b/src/commands/dev/say.ts index c7b3c40..22ad9ba 100644 --- a/src/commands/dev/say.ts +++ b/src/commands/dev/say.ts @@ -1,7 +1,7 @@ -import { AllowedMentions, BushCommand, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; +import { AllowedMentions, BotCommand, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; import { ApplicationCommandOptionType } from 'discord.js'; -export default class SayCommand extends BushCommand { +export default class SayCommand extends BotCommand { public constructor() { super('say', { aliases: ['say'], diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts index ab66f1c..6bba93c 100644 --- a/src/commands/dev/servers.ts +++ b/src/commands/dev/servers.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, ButtonPaginator, chunk, clientSendAndPermCheck, @@ -11,7 +11,7 @@ import { import { stripIndent } from '#tags'; import { type APIEmbed, type Guild } from 'discord.js'; -export default class ServersCommand extends BushCommand { +export default class ServersCommand extends BotCommand { public constructor() { super('servers', { aliases: ['servers', 'guilds'], diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index 56a3b69..2d2a404 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -1,4 +1,4 @@ -import { ArgType, BushCommand, colors, emojis, formatError, type CommandMessage, type SlashMessage } from '#lib'; +import { ArgType, BotCommand, colors, emojis, formatError, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert/strict'; import chalk from 'chalk'; import { exec } from 'child_process'; @@ -15,7 +15,7 @@ const clean = (text: string | any) => { } else return text; }; -export default class ShCommand extends BushCommand { +export default class ShCommand extends BotCommand { public constructor() { super('sh', { aliases: ['sh', 'shell', 'cmd'], diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts index 24e8c9a..6a034bc 100644 --- a/src/commands/dev/superUser.ts +++ b/src/commands/dev/superUser.ts @@ -1,7 +1,7 @@ -import { BushCommand, clientSendAndPermCheck, emojis, format, type ArgType, type CommandMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, emojis, format, type ArgType, type CommandMessage } from '#lib'; import { type ArgumentGeneratorReturn, type ArgumentTypeCasterReturn } from 'discord-akairo'; -export default class SuperUserCommand extends BushCommand { +export default class SuperUserCommand extends BotCommand { public constructor() { super('superUser', { aliases: ['super-user', 'su'], diff --git a/src/commands/dev/syncAutomod.ts b/src/commands/dev/syncAutomod.ts index d0fc5e5..7a0fb58 100644 --- a/src/commands/dev/syncAutomod.ts +++ b/src/commands/dev/syncAutomod.ts @@ -1,8 +1,8 @@ -import { BushCommand, clientSendAndPermCheck, emojis, Shared, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, emojis, Shared, type CommandMessage, type SlashMessage } from '#lib'; import typescript from 'typescript'; import { NodeVM } from 'vm2'; -export default class SyncAutomodCommand extends BushCommand { +export default class SyncAutomodCommand extends BotCommand { public constructor() { super('syncAutomod', { aliases: ['sync-automod'], diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index 0606497..cc32657 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, ButtonPaginator, clientSendAndPermCheck, colors, @@ -22,7 +22,7 @@ import badLinksSecretArray from '../../../lib/badlinks-secret.js'; import badLinksArray from '../../../lib/badlinks.js'; import badWords from '../../../lib/badwords.js'; -export default class TestCommand extends BushCommand { +export default class TestCommand extends BotCommand { public constructor() { super('test', { aliases: ['test'], diff --git a/src/commands/fun/coinFlip.ts b/src/commands/fun/coinFlip.ts index 3adf7f2..66b6016 100644 --- a/src/commands/fun/coinFlip.ts +++ b/src/commands/fun/coinFlip.ts @@ -1,6 +1,6 @@ -import { BushCommand, clientSendAndPermCheck, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, type CommandMessage, type SlashMessage } from '#lib'; -export default class CoinFlipCommand extends BushCommand { +export default class CoinFlipCommand extends BotCommand { public constructor() { super('coinFlip', { aliases: ['coin-flip', 'cf'], diff --git a/src/commands/fun/dice.ts b/src/commands/fun/dice.ts index e7e5927..5941564 100644 --- a/src/commands/fun/dice.ts +++ b/src/commands/fun/dice.ts @@ -1,6 +1,6 @@ -import { BushCommand, clientSendAndPermCheck, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, type CommandMessage, type SlashMessage } from '#lib'; -export default class DiceCommand extends BushCommand { +export default class DiceCommand extends BotCommand { public constructor() { super('dice', { aliases: ['dice', 'die'], diff --git a/src/commands/fun/eightBall.ts b/src/commands/fun/eightBall.ts index eb5aee8..be9c7b5 100644 --- a/src/commands/fun/eightBall.ts +++ b/src/commands/fun/eightBall.ts @@ -1,7 +1,7 @@ -import { BushCommand, clientSendAndPermCheck, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, type CommandMessage, type SlashMessage } from '#lib'; import { ApplicationCommandOptionType } from 'discord.js'; -export default class EightBallCommand extends BushCommand { +export default class EightBallCommand extends BotCommand { public constructor() { super('eightBall', { aliases: ['eightball', '8ball'], diff --git a/src/commands/fun/minesweeper.ts b/src/commands/fun/minesweeper.ts index f2db6ee..ec21b11 100644 --- a/src/commands/fun/minesweeper.ts +++ b/src/commands/fun/minesweeper.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, OptArgType, @@ -12,7 +12,7 @@ import assert from 'assert/strict'; import { ApplicationCommandOptionType } from 'discord.js'; assert(Minesweeper); -export default class MinesweeperCommand extends BushCommand { +export default class MinesweeperCommand extends BotCommand { public constructor() { super('minesweeper', { aliases: ['minesweeper'], diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts index 3eae98c..b97364f 100644 --- a/src/commands/info/avatar.ts +++ b/src/commands/info/avatar.ts @@ -1,7 +1,7 @@ -import { Arg, BushCommand, clientSendAndPermCheck, colors, type CommandMessage, type OptArgType, type SlashMessage } from '#lib'; +import { Arg, BotCommand, clientSendAndPermCheck, colors, type CommandMessage, type OptArgType, type SlashMessage } from '#lib'; import { ApplicationCommandOptionType, EmbedBuilder, GuildMember, PermissionFlagsBits } from 'discord.js'; -export default class AvatarCommand extends BushCommand { +export default class AvatarCommand extends BotCommand { public constructor() { super('avatar', { aliases: ['avatar', 'av'], diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index d84fd4e..64ecf1d 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, clientSendAndPermCheck, colors, humanizeDuration, @@ -14,7 +14,7 @@ const { default: prettyBytes } = await import('pretty-bytes'); assert(prettyBytes); assert(os); -export default class BotInfoCommand extends BushCommand { +export default class BotInfoCommand extends BotCommand { public constructor() { super('botInfo', { aliases: ['bot-info', 'stats'], diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts index 7601562..c139e1a 100644 --- a/src/commands/info/color.ts +++ b/src/commands/info/color.ts @@ -1,7 +1,7 @@ import { AllowedMentions, Arg, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, type ArgType, @@ -13,7 +13,7 @@ import { ApplicationCommandOptionType, EmbedBuilder, GuildMember, PermissionFlag import tinycolor from 'tinycolor2'; assert(tinycolor); -export default class ColorCommand extends BushCommand { +export default class ColorCommand extends BotCommand { public constructor() { super('color', { aliases: ['color'], diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index e67cdf4..97e4be3 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -1,7 +1,7 @@ import { akairo, Arg, - BushCommand, + BotCommand, clientSendAndPermCheck, colors, emojis, @@ -31,7 +31,7 @@ import { type Vanity } from 'discord.js'; -export default class GuildInfoCommand extends BushCommand { +export default class GuildInfoCommand extends BotCommand { public constructor() { super('guildInfo', { aliases: ['guild-info', 'serverinfo', 'guild', 'server', 'g'], @@ -222,9 +222,9 @@ export default class GuildInfoCommand extends BushCommand { const guildSecurity: string[] = []; guildSecurity.push( - `**Verification Level:** ${BushGuildVerificationLevel[guild.verificationLevel]}`, - `**Explicit Content Filter:** ${BushGuildExplicitContentFilter[guild.explicitContentFilter]}`, - `**Default Message Notifications:** ${BushGuildDefaultMessageNotifications[guild.defaultMessageNotifications]}`, + `**Verification Level:** ${MappedGuildVerificationLevel[guild.verificationLevel]}`, + `**Explicit Content Filter:** ${MappedGuildExplicitContentFilter[guild.explicitContentFilter]}`, + `**Default Message Notifications:** ${MappedGuildDefaultMessageNotifications[guild.defaultMessageNotifications]}`, `**2FA Required:** ${guild.mfaLevel === GuildMFALevel.Elevated ? 'True' : 'False'}` ); @@ -248,7 +248,7 @@ type RTCRegion = | 'india' | 'automatic'; -enum BushGuildVerificationLevel { +enum MappedGuildVerificationLevel { 'None' = GuildVerificationLevel.None, 'Low' = GuildVerificationLevel.Low, 'Medium' = GuildVerificationLevel.Medium, @@ -256,13 +256,13 @@ enum BushGuildVerificationLevel { 'Very High' = GuildVerificationLevel.VeryHigh } -enum BushGuildExplicitContentFilter { +enum MappedGuildExplicitContentFilter { 'Disabled' = GuildExplicitContentFilter.Disabled, 'Members Without Roles' = GuildExplicitContentFilter.MembersWithoutRoles, 'All Members' = GuildExplicitContentFilter.AllMembers } -enum BushGuildDefaultMessageNotifications { +enum MappedGuildDefaultMessageNotifications { 'All Messages' = GuildDefaultMessageNotifications.AllMessages, 'Only Mentions' = GuildDefaultMessageNotifications.OnlyMentions } diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 70c8f20..6460b99 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, clientSendAndPermCheck, colors, format, @@ -26,7 +26,7 @@ import packageDotJSON from '../../../package.json' assert { type: 'json' }; assert(Fuse); assert(packageDotJSON); -export default class HelpCommand extends BushCommand { +export default class HelpCommand extends BotCommand { public constructor() { super('help', { aliases: ['help'], @@ -109,7 +109,7 @@ export default class HelpCommand extends BushCommand { return message.util.reply({ embeds: [embed], components: row.components.length ? [row] : undefined }); } - private helpIndividual(message: CommandMessage | SlashMessage, row: ActionRowBuilder<ButtonBuilder>, command: BushCommand) { + private helpIndividual(message: CommandMessage | SlashMessage, row: ActionRowBuilder<ButtonBuilder>, command: BotCommand) { const embed = new EmbedBuilder().setColor(colors.default).setTitle(`${command.id} Command`); let description = `${command.description ?? '*This command does not have a description.*'}`; @@ -127,7 +127,7 @@ export default class HelpCommand extends BushCommand { return message.util.reply(params); } - private addCommandUsage(embed: EmbedBuilder, command: BushCommand): void { + private addCommandUsage(embed: EmbedBuilder, command: BotCommand): void { if (command.usage?.length) { embed.addFields({ name: `» Usage${command.usage.length > 1 ? 's' : ''}`, @@ -136,7 +136,7 @@ export default class HelpCommand extends BushCommand { } } - private addCommandExamples(embed: EmbedBuilder, command: BushCommand): void { + private addCommandExamples(embed: EmbedBuilder, command: BotCommand): void { if (command.examples?.length) { embed.addFields({ name: `» Example${command.examples.length > 1 ? 's' : ''}`, @@ -145,7 +145,7 @@ export default class HelpCommand extends BushCommand { } } - private addCommandAliases(embed: EmbedBuilder, command: BushCommand): void { + private addCommandAliases(embed: EmbedBuilder, command: BotCommand): void { if (command.aliases?.length > 1) embed.addFields({ name: '» Aliases', @@ -153,7 +153,7 @@ export default class HelpCommand extends BushCommand { }); } - private addCommandArguments(embed: EmbedBuilder, command: BushCommand, isOwner = false, isSuperUser = false): void { + private addCommandArguments(embed: EmbedBuilder, command: BotCommand, isOwner = false, isSuperUser = false): void { const format = (id: string, req: boolean) => `${req ? '<' : '['}${id}${req ? '>' : ']'}`; const args = (command.argsInfo ?? []).filter((arg) => { if (arg.ownerOnly && !isOwner) return false; @@ -182,7 +182,7 @@ export default class HelpCommand extends BushCommand { } } - private addCommandRestrictions(embed: EmbedBuilder, command: BushCommand): void { + private addCommandRestrictions(embed: EmbedBuilder, command: BotCommand): void { if ( command.ownerOnly || command.superUserOnly || diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts index b3434ec..71f02f9 100644 --- a/src/commands/info/icon.ts +++ b/src/commands/info/icon.ts @@ -1,8 +1,8 @@ -import { BushCommand, clientSendAndPermCheck, colors, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, colors, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert/strict'; import { EmbedBuilder, escapeMarkdown, PermissionFlagsBits } from 'discord.js'; -export default class IconCommand extends BushCommand { +export default class IconCommand extends BotCommand { public constructor() { super('icon', { aliases: ['icon', 'guildavatar', 'severicon', 'guildicon'], diff --git a/src/commands/info/inviteInfo.ts b/src/commands/info/inviteInfo.ts index 5df86ad..590bf16 100644 --- a/src/commands/info/inviteInfo.ts +++ b/src/commands/info/inviteInfo.ts @@ -1,7 +1,7 @@ -import { Arg, ArgType, BushCommand, clientSendAndPermCheck, colors, type CommandMessage, type SlashMessage } from '#lib'; +import { Arg, ArgType, BotCommand, clientSendAndPermCheck, colors, type CommandMessage, type SlashMessage } from '#lib'; import { ApplicationCommandOptionType, EmbedBuilder, Invite, PermissionFlagsBits } from 'discord.js'; -export default class InviteInfoCommand extends BushCommand { +export default class InviteInfoCommand extends BotCommand { public constructor() { super('inviteInfo', { aliases: ['invite-info', 'ii'], diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts index 8003c65..ecc09c8 100644 --- a/src/commands/info/links.ts +++ b/src/commands/info/links.ts @@ -1,11 +1,11 @@ -import { BushCommand, clientSendAndPermCheck, invite, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, invite, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert/strict'; import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; import packageDotJSON from '../../../package.json' assert { type: 'json' }; assert(packageDotJSON); -export default class LinksCommand extends BushCommand { +export default class LinksCommand extends BotCommand { public constructor() { super('links', { aliases: ['links', 'invite', 'inv', 'support', 'github', 'source', 'oss'], diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index 484c010..91bec1d 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -1,7 +1,7 @@ -import { BushCommand, clientSendAndPermCheck, colors, format, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, colors, format, type CommandMessage, type SlashMessage } from '#lib'; import { EmbedBuilder, PermissionFlagsBits, type Message } from 'discord.js'; -export default class PingCommand extends BushCommand { +export default class PingCommand extends BotCommand { public constructor() { super('ping', { aliases: ['ping'], diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts index 0063f4c..47061fc 100644 --- a/src/commands/info/pronouns.ts +++ b/src/commands/info/pronouns.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, type CommandMessage, type OptArgType, @@ -8,7 +8,7 @@ import { } from '#lib'; import { ApplicationCommandOptionType, EmbedBuilder, escapeMarkdown, PermissionFlagsBits } from 'discord.js'; -export default class PronounsCommand extends BushCommand { +export default class PronounsCommand extends BotCommand { public constructor() { super('pronouns', { aliases: ['pronouns', 'pronoun'], diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts index f30330a..deaf41c 100644 --- a/src/commands/info/snowflake.ts +++ b/src/commands/info/snowflake.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, clientSendAndPermCheck, colors, timestamp, @@ -19,7 +19,7 @@ import { type Snowflake } from 'discord.js'; -export default class SnowflakeCommand extends BushCommand { +export default class SnowflakeCommand extends BotCommand { public constructor() { super('snowflake', { aliases: ['snowflake', 'info', 'sf'], @@ -50,7 +50,7 @@ export default class SnowflakeCommand extends BushCommand { // Channel if (this.client.channels.cache.has(snowflake)) { const channel = this.client.channels.resolve(snowflake)!; - const channelInfo = [`**Type:** ${BushChannelType[channel.type] ?? ChannelType[channel.type]}`]; + const channelInfo = [`**Type:** ${MappedChannelType[channel.type] ?? ChannelType[channel.type]}`]; if (channel.type === ChannelType.DM) { channelInfo.push( `**Recipient:** ${escapeMarkdown(channel.recipient?.tag ?? '¯\\_(ツ)_/¯')} (${channel.recipient?.id ?? '¯\\_(ツ)_/¯'})` @@ -136,7 +136,7 @@ export default class SnowflakeCommand extends BushCommand { } } -enum BushChannelType { +enum MappedChannelType { 'Text' = 0, 'DM' = 1, 'Voice' = 2, diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 1f139b5..52875ef 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -1,7 +1,7 @@ import { Arg, + BotCommand, bots, - BushCommand, clientSendAndPermCheck, colors, emojis, @@ -30,7 +30,7 @@ import { type User } from 'discord.js'; -export default class UserInfoCommand extends BushCommand { +export default class UserInfoCommand extends BotCommand { public constructor() { super('userInfo', { aliases: ['user-info', 'user', 'u'], diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts index bb41a12..109f398 100644 --- a/src/commands/leveling/leaderboard.ts +++ b/src/commands/leveling/leaderboard.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, ButtonPaginator, chunk, clientSendAndPermCheck, @@ -12,7 +12,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; -export default class LeaderboardCommand extends BushCommand { +export default class LeaderboardCommand extends BotCommand { public constructor() { super('leaderboard', { aliases: ['leaderboard', 'lb'], diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts index ea2a724..2547b06 100644 --- a/src/commands/leveling/level.ts +++ b/src/commands/leveling/level.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, CanvasProgressBar, clientSendAndPermCheck, emojis, @@ -16,7 +16,7 @@ import { ApplicationCommandOptionType, AttachmentBuilder, Guild, PermissionFlags assert(canvas); assert(SimplifyNumber); -export default class LevelCommand extends BushCommand { +export default class LevelCommand extends BotCommand { public constructor() { super('level', { aliases: ['level', 'rank', 'lvl'], diff --git a/src/commands/leveling/levelRoles.ts b/src/commands/leveling/levelRoles.ts index 312623c..4973b01 100644 --- a/src/commands/leveling/levelRoles.ts +++ b/src/commands/leveling/levelRoles.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, type ArgType, @@ -11,7 +11,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; -export default class LevelRolesCommand extends BushCommand { +export default class LevelRolesCommand extends BotCommand { public constructor() { super('levelRole', { aliases: ['level-role', 'level-roles', 'lr'], diff --git a/src/commands/leveling/setLevel.ts b/src/commands/leveling/setLevel.ts index 8dc1cdf..cd30978 100644 --- a/src/commands/leveling/setLevel.ts +++ b/src/commands/leveling/setLevel.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, format, @@ -12,7 +12,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; -export default class SetLevelCommand extends BushCommand { +export default class SetLevelCommand extends BotCommand { public constructor() { super('setLevel', { aliases: ['set-level'], diff --git a/src/commands/leveling/setXp.ts b/src/commands/leveling/setXp.ts index 5cd3a61..23f4463 100644 --- a/src/commands/leveling/setXp.ts +++ b/src/commands/leveling/setXp.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, format, @@ -12,7 +12,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; -export default class SetXpCommand extends BushCommand { +export default class SetXpCommand extends BotCommand { public constructor() { super('setXp', { aliases: ['set-xp'], diff --git a/src/commands/moderation/_activePunishments.ts b/src/commands/moderation/_activePunishments.ts index 06e33f2..4ded902 100644 --- a/src/commands/moderation/_activePunishments.ts +++ b/src/commands/moderation/_activePunishments.ts @@ -1,6 +1,6 @@ // import { -// BushCommand, // clientSendAndPermCheck, +// CustomCommand, // emojis, // ModLog, // ModLogModel, @@ -14,7 +14,7 @@ // const punishmentTypes = ['ban', 'kick', 'mute', 'warn', 'role'] as const; -// export default class ActivePunishmentsCommand extends BushCommand { +// export default class ActivePunishmentsCommand extends CustomCommand { // public constructor() { // super('activePunishments', { // aliases: ['active-punishments', 'ap'], diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index 00fde01..fdb8033 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -2,7 +2,7 @@ import { AllowedMentions, Arg, banResponse, - BushCommand, + BotCommand, castDurationContent, emojis, format, @@ -16,7 +16,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type User } from 'discord.js'; -export default class BanCommand extends BushCommand { +export default class BanCommand extends BotCommand { public constructor() { super('ban', { aliases: ['ban', 'force-ban', 'dban'], @@ -108,7 +108,7 @@ export default class BanCommand extends BushCommand { const opts = { reason: content, moderator: message.member, duration: duration, deleteDays: args.days }; - const responseCode = member ? await member.bushBan(opts) : await message.guild.bushBan({ user, ...opts }); + const responseCode = member ? await member.customBan(opts) : await message.guild.customBan({ user, ...opts }); return await message.util.reply({ content: BanCommand.formatCode(user, responseCode), diff --git a/src/commands/moderation/block.ts b/src/commands/moderation/block.ts index 00a1996..a3f7bc1 100644 --- a/src/commands/moderation/block.ts +++ b/src/commands/moderation/block.ts @@ -1,7 +1,7 @@ import { AllowedMentions, blockResponse, - BushCommand, + BotCommand, castDurationContent, clientSendAndPermCheck, emojis, @@ -17,7 +17,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; -export default class BlockCommand extends BushCommand { +export default class BlockCommand extends BotCommand { public constructor() { super('block', { aliases: ['block'], @@ -91,7 +91,7 @@ export default class BlockCommand extends BushCommand { return message.util.reply(canModerateResponse); } - const responseCode = await member.bushBlock({ + const responseCode = await member.customBlock({ reason: content, moderator: message.member, duration: duration, diff --git a/src/commands/moderation/evidence.ts b/src/commands/moderation/evidence.ts index d36000f..bc4cdb2 100644 --- a/src/commands/moderation/evidence.ts +++ b/src/commands/moderation/evidence.ts @@ -1,11 +1,12 @@ import { - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, format, ModLog, OptArgType, regex, + TanzaniteEvent, userGuildPermCheck, type ArgType, type CommandMessage, @@ -15,7 +16,7 @@ import assert from 'assert/strict'; import { Argument, ArgumentGeneratorReturn } from 'discord-akairo'; import { ApplicationCommandOptionType, PermissionFlagsBits, type Message } from 'discord.js'; -export default class EvidenceCommand extends BushCommand { +export default class EvidenceCommand extends BotCommand { public constructor() { super('evidence', { aliases: ['evidence'], @@ -122,7 +123,7 @@ export default class EvidenceCommand extends BushCommand { entry.evidence = _evidence.trim(); await entry.save(); - this.client.emit('bushUpdateModlog', message.member!, entry.id, 'evidence', oldEntry, entry.evidence); + this.client.emit(TanzaniteEvent.UpdateModlog, message.member!, entry.id, 'evidence', oldEntry, entry.evidence); return message.util.reply(`${emojis.success} Successfully updated the evidence for case ${format.input(entry.id)}.`); } diff --git a/src/commands/moderation/hideCase.ts b/src/commands/moderation/hideCase.ts index 9bd1d24..ca87ea5 100644 --- a/src/commands/moderation/hideCase.ts +++ b/src/commands/moderation/hideCase.ts @@ -1,9 +1,10 @@ import { - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, format, ModLog, + TanzaniteEvent, userGuildPermCheck, type CommandMessage, type SlashMessage @@ -11,7 +12,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; -export default class HideCaseCommand extends BushCommand { +export default class HideCaseCommand extends BotCommand { public constructor() { super('hideCase', { aliases: ['hide-case', 'hide_case', 'show-case', 'show_case', 'cover-up-mod-abuse', 'cover_up_mod_abuse'], @@ -47,7 +48,7 @@ export default class HideCaseCommand extends BushCommand { entry.hidden = !entry.hidden; await entry.save(); - this.client.emit('bushUpdateModlog', message.member!, entry.id, 'hidden', oldEntry, entry.hidden); + this.client.emit(TanzaniteEvent.UpdateModlog, message.member!, entry.id, 'hidden', oldEntry, entry.hidden); return await message.util.reply(`${emojis.success} CaseID ${format.input(caseID)} is ${action}.`); } diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index 7807166..a5938f8 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, format, @@ -15,7 +15,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; -export default class KickCommand extends BushCommand { +export default class KickCommand extends BotCommand { public constructor() { super('kick', { aliases: ['kick'], @@ -77,7 +77,7 @@ export default class KickCommand extends BushCommand { return message.util.reply(canModerateResponse); } - const responseCode = await member.bushKick({ + const responseCode = await member.customKick({ reason, moderator: message.member }); diff --git a/src/commands/moderation/lockdown.ts b/src/commands/moderation/lockdown.ts index 0561767..57f9caf 100644 --- a/src/commands/moderation/lockdown.ts +++ b/src/commands/moderation/lockdown.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, colors, ConfirmationPrompt, @@ -23,7 +23,7 @@ import { VoiceChannel } from 'discord.js'; -export default class LockdownCommand extends BushCommand { +export default class LockdownCommand extends BotCommand { public constructor() { super('lockdown', { aliases: ['lockdown', 'lock'], diff --git a/src/commands/moderation/massBan.ts b/src/commands/moderation/massBan.ts index db50c44..4ba4f47 100644 --- a/src/commands/moderation/massBan.ts +++ b/src/commands/moderation/massBan.ts @@ -2,12 +2,13 @@ import { Arg, BanResponse, banResponse, - BushCommand, + BotCommand, clientSendAndPermCheck, colors, emojis, overflowEmbed, regex, + TanzaniteEvent, type ArgType, type CommandMessage, type OptArgType, @@ -16,7 +17,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, Collection, PermissionFlagsBits } from 'discord.js'; -export default class MassBanCommand extends BushCommand { +export default class MassBanCommand extends BotCommand { public constructor() { super('massBan', { aliases: ['mass-ban', 'mass-dban'], @@ -96,7 +97,13 @@ export default class MassBanCommand extends BushCommand { const res = await Promise.all(promises); const map = new Collection(res.map((r, i) => [ids[i], r])); - this.client.emit('massBan', message.member!, message.guild!, args.reason ? args.reason.trim() : 'No reason provided.', map); + this.client.emit( + TanzaniteEvent.MassBan, + message.member!, + message.guild!, + args.reason ? args.reason.trim() : 'No reason provided.', + map + ); const success = (res: BanResponse): boolean => [banResponse.SUCCESS, banResponse.DM_ERROR].includes(res as any); diff --git a/src/commands/moderation/massEvidence.ts b/src/commands/moderation/massEvidence.ts index cecf273..b44060e 100644 --- a/src/commands/moderation/massEvidence.ts +++ b/src/commands/moderation/massEvidence.ts @@ -1,11 +1,12 @@ import { - BushCommand, + BotCommand, clientSendAndPermCheck, colors, emojis, ModLog, overflowEmbed, regex, + TanzaniteEvent, type ArgType, type CommandMessage, type OptArgType, @@ -15,7 +16,7 @@ import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; import EvidenceCommand from './evidence.js'; -export default class MassEvidenceCommand extends BushCommand { +export default class MassEvidenceCommand extends BotCommand { public constructor() { super('massEvidence', { aliases: ['mass-evidence'], @@ -93,7 +94,7 @@ export default class MassEvidenceCommand extends BushCommand { return `${emojis.success} ${id} - ${case_.id}`; }); - this.client.emit('massEvidence', message.member!, message.guild, evidence, lines); + this.client.emit(TanzaniteEvent.MassEvidence, message.member!, message.guild, evidence, lines); const embeds = overflowEmbed( { diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index 527ba36..08e5397 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -1,6 +1,6 @@ import { Arg, - BushCommand, + BotCommand, ButtonPaginator, chunk, clientSendAndPermCheck, @@ -17,7 +17,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, escapeMarkdown, PermissionFlagsBits, User } from 'discord.js'; -export default class ModlogCommand extends BushCommand { +export default class ModlogCommand extends BotCommand { public static separator = '\n━━━━━━━━━━━━━━━\n'; public constructor() { diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index 4627f2c..debcf03 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, castDurationContent, clientSendAndPermCheck, emojis, @@ -17,7 +17,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; -export default class MuteCommand extends BushCommand { +export default class MuteCommand extends BotCommand { public constructor() { super('mute', { aliases: ['mute'], @@ -86,7 +86,7 @@ export default class MuteCommand extends BushCommand { return message.util.reply(canModerateResponse); } - const responseCode = await member.bushMute({ + const responseCode = await member.customMute({ reason: content, moderator: message.member, duration diff --git a/src/commands/moderation/myLogs.ts b/src/commands/moderation/myLogs.ts index c1cc448..34ab8e0 100644 --- a/src/commands/moderation/myLogs.ts +++ b/src/commands/moderation/myLogs.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, ButtonPaginator, chunk, clientSendAndPermCheck, @@ -14,7 +14,7 @@ import { import { ApplicationCommandOptionType } from 'discord.js'; import { input, sanitizeInputForDiscord } from '../../../lib/utils/Format.js'; import ModlogCommand from './modlog.js'; -export default class MyLogsCommand extends BushCommand { +export default class MyLogsCommand extends BotCommand { public constructor() { super('myLogs', { aliases: ['my-logs', 'my-log', 'my-modlogs', 'my-modlog'], diff --git a/src/commands/moderation/purge.ts b/src/commands/moderation/purge.ts index 383c439..106f394 100644 --- a/src/commands/moderation/purge.ts +++ b/src/commands/moderation/purge.ts @@ -1,9 +1,10 @@ import { Arg, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, OptArgType, + TanzaniteEvent, type ArgType, type CommandMessage, type SlashMessage @@ -11,7 +12,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, Collection, PermissionFlagsBits, type Message } from 'discord.js'; -export default class PurgeCommand extends BushCommand { +export default class PurgeCommand extends BotCommand { public constructor() { super('purge', { aliases: ['purge', 'clear'], @@ -83,7 +84,7 @@ export default class PurgeCommand extends BushCommand { const purged = await message.channel!.bulkDelete(messages, true).catch(() => null); if (!purged) return message.util.reply(`${emojis.error} Failed to purge messages.`).catch(() => null); else { - this.client.emit('bushPurge', message.author, message.guild, message.channel!, messages); + this.client.emit(TanzaniteEvent.Purge, message.author, message.guild, message.channel!, messages); await message.util.send(`${emojis.success} Successfully purged **${purged.size}** messages.`); /* .then(async (purgeMessage) => { if (!message.util.isSlashMessage(message)) { diff --git a/src/commands/moderation/removeReactionEmoji.ts b/src/commands/moderation/removeReactionEmoji.ts index cc3713c..5baeffc 100644 --- a/src/commands/moderation/removeReactionEmoji.ts +++ b/src/commands/moderation/removeReactionEmoji.ts @@ -1,6 +1,6 @@ import { Arg, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, format, @@ -11,7 +11,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, Message, PermissionFlagsBits } from 'discord.js'; -export default class RemoveReactionEmojiCommand extends BushCommand { +export default class RemoveReactionEmojiCommand extends BotCommand { public constructor() { super('removeReactionEmoji', { aliases: ['remove-reaction-emoji', 'rre'], diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts index 5251be7..6b874da 100644 --- a/src/commands/moderation/role.ts +++ b/src/commands/moderation/role.ts @@ -1,7 +1,7 @@ import { addRoleResponse, AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, format, @@ -17,7 +17,7 @@ import assert from 'assert/strict'; import { type ArgumentGeneratorReturn } from 'discord-akairo'; import { ApplicationCommandOptionType, PermissionFlagsBits, type Snowflake } from 'discord.js'; -export default class RoleCommand extends BushCommand { +export default class RoleCommand extends BotCommand { public constructor() { super('role', { aliases: ['role', 'rr', 'ar', 'ra'], @@ -169,7 +169,7 @@ export default class RoleCommand extends BushCommand { const shouldLog = this.punishmentRoleNames.includes(args.role.name); - const responseCode = await args.member[`bush${args.action === 'add' ? 'Add' : 'Remove'}Role`]({ + const responseCode = await args.member[`custom${args.action === 'add' ? 'Add' : 'Remove'}Role`]({ moderator: message.member!, addToModlog: shouldLog, role: args.role, diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts index 2e603c6..66bc2a0 100644 --- a/src/commands/moderation/slowmode.ts +++ b/src/commands/moderation/slowmode.ts @@ -1,6 +1,6 @@ import { Arg, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, format, @@ -14,7 +14,7 @@ import assert from 'assert/strict'; import { Argument } from 'discord-akairo'; import { ApplicationCommandOptionType, ChannelType, PermissionFlagsBits } from 'discord.js'; -export default class SlowmodeCommand extends BushCommand { +export default class SlowmodeCommand extends BotCommand { public constructor() { super('slowmode', { aliases: ['slowmode', 'slow'], diff --git a/src/commands/moderation/timeout.ts b/src/commands/moderation/timeout.ts index 3e2b10d..5ab62e4 100644 --- a/src/commands/moderation/timeout.ts +++ b/src/commands/moderation/timeout.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, castDurationContent, clientSendAndPermCheck, emojis, @@ -15,7 +15,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; -export default class TimeoutCommand extends BushCommand { +export default class TimeoutCommand extends BotCommand { public constructor() { super('timeout', { aliases: ['timeout', 'to'], @@ -80,7 +80,7 @@ export default class TimeoutCommand extends BushCommand { return message.util.reply(canModerateResponse); } - const responseCode = await member.bushTimeout({ + const responseCode = await member.customTimeout({ reason: content, moderator: message.member, duration: duration diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts index 3a6221a..29dedab 100644 --- a/src/commands/moderation/unban.ts +++ b/src/commands/moderation/unban.ts @@ -1,7 +1,7 @@ import { AllowedMentions, Arg, - BushCommand, + BotCommand, emojis, format, unbanResponse, @@ -14,7 +14,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type User } from 'discord.js'; -export default class UnbanCommand extends BushCommand { +export default class UnbanCommand extends BotCommand { public constructor() { super('unban', { aliases: ['unban'], @@ -55,7 +55,7 @@ export default class UnbanCommand extends BushCommand { ) { assert(message.inGuild()); - const responseCode = await message.guild.bushUnban({ + const responseCode = await message.guild.customUnban({ user, moderator: message.author, reason diff --git a/src/commands/moderation/unblock.ts b/src/commands/moderation/unblock.ts index 6533da0..e342f0f 100644 --- a/src/commands/moderation/unblock.ts +++ b/src/commands/moderation/unblock.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, format, @@ -16,7 +16,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; -export default class UnblockCommand extends BushCommand { +export default class UnblockCommand extends BotCommand { public constructor() { super('unblock', { aliases: ['unblock'], @@ -83,7 +83,7 @@ export default class UnblockCommand extends BushCommand { return message.util.reply(canModerateResponse); } - const responseCode = await member.bushUnblock({ + const responseCode = await member.customUnblock({ reason: args.reason ?? '', moderator: message.member, channel: message.channel diff --git a/src/commands/moderation/unlockdown.ts b/src/commands/moderation/unlockdown.ts index 873ea87..38d2fe6 100644 --- a/src/commands/moderation/unlockdown.ts +++ b/src/commands/moderation/unlockdown.ts @@ -1,8 +1,8 @@ import { LockdownCommand } from '#commands'; -import { BushCommand, clientSendAndPermCheck, type ArgType, type CommandMessage, type OptArgType, type SlashMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, type ArgType, type CommandMessage, type OptArgType, type SlashMessage } from '#lib'; import { ApplicationCommandOptionType, Constants, PermissionFlagsBits } from 'discord.js'; -export default class UnlockdownCommand extends BushCommand { +export default class UnlockdownCommand extends BotCommand { public constructor() { super('unlockdown', { aliases: ['unlockdown', 'unlock', 'lockup'], diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts index f1e74ab..4f408eb 100644 --- a/src/commands/moderation/unmute.ts +++ b/src/commands/moderation/unmute.ts @@ -11,9 +11,9 @@ import { } from '#lib'; import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; -import { BushCommand } from '../../../lib/extensions/discord-akairo/BushCommand.js'; +import { BotCommand } from '../../../lib/extensions/discord-akairo/BotCommand.js'; -export default class UnmuteCommand extends BushCommand { +export default class UnmuteCommand extends BotCommand { public constructor() { super('unmute', { aliases: ['unmute'], @@ -74,7 +74,7 @@ export default class UnmuteCommand extends BushCommand { return message.util.reply(canModerateResponse); } - const responseCode = await member.bushUnmute({ + const responseCode = await member.customUnmute({ reason, moderator: message.member }); diff --git a/src/commands/moderation/untimeout.ts b/src/commands/moderation/untimeout.ts index 6ca28f4..8bc977b 100644 --- a/src/commands/moderation/untimeout.ts +++ b/src/commands/moderation/untimeout.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, format, @@ -15,7 +15,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; -export default class UntimeoutCommand extends BushCommand { +export default class UntimeoutCommand extends BotCommand { public constructor() { super('untimeout', { aliases: ['untimeout', 'remove-timeout'], @@ -80,7 +80,7 @@ export default class UntimeoutCommand extends BushCommand { return message.util.reply(canModerateResponse); } - const responseCode = await member.bushRemoveTimeout({ + const responseCode = await member.customRemoveTimeout({ reason: args.reason ?? undefined, moderator: message.member }); diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts index e1d1e90..9547583 100644 --- a/src/commands/moderation/warn.ts +++ b/src/commands/moderation/warn.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, format, @@ -17,7 +17,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; -export default class WarnCommand extends BushCommand { +export default class WarnCommand extends BotCommand { public constructor() { super('warn', { aliases: ['warn'], @@ -77,7 +77,7 @@ export default class WarnCommand extends BushCommand { return message.util.reply(canModerateResponse); } - const { result: responseCode, caseNum } = await member.bushWarn({ + const { result: responseCode, caseNum } = await member.customWarn({ reason, moderator: message.member }); diff --git a/src/commands/moulberry-bush/capePermissions.ts b/src/commands/moulberry-bush/capePermissions.ts index 793ac59..fdeddd8 100644 --- a/src/commands/moulberry-bush/capePermissions.ts +++ b/src/commands/moulberry-bush/capePermissions.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, colors, emojis, @@ -12,7 +12,7 @@ import { } from '#lib'; import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; -export default class CapePermissionsCommand extends BushCommand { +export default class CapePermissionsCommand extends BotCommand { public constructor() { super('capePermissions', { aliases: ['cape-permissions', 'cape-perms', 'cape-perm'], diff --git a/src/commands/moulberry-bush/capes.ts b/src/commands/moulberry-bush/capes.ts index 6ffc540..79c163f 100644 --- a/src/commands/moulberry-bush/capes.ts +++ b/src/commands/moulberry-bush/capes.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, ButtonPaginator, clientSendAndPermCheck, colors, @@ -18,7 +18,7 @@ import { default as Fuse } from 'fuse.js'; assert(Fuse); -export default class CapesCommand extends BushCommand { +export default class CapesCommand extends BotCommand { public constructor() { super('capes', { aliases: ['capes', 'cape'], diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts index 8f8941f..aebcc52 100644 --- a/src/commands/moulberry-bush/giveawayPing.ts +++ b/src/commands/moulberry-bush/giveawayPing.ts @@ -1,8 +1,8 @@ -import { AllowedMentions, BushCommand, clientSendAndPermCheck, emojis, mappings, type CommandMessage } from '#lib'; +import { AllowedMentions, BotCommand, clientSendAndPermCheck, emojis, mappings, type CommandMessage } from '#lib'; import assert from 'assert/strict'; import { PermissionFlagsBits } from 'discord.js'; -export default class GiveawayPingCommand extends BushCommand { +export default class GiveawayPingCommand extends BotCommand { public constructor() { super('giveawayPing', { aliases: ['giveaway-ping', 'giveaway-pong'], diff --git a/src/commands/moulberry-bush/moulHammer.ts b/src/commands/moulberry-bush/moulHammer.ts index 7bb514e..0407428 100644 --- a/src/commands/moulberry-bush/moulHammer.ts +++ b/src/commands/moulberry-bush/moulHammer.ts @@ -1,16 +1,8 @@ -import { - BushCommand, - clientSendAndPermCheck, - colors, - mappings, - type ArgType, - type CommandMessage, - type SlashMessage -} from '#lib'; +import { BotCommand, clientSendAndPermCheck, colors, mappings, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert/strict'; import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; -export default class MoulHammerCommand extends BushCommand { +export default class MoulHammerCommand extends BotCommand { public constructor() { super('moulHammer', { aliases: ['moul-hammer'], diff --git a/src/commands/moulberry-bush/neuRepo.ts b/src/commands/moulberry-bush/neuRepo.ts index 4baae7d..d8eb7ed 100644 --- a/src/commands/moulberry-bush/neuRepo.ts +++ b/src/commands/moulberry-bush/neuRepo.ts @@ -1,4 +1,4 @@ -import { BushCommand, clientSendAndPermCheck, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; import canvas from '@napi-rs/canvas'; import { ApplicationCommandOptionType, @@ -11,7 +11,7 @@ import { join } from 'path'; import tinycolor from 'tinycolor2'; import { formattingInfo, RawNeuItem } from '../../../lib/utils/Minecraft.js'; -export default class NeuRepoCommand extends BushCommand { +export default class NeuRepoCommand extends BotCommand { public static items: { name: string; id: string }[] = []; public constructor() { diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index d0c4f33..8eb412c 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, colors, emojis, @@ -13,7 +13,7 @@ import { stripIndent } from '#tags'; import assert from 'assert/strict'; import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; -export default class ReportCommand extends BushCommand { +export default class ReportCommand extends BotCommand { public constructor() { super('report', { aliases: ['report'], diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index ab5500d..5f2155f 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -1,7 +1,7 @@ import { AllowedMentions, Arg, - BushCommand, + BotCommand, clientSendAndPermCheck, mappings, type CommandMessage, @@ -67,7 +67,7 @@ const rules = [ } ]; -export default class RuleCommand extends BushCommand { +export default class RuleCommand extends BotCommand { public constructor() { super('rule', { aliases: ['rule', 'rules'], diff --git a/src/commands/moulberry-bush/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts index cde3f04..709de26 100644 --- a/src/commands/moulberry-bush/serverStatus.ts +++ b/src/commands/moulberry-bush/serverStatus.ts @@ -1,7 +1,7 @@ -import { BushCommand, clientSendAndPermCheck, colors, emojis, type CommandMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, colors, emojis, type CommandMessage } from '#lib'; import { EmbedBuilder, PermissionFlagsBits } from 'discord.js'; -export default class ServerStatusCommand extends BushCommand { +export default class ServerStatusCommand extends BotCommand { public constructor() { super('serverStatus', { aliases: ['server-status', 'ss'], diff --git a/src/commands/moulberry-bush/solved.ts b/src/commands/moulberry-bush/solved.ts index ac7684a..197a3ce 100644 --- a/src/commands/moulberry-bush/solved.ts +++ b/src/commands/moulberry-bush/solved.ts @@ -1,7 +1,7 @@ -import { BushCommand, clientSendAndPermCheck, emojis, mappings, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, emojis, mappings, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert/strict'; -export default class Solved extends BushCommand { +export default class Solved extends BotCommand { public constructor() { super('solved', { aliases: ['solved'], diff --git a/src/commands/tickets/ticket-!.ts b/src/commands/tickets/ticket-!.ts index 6ec4093..d1462fb 100644 --- a/src/commands/tickets/ticket-!.ts +++ b/src/commands/tickets/ticket-!.ts @@ -1,4 +1,4 @@ -import { BushCommand, clientSendAndPermCheck, deepWriteable, type SlashMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, deepWriteable, type SlashMessage } from '#lib'; import { Flag, type ArgumentGeneratorReturn, type SlashOption } from 'discord-akairo'; import { ApplicationCommandOptionType } from 'discord.js'; @@ -18,7 +18,7 @@ export const ticketSubcommands = deepWriteable({ } } as const); -export default class TicketCommand extends BushCommand { +export default class TicketCommand extends BotCommand { public constructor() { super('ticket', { aliases: ['ticket'], diff --git a/src/commands/utilities/_poll.ts b/src/commands/utilities/_poll.ts index 1ceb13a..4655f36 100644 --- a/src/commands/utilities/_poll.ts +++ b/src/commands/utilities/_poll.ts @@ -1,7 +1,7 @@ -// import { BushCommand, clientSendAndPermCheck, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; +// import { clientSendAndPermCheck, CustomCommand, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; // import { ApplicationCommandOptionType, ComponentType } from 'discord.js'; -// export default class PollCommand extends BushCommand { +// export default class PollCommand extends CustomCommand { // public constructor() { // super('poll', { // aliases: ['poll', 'quick-poll'], diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts index e5c2cdd..414e6a2 100644 --- a/src/commands/utilities/activity.ts +++ b/src/commands/utilities/activity.ts @@ -1,10 +1,10 @@ import { - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, regex, type ArgType, - type BushArgumentTypeCaster, + type BotArgumentTypeCaster, type CommandMessage, type SlashMessage } from '#lib'; @@ -75,14 +75,14 @@ function map(phase: string): Activity | null { return null; } -const activityTypeCaster: BushArgumentTypeCaster<Snowflake | null> = (message: CommandMessage, phrase: string) => { +const activityTypeCaster: BotArgumentTypeCaster<Snowflake | null> = (message: CommandMessage, phrase: string) => { const parsedPhrase = phrase ?? message.util.parsed?.alias !== 'activity' ? message.util.parsed?.alias : undefined; if (!parsedPhrase) return null; const mappedPhrase = map(parsedPhrase)?.id; return mappedPhrase ?? null; }; -export default class ActivityCommand extends BushCommand { +export default class ActivityCommand extends BotCommand { public constructor() { super('activity', { aliases: ['activity', ...Object.values(activityMap).flatMap((a) => a.aliases)], diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts index dc5593b..c9d300c 100644 --- a/src/commands/utilities/calculator.ts +++ b/src/commands/utilities/calculator.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, colors, emojis, @@ -13,7 +13,7 @@ import { evaluate } from 'mathjs'; assert(evaluate); -export default class CalculatorCommand extends BushCommand { +export default class CalculatorCommand extends BotCommand { public constructor() { super('calculator', { aliases: ['calculator', 'calc', 'math'], diff --git a/src/commands/utilities/decode.ts b/src/commands/utilities/decode.ts index 065e9e5..12a016b 100644 --- a/src/commands/utilities/decode.ts +++ b/src/commands/utilities/decode.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, capitalize, clientSendAndPermCheck, colors, @@ -13,7 +13,7 @@ import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js'; const encodingTypesArray = ['ascii', 'utf8', 'utf-8', 'utf16le', 'ucs2', 'ucs-2', 'base64', 'latin1', 'binary', 'hex']; const encodingTypesString = encodingTypesArray.map((e) => `\`${e}\``).join(', '); -export default class DecodeCommand extends BushCommand { +export default class DecodeCommand extends BotCommand { public constructor() { super('decode', { aliases: ['decode', 'encode'], diff --git a/src/commands/utilities/hash.ts b/src/commands/utilities/hash.ts index 251d5e6..1c741bd 100644 --- a/src/commands/utilities/hash.ts +++ b/src/commands/utilities/hash.ts @@ -1,4 +1,4 @@ -// import { BushCommand, clientSendAndPermCheck, type CommandMessage } from '#lib'; +// import { clientSendAndPermCheck, CustomCommand, type CommandMessage } from '#lib'; // import assert from 'assert/strict'; // import crypto from 'crypto'; // import { ApplicationCommandOptionType } from 'discord.js'; @@ -7,7 +7,7 @@ // assert(crypto); // assert(got); -// export default class HashCommand extends BushCommand { +// export default class HashCommand extends CustomCommand { // public constructor() { // super('hash', { // aliases: ['hash'], diff --git a/src/commands/utilities/highlight-!.ts b/src/commands/utilities/highlight-!.ts index f2ee259..4995e97 100644 --- a/src/commands/utilities/highlight-!.ts +++ b/src/commands/utilities/highlight-!.ts @@ -1,4 +1,4 @@ -import { BushCommand, clientSendAndPermCheck, deepWriteable, Highlight, HighlightWord, type SlashMessage } from '#lib'; +import { BotCommand, clientSendAndPermCheck, deepWriteable, Highlight, HighlightWord, type SlashMessage } from '#lib'; import { Flag, type ArgumentGeneratorReturn, type SlashOption } from 'discord-akairo'; import { ApplicationCommandOptionType, Constants, type AutocompleteInteraction, type CacheType } from 'discord.js'; @@ -133,7 +133,7 @@ export const highlightSubcommands = deepWriteable({ } } as const); -export default class HighlightCommand extends BushCommand { +export default class HighlightCommand extends BotCommand { public constructor() { super('highlight', { aliases: ['highlight', 'hl'], diff --git a/src/commands/utilities/highlight-add.ts b/src/commands/utilities/highlight-add.ts index e7d3ec6..101b26e 100644 --- a/src/commands/utilities/highlight-add.ts +++ b/src/commands/utilities/highlight-add.ts @@ -1,8 +1,8 @@ -import { AllowedMentions, BushCommand, emojis, format, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; +import { AllowedMentions, BotCommand, emojis, format, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert/strict'; import { highlightSubcommands } from './highlight-!.js'; -export default class HighlightAddCommand extends BushCommand { +export default class HighlightAddCommand extends BotCommand { public constructor() { super('highlight-add', { aliases: [], diff --git a/src/commands/utilities/highlight-block.ts b/src/commands/utilities/highlight-block.ts index 58e7766..b16852e 100644 --- a/src/commands/utilities/highlight-block.ts +++ b/src/commands/utilities/highlight-block.ts @@ -1,11 +1,11 @@ -import { AllowedMentions, BushCommand, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; +import { AllowedMentions, BotCommand, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert/strict'; import { Argument, ArgumentGeneratorReturn } from 'discord-akairo'; import { BaseChannel, GuildMember, User } from 'discord.js'; import { HighlightBlockResult } from '../../../lib/common/HighlightManager.js'; import { highlightSubcommands } from './highlight-!.js'; -export default class HighlightBlockCommand extends BushCommand { +export default class HighlightBlockCommand extends BotCommand { public constructor() { super('highlight-block', { aliases: [], diff --git a/src/commands/utilities/highlight-clear.ts b/src/commands/utilities/highlight-clear.ts index 5451e4e..d02cda6 100644 --- a/src/commands/utilities/highlight-clear.ts +++ b/src/commands/utilities/highlight-clear.ts @@ -1,8 +1,8 @@ -import { BushCommand, ConfirmationPrompt, emojis, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, ConfirmationPrompt, emojis, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert/strict'; import { highlightSubcommands } from './highlight-!.js'; -export default class HighlightClearCommand extends BushCommand { +export default class HighlightClearCommand extends BotCommand { public constructor() { super('highlight-clear', { aliases: [], diff --git a/src/commands/utilities/highlight-matches.ts b/src/commands/utilities/highlight-matches.ts index 863445e..d54fd4a 100644 --- a/src/commands/utilities/highlight-matches.ts +++ b/src/commands/utilities/highlight-matches.ts @@ -1,10 +1,10 @@ -import { BushCommand, ButtonPaginator, chunk, colors, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; +import { BotCommand, ButtonPaginator, chunk, colors, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert/strict'; import { type ArgumentGeneratorReturn } from 'discord-akairo'; import { type APIEmbed } from 'discord.js'; import { highlightSubcommands } from './highlight-!.js'; -export default class HighlightMatchesCommand extends BushCommand { +export default class HighlightMatchesCommand extends BotCommand { public constructor() { super('highlight-matches', { aliases: [], diff --git a/src/commands/utilities/highlight-remove.ts b/src/commands/utilities/highlight-remove.ts index fd2fa90..b91bc8c 100644 --- a/src/commands/utilities/highlight-remove.ts +++ b/src/commands/utilities/highlight-remove.ts @@ -1,8 +1,8 @@ -import { AllowedMentions, BushCommand, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; +import { AllowedMentions, BotCommand, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert/strict'; import { highlightSubcommands } from './highlight-!.js'; -export default class HighlightRemoveCommand extends BushCommand { +export default class HighlightRemoveCommand extends BotCommand { public constructor() { super('highlight-remove', { aliases: [], diff --git a/src/commands/utilities/highlight-show.ts b/src/commands/utilities/highlight-show.ts index 2ed5ed1..6d386e9 100644 --- a/src/commands/utilities/highlight-show.ts +++ b/src/commands/utilities/highlight-show.ts @@ -1,9 +1,9 @@ -import { AllowedMentions, BushCommand, colors, emojis, Highlight, type CommandMessage, type SlashMessage } from '#lib'; +import { AllowedMentions, BotCommand, colors, emojis, Highlight, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert/strict'; import { EmbedBuilder } from 'discord.js'; import { highlightSubcommands } from './highlight-!.js'; -export default class HighlightShowCommand extends BushCommand { +export default class HighlightShowCommand extends BotCommand { public constructor() { super('highlight-show', { aliases: [], diff --git a/src/commands/utilities/highlight-unblock.ts b/src/commands/utilities/highlight-unblock.ts index 2238831..0f2dd78 100644 --- a/src/commands/utilities/highlight-unblock.ts +++ b/src/commands/utilities/highlight-unblock.ts @@ -1,11 +1,11 @@ -import { AllowedMentions, BushCommand, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; +import { AllowedMentions, BotCommand, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; import assert from 'assert'; import { Argument, ArgumentGeneratorReturn } from 'discord-akairo'; import { BaseChannel, GuildMember, User } from 'discord.js'; import { HighlightUnblockResult } from '../../../lib/common/HighlightManager.js'; import { highlightSubcommands } from './highlight-!.js'; -export default class HighlightUnblockCommand extends BushCommand { +export default class HighlightUnblockCommand extends BotCommand { public constructor() { super('highlight-unblock', { aliases: [], diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index bfe1f10..a1645dc 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -1,11 +1,11 @@ -import { ArgType, BushCommand, clientSendAndPermCheck, colors, emojis, format, oxford, type CommandMessage } from '#lib'; +import { ArgType, BotCommand, clientSendAndPermCheck, colors, emojis, format, oxford, type CommandMessage } from '#lib'; import assert from 'assert/strict'; import { ApplicationCommandOptionType, AutocompleteInteraction, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; import { default as Fuse } from 'fuse.js'; assert(Fuse); -export default class PriceCommand extends BushCommand { +export default class PriceCommand extends BotCommand { public static cachedItemList: string[] = []; public static readonly urls = [ { url: 'https://api.hypixel.net/skyblock/bazaar', error: 'bazaar' }, diff --git a/src/commands/utilities/remind.ts b/src/commands/utilities/remind.ts index 3a1cd18..498a63d 100644 --- a/src/commands/utilities/remind.ts +++ b/src/commands/utilities/remind.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, castDurationContent, clientSendAndPermCheck, dateDelta, @@ -14,7 +14,7 @@ import { } from '#lib'; import { ApplicationCommandOptionType } from 'discord.js'; -export default class RemindCommand extends BushCommand { +export default class RemindCommand extends BotCommand { public constructor() { super('remind', { aliases: ['remind', 'remindme', 'reminder'], diff --git a/src/commands/utilities/reminders.ts b/src/commands/utilities/reminders.ts index fdce981..f98166f 100644 --- a/src/commands/utilities/reminders.ts +++ b/src/commands/utilities/reminders.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, ButtonPaginator, chunk, clientSendAndPermCheck, @@ -16,7 +16,7 @@ import { Op } from 'sequelize'; assert(Op); -export default class RemindersCommand extends BushCommand { +export default class RemindersCommand extends BotCommand { public constructor() { super('reminders', { aliases: ['reminders', 'view-reminders', 'list-reminders'], diff --git a/src/commands/utilities/steal.ts b/src/commands/utilities/steal.ts index b07338f..7f70830 100644 --- a/src/commands/utilities/steal.ts +++ b/src/commands/utilities/steal.ts @@ -1,6 +1,6 @@ import { Arg, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, format, @@ -28,7 +28,7 @@ const enum lang { nameDescription = 'The name to give the new emoji.' } -export default class StealCommand extends BushCommand { +export default class StealCommand extends BotCommand { public constructor() { super('steal', { aliases: ['steal', 'copy-emoji', 'emoji'], diff --git a/src/commands/utilities/suicide.ts b/src/commands/utilities/suicide.ts index f4c76be..bc76d9c 100644 --- a/src/commands/utilities/suicide.ts +++ b/src/commands/utilities/suicide.ts @@ -1,8 +1,8 @@ -import { AllowedMentions, BushCommand, clientSendAndPermCheck, colors, type CommandMessage, type SlashMessage } from '#lib'; +import { AllowedMentions, BotCommand, clientSendAndPermCheck, colors, type CommandMessage, type SlashMessage } from '#lib'; import { stripIndent } from '#tags'; import { EmbedBuilder } from 'discord.js'; -export default class SuicideCommand extends BushCommand { +export default class SuicideCommand extends BotCommand { public constructor() { super('suicide', { aliases: ['suicide'], diff --git a/src/commands/utilities/uuid.ts b/src/commands/utilities/uuid.ts index 04d4013..041acfc 100644 --- a/src/commands/utilities/uuid.ts +++ b/src/commands/utilities/uuid.ts @@ -1,7 +1,7 @@ import { AllowedMentions, ArgType, - BushCommand, + BotCommand, clientSendAndPermCheck, emojis, format, @@ -11,7 +11,7 @@ import { } from '#lib'; import { ApplicationCommandOptionType } from 'discord.js'; -export default class UuidCommand extends BushCommand { +export default class UuidCommand extends BotCommand { public constructor() { super('uuid', { aliases: ['uuid'], diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts index a7d8b25..63125c3 100644 --- a/src/commands/utilities/viewRaw.ts +++ b/src/commands/utilities/viewRaw.ts @@ -1,6 +1,6 @@ import { Arg, - BushCommand, + BotCommand, clientSendAndPermCheck, colors, emojis, @@ -13,7 +13,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, Constants, EmbedBuilder, Message, PermissionFlagsBits } from 'discord.js'; -export default class ViewRawCommand extends BushCommand { +export default class ViewRawCommand extends BotCommand { public constructor() { super('view-raw', { aliases: ['view-raw', 'vr'], diff --git a/src/commands/utilities/whoHasRole.ts b/src/commands/utilities/whoHasRole.ts index 789701c..23eccd6 100644 --- a/src/commands/utilities/whoHasRole.ts +++ b/src/commands/utilities/whoHasRole.ts @@ -1,5 +1,5 @@ import { - BushCommand, + BotCommand, ButtonPaginator, chunk, clientSendAndPermCheck, @@ -13,7 +13,7 @@ import { import assert from 'assert/strict'; import { ApplicationCommandOptionType, escapeMarkdown, type CommandInteraction, type Role } from 'discord.js'; -export default class WhoHasRoleCommand extends BushCommand { +export default class WhoHasRoleCommand extends BotCommand { public constructor() { super('whoHasRole', { aliases: ['who-has-role', 'whr', 'dump'], diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts index 5ba55f7..863b16a 100644 --- a/src/commands/utilities/wolframAlpha.ts +++ b/src/commands/utilities/wolframAlpha.ts @@ -1,6 +1,6 @@ import { AllowedMentions, - BushCommand, + BotCommand, clientSendAndPermCheck, colors, emojis, @@ -14,7 +14,7 @@ import { ApplicationCommandOptionType, EmbedBuilder, type MessageOptions } from assert(WolframAlphaAPI); -export default class WolframAlphaCommand extends BushCommand { +export default class WolframAlphaCommand extends BotCommand { public constructor() { super('wolframAlpha', { aliases: ['wolfram-alpha', 'wolfram', 'alpha', 'wolf', 'wa'], diff --git a/src/inhibitors/blacklist/channelGlobalBlacklist.ts b/src/inhibitors/blacklist/channelGlobalBlacklist.ts index 7f23604..988931b 100644 --- a/src/inhibitors/blacklist/channelGlobalBlacklist.ts +++ b/src/inhibitors/blacklist/channelGlobalBlacklist.ts @@ -1,16 +1,15 @@ -import { BushInhibitor, type BushCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; -export default class UserGlobalBlacklistInhibitor extends BushInhibitor { +export default class UserGlobalBlacklistInhibitor extends BotInhibitor { public constructor() { super('channelGlobalBlacklist', { reason: 'channelGlobalBlacklist', - category: 'blacklist', type: 'post', priority: 500 }); } - public exec(message: CommandMessage | SlashMessage, command: BushCommand): boolean { + public exec(message: CommandMessage | SlashMessage, command: BotCommand): boolean { if (!message.author || !message.inGuild()) return false; // do not change to message.author.isOwner() if (this.client.isOwner(message.author) || this.client.user!.id === message.author.id) return false; diff --git a/src/inhibitors/blacklist/channelGuildBlacklist.ts b/src/inhibitors/blacklist/channelGuildBlacklist.ts index ae087bd..4bf42d2 100644 --- a/src/inhibitors/blacklist/channelGuildBlacklist.ts +++ b/src/inhibitors/blacklist/channelGuildBlacklist.ts @@ -1,16 +1,15 @@ -import { BushInhibitor, type BushCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; -export default class ChannelGuildBlacklistInhibitor extends BushInhibitor { +export default class ChannelGuildBlacklistInhibitor extends BotInhibitor { public constructor() { super('channelGuildBlacklist', { reason: 'channelGuildBlacklist', - category: 'blacklist', type: 'post', priority: 499 }); } - public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { + public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise<boolean> { if (!message.author || !message.inGuild()) return false; // do not change to message.author.isOwner() if (this.client.isOwner(message.author) || this.client.user!.id === message.author.id) return false; diff --git a/src/inhibitors/blacklist/guildBlacklist.ts b/src/inhibitors/blacklist/guildBlacklist.ts index b7df41a..636d0a3 100644 --- a/src/inhibitors/blacklist/guildBlacklist.ts +++ b/src/inhibitors/blacklist/guildBlacklist.ts @@ -1,10 +1,9 @@ -import { BushInhibitor, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, type CommandMessage, type SlashMessage } from '#lib'; -export default class GuildBlacklistInhibitor extends BushInhibitor { +export default class GuildBlacklistInhibitor extends BotInhibitor { public constructor() { super('guildBlacklist', { reason: 'guildBlacklist', - category: 'blacklist', type: 'all', priority: 50 }); diff --git a/src/inhibitors/blacklist/userGlobalBlacklist.ts b/src/inhibitors/blacklist/userGlobalBlacklist.ts index e8a1306..f5b15df 100644 --- a/src/inhibitors/blacklist/userGlobalBlacklist.ts +++ b/src/inhibitors/blacklist/userGlobalBlacklist.ts @@ -1,10 +1,9 @@ -import { BushInhibitor, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, type CommandMessage, type SlashMessage } from '#lib'; -export default class UserGlobalBlacklistInhibitor extends BushInhibitor { +export default class UserGlobalBlacklistInhibitor extends BotInhibitor { public constructor() { super('userGlobalBlacklist', { reason: 'userGlobalBlacklist', - category: 'blacklist', type: 'pre', priority: 30 }); diff --git a/src/inhibitors/blacklist/userGuildBlacklist.ts b/src/inhibitors/blacklist/userGuildBlacklist.ts index a661606..3186d59 100644 --- a/src/inhibitors/blacklist/userGuildBlacklist.ts +++ b/src/inhibitors/blacklist/userGuildBlacklist.ts @@ -1,10 +1,9 @@ -import { BushInhibitor, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, type CommandMessage, type SlashMessage } from '#lib'; -export default class UserGuildBlacklistInhibitor extends BushInhibitor { +export default class UserGuildBlacklistInhibitor extends BotInhibitor { public constructor() { super('userGuildBlacklist', { reason: 'userGuildBlacklist', - category: 'blacklist', type: 'pre', priority: 20 }); diff --git a/src/inhibitors/checks/fatal.ts b/src/inhibitors/checks/fatal.ts index 9fda504..4364d48 100644 --- a/src/inhibitors/checks/fatal.ts +++ b/src/inhibitors/checks/fatal.ts @@ -1,12 +1,11 @@ -import { BushInhibitor, type SlashMessage } from '#lib'; +import { BotInhibitor, type SlashMessage } from '#lib'; import { type Message } from 'discord.js'; -export default class FatalInhibitor extends BushInhibitor { +export default class FatalInhibitor extends BotInhibitor { public constructor() { super('fatal', { reason: 'fatal', type: 'all', - category: 'checks', priority: 100 }); } diff --git a/src/inhibitors/checks/guildUnavailable.ts b/src/inhibitors/checks/guildUnavailable.ts index f5b62f4..4439d69 100644 --- a/src/inhibitors/checks/guildUnavailable.ts +++ b/src/inhibitors/checks/guildUnavailable.ts @@ -1,12 +1,11 @@ -import { BushInhibitor, type SlashMessage } from '#lib'; +import { BotInhibitor, type SlashMessage } from '#lib'; import { type Message } from 'discord.js'; -export default class GuildUnavailableInhibitor extends BushInhibitor { +export default class GuildUnavailableInhibitor extends BotInhibitor { public constructor() { super('guildUnavailable', { reason: 'guildUnavailable', type: 'all', - category: 'checks', priority: 70 }); } diff --git a/src/inhibitors/command/dm.ts b/src/inhibitors/command/dm.ts index 5516c81..f25f542 100644 --- a/src/inhibitors/command/dm.ts +++ b/src/inhibitors/command/dm.ts @@ -1,16 +1,15 @@ -import { BushInhibitor, type BushCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; -export default class DMInhibitor extends BushInhibitor { +export default class DMInhibitor extends BotInhibitor { public constructor() { super('dm', { reason: 'dm', - category: 'command', type: 'post', priority: 75 }); } - public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { + public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise<boolean> { if (command.channel === 'dm' && message.guild) { void this.client.console.verbose( 'dm', diff --git a/src/inhibitors/command/globalDisabledCommand.ts b/src/inhibitors/command/globalDisabledCommand.ts index f013183..4a93f2f 100644 --- a/src/inhibitors/command/globalDisabledCommand.ts +++ b/src/inhibitors/command/globalDisabledCommand.ts @@ -1,16 +1,15 @@ -import { BushInhibitor, type BushCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; -export default class DisabledGuildCommandInhibitor extends BushInhibitor { +export default class DisabledGuildCommandInhibitor extends BotInhibitor { public constructor() { super('disabledGlobalCommand', { reason: 'disabledGlobal', - category: 'command', type: 'post', priority: 300 }); } - public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { + public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise<boolean> { if (message.author.isOwner()) return false; if (this.client.cache.global.disabledCommands.includes(command?.id)) { void this.client.console.verbose( diff --git a/src/inhibitors/command/guild.ts b/src/inhibitors/command/guild.ts index ea52d99..1d70c7d 100644 --- a/src/inhibitors/command/guild.ts +++ b/src/inhibitors/command/guild.ts @@ -1,16 +1,15 @@ -import { BushInhibitor, type BushCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; -export default class GuildInhibitor extends BushInhibitor { +export default class GuildInhibitor extends BotInhibitor { public constructor() { super('guild', { reason: 'guild', - category: 'command', type: 'post', priority: 80 }); } - public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { + public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise<boolean> { if (command.channel === 'guild' && !message.guild) { void this.client.console.verbose( 'guild', diff --git a/src/inhibitors/command/guildDisabledCommand.ts b/src/inhibitors/command/guildDisabledCommand.ts index 7fef78a..97ac995 100644 --- a/src/inhibitors/command/guildDisabledCommand.ts +++ b/src/inhibitors/command/guildDisabledCommand.ts @@ -1,16 +1,15 @@ -import { BushInhibitor, type BushCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; -export default class DisabledGuildCommandInhibitor extends BushInhibitor { +export default class DisabledGuildCommandInhibitor extends BotInhibitor { public constructor() { super('disabledGuildCommand', { reason: 'disabledGuild', - category: 'command', type: 'post', priority: 250 }); } - public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { + public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise<boolean> { if (!message.guild || !message.guild) return false; if (message.author.isOwner() || message.author.isSuperUser()) return false; // super users bypass guild disabled commands diff --git a/src/inhibitors/command/nsfw.ts b/src/inhibitors/command/nsfw.ts index ed55b00..623115e 100644 --- a/src/inhibitors/command/nsfw.ts +++ b/src/inhibitors/command/nsfw.ts @@ -1,17 +1,16 @@ -import { BushInhibitor, type BushCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; import { type TextChannel } from 'discord.js'; -export default class NsfwInhibitor extends BushInhibitor { +export default class NsfwInhibitor extends BotInhibitor { public constructor() { super('nsfw', { reason: 'notNsfw', - category: 'command', type: 'post', priority: 25 }); } - public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { + public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise<boolean> { if (command.onlyNsfw && !(message.channel as TextChannel).nsfw) { void this.client.console.verbose( 'notNsfw', diff --git a/src/inhibitors/command/owner.ts b/src/inhibitors/command/owner.ts index 7a39063..15643be 100644 --- a/src/inhibitors/command/owner.ts +++ b/src/inhibitors/command/owner.ts @@ -1,16 +1,15 @@ -import { BushInhibitor, type BushCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; -export default class OwnerInhibitor extends BushInhibitor { +export default class OwnerInhibitor extends BotInhibitor { public constructor() { super('owner', { reason: 'owner', - category: 'command', type: 'post', priority: 100 }); } - public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { + public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise<boolean> { if (command.ownerOnly) { if (!this.client.isOwner(message.author)) { void this.client.console.verbose( diff --git a/src/inhibitors/command/restrictedChannel.ts b/src/inhibitors/command/restrictedChannel.ts index 849166a..ec23604 100644 --- a/src/inhibitors/command/restrictedChannel.ts +++ b/src/inhibitors/command/restrictedChannel.ts @@ -1,16 +1,15 @@ -import { BushInhibitor, type BushCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; -export default class RestrictedChannelInhibitor extends BushInhibitor { +export default class RestrictedChannelInhibitor extends BotInhibitor { public constructor() { super('restrictedChannel', { reason: 'restrictedChannel', - category: 'command', type: 'post', priority: 10 }); } - public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { + public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise<boolean> { if (command.restrictedChannels?.length && message.channel) { if (!command.restrictedChannels.includes(message.channel.id)) { void this.client.console.verbose( diff --git a/src/inhibitors/command/restrictedGuild.ts b/src/inhibitors/command/restrictedGuild.ts index 1e2d1b2..ec0ad2c 100644 --- a/src/inhibitors/command/restrictedGuild.ts +++ b/src/inhibitors/command/restrictedGuild.ts @@ -1,16 +1,15 @@ -import { BushInhibitor, type BushCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; -export default class RestrictedGuildInhibitor extends BushInhibitor { +export default class RestrictedGuildInhibitor extends BotInhibitor { public constructor() { super('restrictedGuild', { reason: 'restrictedGuild', - category: 'command', type: 'post', priority: 5 }); } - public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { + public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise<boolean> { if (command.restrictedChannels?.length && message.channel) { if (!command.restrictedChannels.includes(message.channel.id)) { void this.client.console.verbose( diff --git a/src/inhibitors/command/superUser.ts b/src/inhibitors/command/superUser.ts index 69e95a2..a923c1a 100644 --- a/src/inhibitors/command/superUser.ts +++ b/src/inhibitors/command/superUser.ts @@ -1,16 +1,15 @@ -import { BushInhibitor, type BushCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; -export default class SuperUserInhibitor extends BushInhibitor { +export default class SuperUserInhibitor extends BotInhibitor { public constructor() { super('superUser', { reason: 'superUser', - category: 'command', type: 'post', priority: 99 }); } - public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { + public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise<boolean> { if (command.superUserOnly) { if (!this.client.isSuperUser(message.author)) { void this.client.console.verbose( diff --git a/src/listeners/automod/automodCreate.ts b/src/listeners/automod/automodCreate.ts index 529651c..e2454e6 100644 --- a/src/listeners/automod/automodCreate.ts +++ b/src/listeners/automod/automodCreate.ts @@ -1,15 +1,14 @@ -import { BushListener, MessageAutomod, type BushClientEvents } from '#lib'; +import { BotListener, MessageAutomod, type BotClientEvents } from '#lib'; -export default class AutomodMessageCreateListener extends BushListener { +export default class AutomodMessageCreateListener extends BotListener { public constructor() { super('automodCreate', { emitter: 'client', - event: 'messageCreate', - category: 'message' + event: 'messageCreate' }); } - public async exec(...[message]: BushClientEvents['messageCreate']) { + public async exec(...[message]: BotClientEvents['messageCreate']) { if (message.member === null) return; return new MessageAutomod(message); } diff --git a/src/listeners/automod/automodUpdate.ts b/src/listeners/automod/automodUpdate.ts index d68759f..0609e67 100644 --- a/src/listeners/automod/automodUpdate.ts +++ b/src/listeners/automod/automodUpdate.ts @@ -1,15 +1,14 @@ -import { BushListener, MessageAutomod, type BushClientEvents } from '#lib'; +import { BotListener, MessageAutomod, type BotClientEvents } from '#lib'; -export default class AutomodMessageUpdateListener extends BushListener { +export default class AutomodMessageUpdateListener extends BotListener { public constructor() { super('automodUpdate', { emitter: 'client', - event: 'messageUpdate', - category: 'message' + event: 'messageUpdate' }); } - public async exec(...[_, newMessage]: BushClientEvents['messageUpdate']) { + public async exec(...[_, newMessage]: BotClientEvents['messageUpdate']) { const fullMessage = newMessage.partial ? await newMessage.fetch().catch(() => null) : newMessage; if (!fullMessage?.member) return; return new MessageAutomod(fullMessage); diff --git a/src/listeners/automod/memberAutomod.ts b/src/listeners/automod/memberAutomod.ts index 01eb56c..557d13a 100644 --- a/src/listeners/automod/memberAutomod.ts +++ b/src/listeners/automod/memberAutomod.ts @@ -1,7 +1,7 @@ -import { BushClientEvents, BushListener, MemberAutomod } from '#lib'; +import { BotClientEvents, BotListener, MemberAutomod } from '#lib'; import chalk from 'chalk'; -export default class PresenceAutomodListener extends BushListener { +export default class PresenceAutomodListener extends BotListener { public constructor() { super('memberAutomod', { emitter: 'client', @@ -9,7 +9,7 @@ export default class PresenceAutomodListener extends BushListener { }); } - public async exec(...[_, newMember]: BushClientEvents['guildMemberUpdate']) { + public async exec(...[_, newMember]: BotClientEvents['guildMemberUpdate']) { if (!(await newMember.guild.hasFeature('automodMembers'))) return; if (!(await newMember.guild.hasFeature('automod'))) return; diff --git a/src/listeners/automod/presenceAutomod.ts b/src/listeners/automod/presenceAutomod.ts index eb536bf..a89d45c 100644 --- a/src/listeners/automod/presenceAutomod.ts +++ b/src/listeners/automod/presenceAutomod.ts @@ -1,6 +1,6 @@ -import { BushClientEvents, BushListener, PresenceAutomod } from '#lib'; +import { BotClientEvents, BotListener, PresenceAutomod } from '#lib'; -export default class PresenceAutomodListener extends BushListener { +export default class PresenceAutomodListener extends BotListener { public constructor() { super('presenceAutomod', { emitter: 'client', @@ -8,7 +8,7 @@ export default class PresenceAutomodListener extends BushListener { }); } - public async exec(...[_, newPresence]: BushClientEvents['presenceUpdate']) { + public async exec(...[_, newPresence]: BotClientEvents['presenceUpdate']) { if (!newPresence.member || !newPresence.guild) return; if (!newPresence.activities.length) return; diff --git a/src/listeners/bush/appealListener.ts b/src/listeners/bush/appealListener.ts index a4e1f00..ecc65c5 100644 --- a/src/listeners/bush/appealListener.ts +++ b/src/listeners/bush/appealListener.ts @@ -1,19 +1,18 @@ -import { BushListener, colors, mappings, ModLog, type BushClientEvents } from '#lib'; +import { BotListener, colors, mappings, ModLog, type BotClientEvents } from '#lib'; import assert from 'assert/strict'; import { EmbedBuilder } from 'discord.js'; import UserInfoCommand from '../../commands/info/userInfo.js'; import ModlogCommand from '../../commands/moderation/modlog.js'; -export default class AppealListener extends BushListener { +export default class AppealListener extends BotListener { public constructor() { super('appealListener', { emitter: 'client', - event: 'messageCreate', - category: 'bush' + event: 'messageCreate' }); } - public async exec(...[message]: BushClientEvents['messageCreate']): Promise<any> { + public async exec(...[message]: BotClientEvents['messageCreate']): Promise<any> { if (!this.client.config.isProduction || !message.inGuild() || message.guildId !== mappings.guilds["Moulberry's Bush"]) return; if (message.author.id !== '855446927688335370' || message.embeds.length < 1) return; diff --git a/src/listeners/bush/joinAutoBan.ts b/src/listeners/bush/joinAutoBan.ts index 4370e86..66fdf54 100644 --- a/src/listeners/bush/joinAutoBan.ts +++ b/src/listeners/bush/joinAutoBan.ts @@ -1,16 +1,15 @@ -import { AllowedMentions, BushListener, colors, emojis, format, mappings, type BushClientEvents } from '#lib'; +import { AllowedMentions, BotListener, colors, emojis, format, mappings, type BotClientEvents } from '#lib'; import { TextChannel } from 'discord.js'; -export default class JoinAutoBanListener extends BushListener { +export default class JoinAutoBanListener extends BotListener { public constructor() { super('joinAutoBan', { emitter: 'client', - event: 'guildMemberAdd', - category: 'bush' + event: 'guildMemberAdd' }); } - public async exec(...[member]: BushClientEvents['guildMemberAdd']): Promise<void> { + public async exec(...[member]: BotClientEvents['guildMemberAdd']): Promise<void> { if (!this.client.config.isProduction) return; if (member.guild.id !== mappings.guilds["Moulberry's Bush"]) return; const guild = member.guild; @@ -20,7 +19,7 @@ export default class JoinAutoBanListener extends BushListener { const code = this.client.utils.getShared('autoBanCode'); if (!code) return; if (eval(code)) { - const res = await member.bushBan({ + const res = await member.customBan({ reason: '[AutoBan] Impersonation is not allowed.', moderator: member.guild.members.me! }); diff --git a/src/listeners/bush/supportThread.ts b/src/listeners/bush/supportThread.ts index 5145ff2..3e806e2 100644 --- a/src/listeners/bush/supportThread.ts +++ b/src/listeners/bush/supportThread.ts @@ -1,18 +1,17 @@ -import { BushListener, colors, mappings, type BushClientEvents } from '#lib'; +import { BotListener, colors, mappings, type BotClientEvents } from '#lib'; import { stripIndent } from '#tags'; import assert from 'assert/strict'; import { EmbedBuilder, MessageType, PermissionFlagsBits, TextChannel } from 'discord.js'; -export default class SupportThreadListener extends BushListener { +export default class SupportThreadListener extends BotListener { public constructor() { super('supportThread', { emitter: 'client', - event: 'messageCreate', - category: 'bush' + event: 'messageCreate' }); } - public async exec(...[message]: BushClientEvents['messageCreate']): Promise<void | undefined> { + public async exec(...[message]: BotClientEvents['messageCreate']): Promise<void | undefined> { if (!this.client.config.isProduction || !message.inGuild()) return; if (![MessageType.Default, MessageType.Reply].includes(message.type)) return; if (message.thread) return; diff --git a/src/listeners/bush/userUpdateAutoBan.ts b/src/listeners/bush/userUpdateAutoBan.ts index adfb80c..ae8bca3 100644 --- a/src/listeners/bush/userUpdateAutoBan.ts +++ b/src/listeners/bush/userUpdateAutoBan.ts @@ -1,16 +1,15 @@ -import { AllowedMentions, BushListener, colors, emojis, format, mappings, type BushClientEvents } from '#lib'; +import { AllowedMentions, BotListener, colors, emojis, format, mappings, type BotClientEvents } from '#lib'; import { GuildMember, type TextChannel } from 'discord.js'; -export default class UserUpdateAutoBanListener extends BushListener { +export default class UserUpdateAutoBanListener extends BotListener { public constructor() { super('userUpdateAutoBan', { emitter: 'client', - event: 'userUpdate', - category: 'bush' + event: 'userUpdate' }); } - public async exec(...[_oldUser, newUser]: BushClientEvents['userUpdate']): Promise<void> { + public async exec(...[_oldUser, newUser]: BotClientEvents['userUpdate']): Promise<void> { if (!this.client.config.isProduction) return; // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -26,7 +25,7 @@ export default class UserUpdateAutoBanListener extends BushListener { const guild = member.guild; - const res = await member.bushBan({ + const res = await member.customBan({ reason: '[AutoBan] Impersonation is not allowed.', moderator: member.guild.members.me! }); diff --git a/src/listeners/client/akairoDebug.ts b/src/listeners/client/akairoDebug.ts index 3fa7977..af973bf 100644 --- a/src/listeners/client/akairoDebug.ts +++ b/src/listeners/client/akairoDebug.ts @@ -1,15 +1,14 @@ -import { BushListener, type BushClientEvents } from '#lib'; +import { BotListener, type BotClientEvents } from '#lib'; -export default class DiscordJsDebugListener extends BushListener { +export default class DiscordJsDebugListener extends BotListener { public constructor() { super('akairoDebug', { emitter: 'client', - event: 'akairoDebug', - category: 'client' + event: 'akairoDebug' }); } - public async exec(...[message, ...other]: BushClientEvents['debug']): Promise<void> { + public async exec(...[message, ...other]: BotClientEvents['debug']): Promise<void> { if (other.length && !message.includes('[registerInteractionCommands]')) void this.client.console.superVerboseRaw('akairoDebug', message, ...other); else void this.client.console.superVerbose('akairoDebug', message); diff --git a/src/listeners/client/dcjsDebug.ts b/src/listeners/client/dcjsDebug.ts deleted file mode 100644 index 4b80c65..0000000 --- a/src/listeners/client/dcjsDebug.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { BushListener, type BushClientEvents } from '#lib'; - -export default class DiscordJsDebugListener extends BushListener { - public constructor() { - super('discordJsDebug', { - emitter: 'client', - event: 'debug', - category: 'client' - }); - } - - public async exec(...[message]: BushClientEvents['debug']): Promise<void> { - void this.client.console.superVerbose('dc.js-debug', message); - } -} diff --git a/src/listeners/client/dcjsError.ts b/src/listeners/client/dcjsError.ts deleted file mode 100644 index a39a92d..0000000 --- a/src/listeners/client/dcjsError.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { BushListener, type BushClientEvents } from '#lib'; - -export default class DiscordJsErrorListener extends BushListener { - public constructor() { - super('discordJsError', { - emitter: 'client', - event: 'error', - category: 'client' - }); - } - - public async exec(...[error]: BushClientEvents['error']): Promise<void> { - void this.client.console.superVerbose('dc.js-error', error); - } -} diff --git a/src/listeners/client/dcjsWarn.ts b/src/listeners/client/dcjsWarn.ts deleted file mode 100644 index b187f0c..0000000 --- a/src/listeners/client/dcjsWarn.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { BushListener, type BushClientEvents } from '#lib'; - -export default class DiscordJsWarnListener extends BushListener { - public constructor() { - super('discordJsWarn', { - emitter: 'client', - event: 'warn', - category: 'client' - }); - } - - public async exec(...[message]: BushClientEvents['warn']): Promise<void> { - void this.client.console.superVerbose('dc.js-warn', message); - } -} diff --git a/src/listeners/client/djsDebug.ts b/src/listeners/client/djsDebug.ts new file mode 100644 index 0000000..28bac7f --- /dev/null +++ b/src/listeners/client/djsDebug.ts @@ -0,0 +1,14 @@ +import { BotListener, type BotClientEvents } from '#lib'; + +export default class DiscordJsDebugListener extends BotListener { + public constructor() { + super('discordJsDebug', { + emitter: 'client', + event: 'debug' + }); + } + + public async exec(...[message]: BotClientEvents['debug']): Promise<void> { + void this.client.console.superVerbose('dc.js-debug', message); + } +} diff --git a/src/listeners/client/djsError.ts b/src/listeners/client/djsError.ts new file mode 100644 index 0000000..04fbfaa --- /dev/null +++ b/src/listeners/client/djsError.ts @@ -0,0 +1,14 @@ +import { BotListener, type BotClientEvents } from '#lib'; + +export default class DiscordJsErrorListener extends BotListener { + public constructor() { + super('discordJsError', { + emitter: 'client', + event: 'error' + }); + } + + public async exec(...[error]: BotClientEvents['error']): Promise<void> { + void this.client.console.superVerbose('dc.js-error', error); + } +} diff --git a/src/listeners/client/djsWarn.ts b/src/listeners/client/djsWarn.ts new file mode 100644 index 0000000..9162a36 --- /dev/null +++ b/src/listeners/client/djsWarn.ts @@ -0,0 +1,14 @@ +import { BotListener, type BotClientEvents } from '#lib'; + +export default class DiscordJsWarnListener extends BotListener { + public constructor() { + super('discordJsWarn', { + emitter: 'client', + event: 'warn' + }); + } + + public async exec(...[message]: BotClientEvents['warn']): Promise<void> { + void this.client.console.superVerbose('dc.js-warn', message); + } +} diff --git a/src/listeners/client/ready.ts b/src/listeners/client/ready.ts index a6a289c..1c887ed 100644 --- a/src/listeners/client/ready.ts +++ b/src/listeners/client/ready.ts @@ -1,7 +1,7 @@ -import { BushClientEvents, BushListener, Guild } from '#lib'; +import { BotClientEvents, BotListener, Guild } from '#lib'; import chalk from 'chalk'; -export default class ReadyListener extends BushListener { +export default class ReadyListener extends BotListener { public constructor() { super('ready', { emitter: 'client', @@ -11,7 +11,7 @@ export default class ReadyListener extends BushListener { } // eslint-disable-next-line no-empty-pattern - public async exec(...[]: BushClientEvents['ready']) { + public async exec(...[]: BotClientEvents['ready']) { process.emit('ready' as any); const tag = `<<${this.client.user?.tag}>>`, diff --git a/src/listeners/commands/commandBlocked.ts b/src/listeners/commands/commandBlocked.ts index 1324d5f..d9a95c1 100644 --- a/src/listeners/commands/commandBlocked.ts +++ b/src/listeners/commands/commandBlocked.ts @@ -1,33 +1,32 @@ import { BlockedReasons, - BushListener, + BotListener, emojis, format, oxford, - type BushCommand, - type BushCommandHandlerEvents, + type BotCommand, + type BotCommandHandlerEvents, type CommandMessage, type SlashMessage } from '#lib'; import { type Client, type InteractionReplyOptions, type ReplyMessageOptions } from 'discord.js'; -export default class CommandBlockedListener extends BushListener { +export default class CommandBlockedListener extends BotListener { public constructor() { super('commandBlocked', { emitter: 'commandHandler', - event: 'commandBlocked', - category: 'commands' + event: 'commandBlocked' }); } - public async exec(...[message, command, reason]: BushCommandHandlerEvents['commandBlocked']) { + public async exec(...[message, command, reason]: BotCommandHandlerEvents['commandBlocked']) { return await CommandBlockedListener.handleBlocked(this.client, message, command, reason); } public static async handleBlocked( client: Client, message: CommandMessage | SlashMessage, - command: BushCommand | null, + command: BotCommand | null, reason?: string ) { const isSlash = !!command && !!message.util?.isSlash; diff --git a/src/listeners/commands/commandCooldown.ts b/src/listeners/commands/commandCooldown.ts index 5f4d70e..1a5b790 100644 --- a/src/listeners/commands/commandCooldown.ts +++ b/src/listeners/commands/commandCooldown.ts @@ -1,15 +1,14 @@ -import { BushListener, type BushCommandHandlerEvents } from '#lib'; +import { BotListener, type BotCommandHandlerEvents } from '#lib'; -export default class CommandCooldownListener extends BushListener { +export default class CommandCooldownListener extends BotListener { public constructor() { super('commandCooldown', { emitter: 'commandHandler', - event: 'cooldown', - category: 'commands' + event: 'cooldown' }); } - public async exec(...[message, command, remaining]: BushCommandHandlerEvents['cooldown']) { + public async exec(...[message, command, remaining]: BotCommandHandlerEvents['cooldown']) { void this.client.console.info( 'commandCooldown', `<<${message.author.tag}>> tried to run <<${ diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts index 7e14bc3..b96b8de 100644 --- a/src/listeners/commands/commandError.ts +++ b/src/listeners/commands/commandError.ts @@ -1,15 +1,14 @@ -import { BushListener, handleCommandError, type BushCommandHandlerEvents } from '#lib'; +import { BotListener, handleCommandError, type BotCommandHandlerEvents } from '#lib'; -export default class CommandErrorListener extends BushListener { +export default class CommandErrorListener extends BotListener { public constructor() { super('commandError', { emitter: 'commandHandler', - event: 'error', - category: 'commands' + event: 'error' }); } - public exec(...[error, message, command]: BushCommandHandlerEvents['error']) { + public exec(...[error, message, command]: BotCommandHandlerEvents['error']) { return handleCommandError(this.client, error, message, command); } } diff --git a/src/listeners/commands/commandLocked.ts b/src/listeners/commands/commandLocked.ts index 22ed8e1..fbceca8 100644 --- a/src/listeners/commands/commandLocked.ts +++ b/src/listeners/commands/commandLocked.ts @@ -1,15 +1,14 @@ -import { BushListener, emojis, format, type BushCommandHandlerEvents } from '#lib'; +import { BotListener, emojis, format, type BotCommandHandlerEvents } from '#lib'; -export default class CommandLockedListener extends BushListener { +export default class CommandLockedListener extends BotListener { public constructor() { super('commandLocked', { emitter: 'commandHandler', - event: 'commandLocked', - category: 'commands' + event: 'commandLocked' }); } - public async exec(...[message, command]: BushCommandHandlerEvents['commandLocked']) { + public async exec(...[message, command]: BotCommandHandlerEvents['commandLocked']) { return message.util.reply( `${emojis.error} You cannot use the ${format.input(command.id)} command because it is already in use.` ); diff --git a/src/listeners/commands/commandMissingPermissions.ts b/src/listeners/commands/commandMissingPermissions.ts index 4d39264..a2ec461 100644 --- a/src/listeners/commands/commandMissingPermissions.ts +++ b/src/listeners/commands/commandMissingPermissions.ts @@ -1,24 +1,23 @@ -import { BushListener, emojis, format, mappings, oxford, surroundArray, type BushCommandHandlerEvents } from '#lib'; +import { BotListener, emojis, format, mappings, oxford, surroundArray, type BotCommandHandlerEvents } from '#lib'; import { Client, type PermissionsString } from 'discord.js'; -export default class CommandMissingPermissionsListener extends BushListener { +export default class CommandMissingPermissionsListener extends BotListener { public constructor() { super('commandMissingPermissions', { emitter: 'commandHandler', - event: 'missingPermissions', - category: 'commands' + event: 'missingPermissions' }); } - public async exec(...[message, command, type, missing]: BushCommandHandlerEvents['missingPermissions']) { + public async exec(...[message, command, type, missing]: BotCommandHandlerEvents['missingPermissions']) { return await CommandMissingPermissionsListener.handleMissing(this.client, message, command, type, missing); } public static async handleMissing( client: Client, ...[message, command, type, missing]: - | BushCommandHandlerEvents['missingPermissions'] - | BushCommandHandlerEvents['slashMissingPermissions'] + | BotCommandHandlerEvents['missingPermissions'] + | BotCommandHandlerEvents['slashMissingPermissions'] ) { const niceMissing = (missing.includes('Administrator') ? (['Administrator'] as PermissionsString[]) : missing).map( (perm) => mappings.permissions[perm]?.name ?? missing diff --git a/src/listeners/commands/commandStarted.ts b/src/listeners/commands/commandStarted.ts index 9d0e4cb..407662c 100644 --- a/src/listeners/commands/commandStarted.ts +++ b/src/listeners/commands/commandStarted.ts @@ -1,16 +1,15 @@ -import { BushListener, type BushCommandHandlerEvents } from '#lib'; +import { BotListener, type BotCommandHandlerEvents } from '#lib'; import { ChannelType } from 'discord.js'; -export default class CommandStartedListener extends BushListener { +export default class CommandStartedListener extends BotListener { public constructor() { super('commandStarted', { emitter: 'commandHandler', - event: 'commandStarted', - category: 'commands' + event: 'commandStarted' }); } - public exec(...[message, command]: BushCommandHandlerEvents['commandStarted']): void { + public exec(...[message, command]: BotCommandHandlerEvents['commandStarted']): void { this.client.sentry.addBreadcrumb({ message: `[commandStarted] The ${command.id} was started by ${message.author.tag}.`, level: 'info', diff --git a/src/listeners/commands/messageBlocked.ts b/src/listeners/commands/messageBlocked.ts index d73cff1..3d92d32 100644 --- a/src/listeners/commands/messageBlocked.ts +++ b/src/listeners/commands/messageBlocked.ts @@ -1,15 +1,14 @@ -import { BushListener, type BushCommandHandlerEvents } from '#lib'; +import { BotListener, type BotCommandHandlerEvents } from '#lib'; -export default class MessageBlockedListener extends BushListener { +export default class MessageBlockedListener extends BotListener { public constructor() { super('messageBlocked', { emitter: 'commandHandler', - event: 'messageBlocked', - category: 'commands' + event: 'messageBlocked' }); } - public async exec(...[message, reason]: BushCommandHandlerEvents['messageBlocked']) { + public async exec(...[message, reason]: BotCommandHandlerEvents['messageBlocked']) { if (['client', 'bot'].includes(reason)) return; // return await CommandBlockedListener.handleBlocked(message as Message, null, reason); return void this.client.console.verbose( diff --git a/src/listeners/commands/slashBlocked.ts b/src/listeners/commands/slashBlocked.ts index c877708..528c97b 100644 --- a/src/listeners/commands/slashBlocked.ts +++ b/src/listeners/commands/slashBlocked.ts @@ -1,16 +1,15 @@ -import { BushListener, type BushCommandHandlerEvents } from '#lib'; +import { BotListener, type BotCommandHandlerEvents } from '#lib'; import CommandBlockedListener from './commandBlocked.js'; -export default class SlashBlockedListener extends BushListener { +export default class SlashBlockedListener extends BotListener { public constructor() { super('slashBlocked', { emitter: 'commandHandler', - event: 'slashBlocked', - category: 'commands' + event: 'slashBlocked' }); } - public async exec(...[message, command, reason]: BushCommandHandlerEvents['slashBlocked']) { + public async exec(...[message, command, reason]: BotCommandHandlerEvents['slashBlocked']) { return await CommandBlockedListener.handleBlocked(this.client, message, command, reason); } } diff --git a/src/listeners/commands/slashCommandError.ts b/src/listeners/commands/slashCommandError.ts index aca7c5b..03eb34a 100644 --- a/src/listeners/commands/slashCommandError.ts +++ b/src/listeners/commands/slashCommandError.ts @@ -1,15 +1,14 @@ -import { BushListener, handleCommandError, type BushCommandHandlerEvents } from '#lib'; +import { BotListener, handleCommandError, type BotCommandHandlerEvents } from '#lib'; -export default class SlashCommandErrorListener extends BushListener { +export default class SlashCommandErrorListener extends BotListener { public constructor() { super('slashError', { emitter: 'commandHandler', - event: 'slashError', - category: 'commands' + event: 'slashError' }); } - public async exec(...[error, message, command]: BushCommandHandlerEvents['slashError']) { + public async exec(...[error, message, command]: BotCommandHandlerEvents['slashError']) { return await handleCommandError(this.client, error, message, command); } } diff --git a/src/listeners/commands/slashMissingPermissions.ts b/src/listeners/commands/slashMissingPermissions.ts index 0a1383b..68388bf 100644 --- a/src/listeners/commands/slashMissingPermissions.ts +++ b/src/listeners/commands/slashMissingPermissions.ts @@ -1,16 +1,15 @@ -import { BushListener, type BushCommandHandlerEvents } from '#lib'; +import { BotListener, type BotCommandHandlerEvents } from '#lib'; import CommandMissingPermissionsListener from './commandMissingPermissions.js'; -export default class SlashMissingPermissionsListener extends BushListener { +export default class SlashMissingPermissionsListener extends BotListener { public constructor() { super('slashMissingPermissions', { emitter: 'commandHandler', - event: 'slashMissingPermissions', - category: 'commands' + event: 'slashMissingPermissions' }); } - public async exec(...[message, command, type, missing]: BushCommandHandlerEvents['slashMissingPermissions']) { + public async exec(...[message, command, type, missing]: BotCommandHandlerEvents['slashMissingPermissions']) { return await CommandMissingPermissionsListener.handleMissing(this.client, message, command, type, missing); } } diff --git a/src/listeners/commands/slashNotFound.ts b/src/listeners/commands/slashNotFound.ts index cc14969..7e76fe6 100644 --- a/src/listeners/commands/slashNotFound.ts +++ b/src/listeners/commands/slashNotFound.ts @@ -1,15 +1,14 @@ -import { BushListener, type BushCommandHandlerEvents } from '#lib'; +import { BotListener, type BotCommandHandlerEvents } from '#lib'; -export default class SlashNotFoundListener extends BushListener { +export default class SlashNotFoundListener extends BotListener { public constructor() { super('slashNotFound', { emitter: 'commandHandler', - event: 'slashNotFound', - category: 'commands' + event: 'slashNotFound' }); } - public async exec(...[interaction]: BushCommandHandlerEvents['slashNotFound']) { + public async exec(...[interaction]: BotCommandHandlerEvents['slashNotFound']) { void this.client.console.info('slashNotFound', `<<${interaction?.commandName}>> could not be found.`); } } diff --git a/src/listeners/commands/slashStarted.ts b/src/listeners/commands/slashStarted.ts index c2ece5e..898af13 100644 --- a/src/listeners/commands/slashStarted.ts +++ b/src/listeners/commands/slashStarted.ts @@ -1,16 +1,15 @@ -import { BushListener, type BushCommandHandlerEvents } from '#lib'; +import { BotListener, type BotCommandHandlerEvents } from '#lib'; import { ChannelType } from 'discord.js'; -export default class SlashStartedListener extends BushListener { +export default class SlashStartedListener extends BotListener { public constructor() { super('slashStarted', { emitter: 'commandHandler', - event: 'slashStarted', - category: 'commands' + event: 'slashStarted' }); } - public async exec(...[message, command]: BushCommandHandlerEvents['slashStarted']) { + public async exec(...[message, command]: BotCommandHandlerEvents['slashStarted']) { this.client.sentry.addBreadcrumb({ message: `[slashStarted] The ${command.id} was started by ${message.author.tag}.`, level: 'info', diff --git a/src/listeners/contextCommands/contextCommandBlocked.ts b/src/listeners/contextCommands/contextCommandBlocked.ts index bb237a0..d8d002e 100644 --- a/src/listeners/contextCommands/contextCommandBlocked.ts +++ b/src/listeners/contextCommands/contextCommandBlocked.ts @@ -1,12 +1,11 @@ -import { BlockedReasons, BushListener, emojis, format } from '#lib'; +import { BlockedReasons, BotListener, emojis, format } from '#lib'; import { type ContextMenuCommandHandlerEvents } from 'discord-akairo'; -export default class ContextCommandBlockedListener extends BushListener { +export default class ContextCommandBlockedListener extends BotListener { public constructor() { super('contextCommandBlocked', { emitter: 'contextMenuCommandHandler', - event: 'blocked', - category: 'contextCommands' + event: 'blocked' }); } diff --git a/src/listeners/contextCommands/contextCommandError.ts b/src/listeners/contextCommands/contextCommandError.ts index 6951ce3..091bee9 100644 --- a/src/listeners/contextCommands/contextCommandError.ts +++ b/src/listeners/contextCommands/contextCommandError.ts @@ -1,13 +1,12 @@ -import { BushListener, colors, format, formatError, getErrorHaste, getErrorStack, IFuckedUpError } from '#lib'; +import { BotListener, colors, format, formatError, getErrorHaste, getErrorStack, IFuckedUpError } from '#lib'; import { type ContextMenuCommand, type ContextMenuCommandHandlerEvents } from 'discord-akairo'; import { ChannelType, Client, ContextMenuCommandInteraction, EmbedBuilder, GuildTextBasedChannel } from 'discord.js'; -export default class ContextCommandErrorListener extends BushListener { +export default class ContextCommandErrorListener extends BotListener { public constructor() { super('contextCommandError', { emitter: 'contextMenuCommandHandler', - event: 'error', - category: 'contextCommands' + event: 'error' }); } diff --git a/src/listeners/contextCommands/contextCommandNotFound.ts b/src/listeners/contextCommands/contextCommandNotFound.ts index f5097f3..4bb397e 100644 --- a/src/listeners/contextCommands/contextCommandNotFound.ts +++ b/src/listeners/contextCommands/contextCommandNotFound.ts @@ -1,12 +1,11 @@ -import { BushListener } from '#lib'; +import { BotListener } from '#lib'; import { type ContextMenuCommandHandlerEvents } from 'discord-akairo'; -export default class ContextCommandNotFoundListener extends BushListener { +export default class ContextCommandNotFoundListener extends BotListener { public constructor() { super('contextCommandNotFound', { emitter: 'contextMenuCommandHandler', - event: 'notFound', - category: 'contextCommands' + event: 'notFound' }); } diff --git a/src/listeners/contextCommands/contextCommandStarted.ts b/src/listeners/contextCommands/contextCommandStarted.ts index 2d1e9ef..867af54 100644 --- a/src/listeners/contextCommands/contextCommandStarted.ts +++ b/src/listeners/contextCommands/contextCommandStarted.ts @@ -1,13 +1,12 @@ -import { BushListener } from '#lib'; +import { BotListener } from '#lib'; import { ContextMenuCommandHandlerEvents } from 'discord-akairo'; import { ApplicationCommandType, ChannelType } from 'discord.js'; -export default class ContextCommandStartedListener extends BushListener { +export default class ContextCommandStartedListener extends BotListener { public constructor() { super('contextCommandStarted', { emitter: 'contextMenuCommandHandler', - event: 'started', - category: 'contextCommands' + event: 'started' }); } diff --git a/src/listeners/guild-custom/bushLockdown.ts b/src/listeners/guild-custom/lockdown.ts index 51d1c3d..bf3ee7c 100644 --- a/src/listeners/guild-custom/bushLockdown.ts +++ b/src/listeners/guild-custom/lockdown.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, emojis, type BushClientEvents } from '#lib'; +import { BotListener, colors, emojis, type BotClientEvents } from '#lib'; import { EmbedBuilder } from 'discord.js'; -export default class BushLockdownListener extends BushListener { +export default class LockdownListener extends BotListener { public constructor() { - super('bushLockdown', { + super('lockdown', { emitter: 'client', - event: 'bushLockdown', - category: 'guild-custom' + event: 'lockdown' }); } - public async exec(...[moderator, reason, channelsSuccessMap, _all]: BushClientEvents['bushLockdown']) { + public async exec(...[moderator, reason, channelsSuccessMap, _all]: BotClientEvents['lockdown']) { const logChannel = await moderator.guild.getLogChannel('moderation'); if (!logChannel) return; diff --git a/src/listeners/guild-custom/bushUnlockdown.ts b/src/listeners/guild-custom/unlockdown.ts index 18cb792..e08a42b 100644 --- a/src/listeners/guild-custom/bushUnlockdown.ts +++ b/src/listeners/guild-custom/unlockdown.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, emojis, type BushClientEvents } from '#lib'; +import { BotListener, colors, emojis, type BotClientEvents } from '#lib'; import { EmbedBuilder } from 'discord.js'; -export default class BushUnlockdownListener extends BushListener { +export default class UnlockdownListener extends BotListener { public constructor() { - super('bushUnlockdown', { + super('unlockdown', { emitter: 'client', - event: 'bushUnlockdown', - category: 'guild-custom' + event: 'unlockdown' }); } - public async exec(...[moderator, reason, channelsSuccessMap, _all]: BushClientEvents['bushUnlockdown']) { + public async exec(...[moderator, reason, channelsSuccessMap, _all]: BotClientEvents['unlockdown']) { const logChannel = await moderator.guild.getLogChannel('moderation'); if (!logChannel) return; diff --git a/src/listeners/guild/guildCreate.ts b/src/listeners/guild/guildCreate.ts index 9f5f56c..3db28d6 100644 --- a/src/listeners/guild/guildCreate.ts +++ b/src/listeners/guild/guildCreate.ts @@ -1,15 +1,14 @@ -import { BushListener, colors, emojis, format, Guild, type BushClientEvents } from '#lib'; +import { BotListener, colors, emojis, format, Guild, type BotClientEvents } from '#lib'; -export default class GuildCreateListener extends BushListener { +export default class GuildCreateListener extends BotListener { public constructor() { super('guildCreate', { emitter: 'client', - event: 'guildCreate', // when the bot joins a guild - category: 'guild' + event: 'guildCreate' // when the bot joins a guild }); } - public async exec(...[guild]: BushClientEvents['guildCreate']) { + public async exec(...[guild]: BotClientEvents['guildCreate']) { void this.client.console.info( 'guildCreate', `Joined <<${guild.name}>> with <<${guild.memberCount?.toLocaleString()}>> members.` diff --git a/src/listeners/guild/guildDelete.ts b/src/listeners/guild/guildDelete.ts index 62d98e3..2cc23f1 100644 --- a/src/listeners/guild/guildDelete.ts +++ b/src/listeners/guild/guildDelete.ts @@ -1,15 +1,14 @@ -import { BushListener, colors, emojis, format, type BushClientEvents } from '#lib'; +import { BotListener, colors, emojis, format, type BotClientEvents } from '#lib'; -export default class GuildDeleteListener extends BushListener { +export default class GuildDeleteListener extends BotListener { public constructor() { super('guildDelete', { emitter: 'client', - event: 'guildDelete', // when the bot leaves a guild - category: 'guild' + event: 'guildDelete' // when the bot leaves a guild }); } - public async exec(...[guild]: BushClientEvents['guildDelete']) { + public async exec(...[guild]: BotClientEvents['guildDelete']) { void this.client.console.info( 'guildDelete', `Left <<${guild.name}>> with <<${guild.memberCount?.toLocaleString()}>> members.` diff --git a/src/listeners/guild/guildMemberAdd.ts b/src/listeners/guild/guildMemberAdd.ts index f1f90af..9268f01 100644 --- a/src/listeners/guild/guildMemberAdd.ts +++ b/src/listeners/guild/guildMemberAdd.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, emojis, format, type BushClientEvents } from '#lib'; +import { BotListener, colors, emojis, format, type BotClientEvents } from '#lib'; import { EmbedBuilder, type GuildMember, type TextChannel } from 'discord.js'; -export default class GuildMemberAddListener extends BushListener { +export default class GuildMemberAddListener extends BotListener { public constructor() { super('guildMemberAdd', { emitter: 'client', - event: 'guildMemberAdd', - category: 'guild' + event: 'guildMemberAdd' }); } - public async exec(...[member]: BushClientEvents['guildMemberAdd']) { + public async exec(...[member]: BotClientEvents['guildMemberAdd']) { void this.sendWelcomeMessage(member); } diff --git a/src/listeners/guild/guildMemberRemove.ts b/src/listeners/guild/guildMemberRemove.ts index 39bab24..ee626d6 100644 --- a/src/listeners/guild/guildMemberRemove.ts +++ b/src/listeners/guild/guildMemberRemove.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, emojis, format, sleep, StickyRole, Time, type BushClientEvents } from '#lib'; +import { BotListener, colors, emojis, format, sleep, StickyRole, Time, type BotClientEvents } from '#lib'; import { EmbedBuilder, type GuildMember, type PartialGuildMember, type TextChannel } from 'discord.js'; -export default class GuildMemberRemoveListener extends BushListener { +export default class GuildMemberRemoveListener extends BotListener { public constructor() { super('guildMemberRemove', { emitter: 'client', - event: 'guildMemberRemove', - category: 'guild' + event: 'guildMemberRemove' }); } - public async exec(...[member]: BushClientEvents['guildMemberRemove']) { + public async exec(...[member]: BotClientEvents['guildMemberRemove']) { void this.sendWelcomeMessage(member); void this.stickyRoles(member); } diff --git a/src/listeners/guild/joinRoles.ts b/src/listeners/guild/joinRoles.ts index 539fa71..142d4cd 100644 --- a/src/listeners/guild/joinRoles.ts +++ b/src/listeners/guild/joinRoles.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, format, StickyRole, type BushClientEvents } from '#lib'; +import { BotListener, colors, format, StickyRole, type BotClientEvents } from '#lib'; import { type GuildMember, type Snowflake } from 'discord.js'; -export default class JoinRolesListener extends BushListener { +export default class JoinRolesListener extends BotListener { public constructor() { super('joinRoles', { emitter: 'client', - event: 'guildMemberUpdate', // listens to guildMemberUpdate so that the role's aren't given before the member accepts the welcome screen - category: 'guild' + event: 'guildMemberUpdate' // listens to guildMemberUpdate so that the role's aren't given before the member accepts the welcome screen }); } - public async exec(...[oldMember, newMember]: BushClientEvents['guildMemberUpdate']) { + public async exec(...[oldMember, newMember]: BotClientEvents['guildMemberUpdate']) { if (this.client.config.isDevelopment) return; if (oldMember.pending && !newMember.pending) { const feat = { diff --git a/src/listeners/guild/syncUnbanPunishmentModel.ts b/src/listeners/guild/syncUnbanPunishmentModel.ts index 80a8ce2..352d704 100644 --- a/src/listeners/guild/syncUnbanPunishmentModel.ts +++ b/src/listeners/guild/syncUnbanPunishmentModel.ts @@ -1,15 +1,14 @@ -import { ActivePunishment, ActivePunishmentType, BushListener, type BushClientEvents } from '#lib'; +import { ActivePunishment, ActivePunishmentType, BotListener, type BotClientEvents } from '#lib'; -export default class SyncUnbanListener extends BushListener { +export default class SyncUnbanListener extends BotListener { public constructor() { super('syncUnbanPunishmentModel', { emitter: 'client', - event: 'guildBanRemove', - category: 'guild' + event: 'guildBanRemove' }); } - public async exec(...[ban]: BushClientEvents['guildBanRemove']) { + public async exec(...[ban]: BotClientEvents['guildBanRemove']) { const bans = await ActivePunishment.findAll({ where: { user: ban.user.id, diff --git a/src/listeners/interaction/interactionCreate.ts b/src/listeners/interaction/interactionCreate.ts index 8dd753b..d8a5cc9 100644 --- a/src/listeners/interaction/interactionCreate.ts +++ b/src/listeners/interaction/interactionCreate.ts @@ -1,16 +1,15 @@ -import { BushListener, emojis, format, handleAutomodInteraction, oxford, surroundArray, type BushClientEvents } from '#lib'; +import { BotListener, emojis, format, handleAutomodInteraction, oxford, surroundArray, type BotClientEvents } from '#lib'; import { InteractionType } from 'discord.js'; -export default class InteractionCreateListener extends BushListener { +export default class InteractionCreateListener extends BotListener { public constructor() { super('interactionCreate', { emitter: 'client', - event: 'interactionCreate', - category: 'interaction' + event: 'interactionCreate' }); } - public async exec(...[interaction]: BushClientEvents['interactionCreate']) { + public async exec(...[interaction]: BotClientEvents['interactionCreate']) { if (!interaction) return; if ('customId' in interaction && (interaction as any)['customId'].startsWith('test')) return; void this.client.console.verbose( diff --git a/src/listeners/member-custom/bushBan.ts b/src/listeners/member-custom/customBan.ts index 2cde91d..5b199bb 100644 --- a/src/listeners/member-custom/bushBan.ts +++ b/src/listeners/member-custom/customBan.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, humanizeDuration, type BushClientEvents } from '#lib'; +import { BotListener, colors, humanizeDuration, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder, GuildMember } from 'discord.js'; -export default class BushBanListener extends BushListener { +export default class CustomBanListener extends BotListener { public constructor() { - super('bushBan', { + super(TanzaniteEvent.Ban, { emitter: 'client', - event: 'bushBan', - category: 'member-custom' + event: TanzaniteEvent.Ban }); } - public async exec(...[victim, moderator, guild, reason, caseID, duration, dmSuccess]: BushClientEvents['bushBan']) { + public async exec(...[victim, moderator, guild, reason, caseID, duration, dmSuccess]: BotClientEvents[TanzaniteEvent.Ban]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/member-custom/bushBlock.ts b/src/listeners/member-custom/customBlock.ts index a3af924..8faa0b7 100644 --- a/src/listeners/member-custom/bushBlock.ts +++ b/src/listeners/member-custom/customBlock.ts @@ -1,16 +1,17 @@ -import { BushListener, colors, humanizeDuration, type BushClientEvents } from '#lib'; +import { BotListener, colors, humanizeDuration, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder, GuildMember } from 'discord.js'; -export default class BushBlockListener extends BushListener { +export default class CustomBlockListener extends BotListener { public constructor() { - super('bushBlock', { + super(TanzaniteEvent.Block, { emitter: 'client', - event: 'bushBlock', - category: 'member-custom' + event: TanzaniteEvent.Block }); } - public async exec(...[victim, moderator, guild, reason, caseID, duration, dmSuccess, channel]: BushClientEvents['bushBlock']) { + public async exec( + ...[victim, moderator, guild, reason, caseID, duration, dmSuccess, channel]: BotClientEvents[TanzaniteEvent.Block] + ) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/member-custom/bushKick.ts b/src/listeners/member-custom/customKick.ts index ff3e40e..bf3e2fe 100644 --- a/src/listeners/member-custom/bushKick.ts +++ b/src/listeners/member-custom/customKick.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, type BushClientEvents } from '#lib'; +import { BotListener, colors, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder, GuildMember } from 'discord.js'; -export default class BushKickListener extends BushListener { +export default class CustomKickListener extends BotListener { public constructor() { - super('bushKick', { + super(TanzaniteEvent.Kick, { emitter: 'client', - event: 'bushKick', - category: 'member-custom' + event: TanzaniteEvent.Kick }); } - public async exec(...[victim, moderator, guild, reason, caseID, dmSuccess]: BushClientEvents['bushKick']) { + public async exec(...[victim, moderator, guild, reason, caseID, dmSuccess]: BotClientEvents[TanzaniteEvent.Kick]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/member-custom/bushMute.ts b/src/listeners/member-custom/customMute.ts index 73f9490..21a24e8 100644 --- a/src/listeners/member-custom/bushMute.ts +++ b/src/listeners/member-custom/customMute.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, humanizeDuration, type BushClientEvents } from '#lib'; +import { BotListener, colors, humanizeDuration, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder, GuildMember } from 'discord.js'; -export default class BushMuteListener extends BushListener { +export default class CustomMuteListener extends BotListener { public constructor() { - super('bushMute', { + super(TanzaniteEvent.Mute, { emitter: 'client', - event: 'bushMute', - category: 'member-custom' + event: TanzaniteEvent.Mute }); } - public async exec(...[victim, moderator, guild, reason, caseID, duration, dmSuccess]: BushClientEvents['bushMute']) { + public async exec(...[victim, moderator, guild, reason, caseID, duration, dmSuccess]: BotClientEvents[TanzaniteEvent.Mute]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/member-custom/bushPurge.ts b/src/listeners/member-custom/customPurge.ts index 75faaeb..956fcb7 100644 --- a/src/listeners/member-custom/bushPurge.ts +++ b/src/listeners/member-custom/customPurge.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, emojis, type BushClientEvents } from '#lib'; +import { BotListener, colors, emojis, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder } from 'discord.js'; -export default class BushPurgeListener extends BushListener { +export default class CustomPurgeListener extends BotListener { public constructor() { - super('bushPurge', { + super(TanzaniteEvent.Purge, { emitter: 'client', - event: 'bushPurge', - category: 'member-custom' + event: TanzaniteEvent.Purge }); } - public async exec(...[moderator, guild, channel, messages]: BushClientEvents['bushPurge']) { + public async exec(...[moderator, guild, channel, messages]: BotClientEvents[TanzaniteEvent.Purge]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; diff --git a/src/listeners/member-custom/bushRemoveTimeout.ts b/src/listeners/member-custom/customRemoveTimeout.ts index c389538..00454bd 100644 --- a/src/listeners/member-custom/bushRemoveTimeout.ts +++ b/src/listeners/member-custom/customRemoveTimeout.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, type BushClientEvents } from '#lib'; +import { BotListener, colors, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder, GuildMember } from 'discord.js'; -export default class BushRemoveTimeoutListener extends BushListener { +export default class CustomRemoveTimeoutListener extends BotListener { public constructor() { - super('bushRemoveTimeout', { + super(TanzaniteEvent.RemoveTimeout, { emitter: 'client', - event: 'bushRemoveTimeout', - category: 'member-custom' + event: TanzaniteEvent.RemoveTimeout }); } - public async exec(...[victim, moderator, guild, reason, caseID, dmSuccess]: BushClientEvents['bushRemoveTimeout']) { + public async exec(...[victim, moderator, guild, reason, caseID, dmSuccess]: BotClientEvents[TanzaniteEvent.RemoveTimeout]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/member-custom/bushTimeout.ts b/src/listeners/member-custom/customTimeout.ts index 82169d6..6b142ec 100644 --- a/src/listeners/member-custom/bushTimeout.ts +++ b/src/listeners/member-custom/customTimeout.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, humanizeDuration, type BushClientEvents } from '#lib'; +import { BotListener, colors, humanizeDuration, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder, GuildMember } from 'discord.js'; -export default class BushTimeoutListener extends BushListener { +export default class CustomTimeoutListener extends BotListener { public constructor() { - super('bushTimeout', { + super(TanzaniteEvent.Timeout, { emitter: 'client', - event: 'bushTimeout', - category: 'member-custom' + event: TanzaniteEvent.Timeout }); } - public async exec(...[victim, moderator, guild, reason, caseID, duration, dmSuccess]: BushClientEvents['bushTimeout']) { + public async exec(...[victim, moderator, guild, reason, caseID, duration, dmSuccess]: BotClientEvents[TanzaniteEvent.Timeout]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/member-custom/bushUnban.ts b/src/listeners/member-custom/customUnban.ts index 40394cd..aa4cd75 100644 --- a/src/listeners/member-custom/bushUnban.ts +++ b/src/listeners/member-custom/customUnban.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, type BushClientEvents } from '#lib'; +import { BotListener, colors, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder, GuildMember } from 'discord.js'; -export default class BushUnbanListener extends BushListener { +export default class CustomUnbanListener extends BotListener { public constructor() { - super('bushUnban', { + super(TanzaniteEvent.Unban, { emitter: 'client', - event: 'bushUnban', - category: 'member-custom' + event: TanzaniteEvent.Unban }); } - public async exec(...[victim, moderator, guild, reason, caseID, dmSuccess]: BushClientEvents['bushUnban']) { + public async exec(...[victim, moderator, guild, reason, caseID, dmSuccess]: BotClientEvents[TanzaniteEvent.Unban]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/member-custom/bushUnblock.ts b/src/listeners/member-custom/customUnblock.ts index 867d391..a7553d9 100644 --- a/src/listeners/member-custom/bushUnblock.ts +++ b/src/listeners/member-custom/customUnblock.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, type BushClientEvents } from '#lib'; +import { BotListener, colors, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder, GuildMember } from 'discord.js'; -export default class BushUnblockListener extends BushListener { +export default class CustomUnblockListener extends BotListener { public constructor() { - super('bushUnblock', { + super(TanzaniteEvent.Unblock, { emitter: 'client', - event: 'bushUnblock', - category: 'member-custom' + event: TanzaniteEvent.Unblock }); } - public async exec(...[victim, moderator, guild, reason, caseID, dmSuccess, channel]: BushClientEvents['bushUnblock']) { + public async exec(...[victim, moderator, guild, reason, caseID, dmSuccess, channel]: BotClientEvents[TanzaniteEvent.Unblock]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/member-custom/bushUnmute.ts b/src/listeners/member-custom/customUnmute.ts index 2ff53b9..ef7b22f 100644 --- a/src/listeners/member-custom/bushUnmute.ts +++ b/src/listeners/member-custom/customUnmute.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, type BushClientEvents } from '#lib'; +import { BotListener, colors, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder, GuildMember } from 'discord.js'; -export default class BushUnmuteListener extends BushListener { +export default class CustomUnmuteListener extends BotListener { public constructor() { - super('bushUnmute', { + super(TanzaniteEvent.Unmute, { emitter: 'client', - event: 'bushUnmute', - category: 'member-custom' + event: TanzaniteEvent.Unmute }); } - public async exec(...[victim, moderator, guild, reason, caseID, dmSuccess]: BushClientEvents['bushUnmute']) { + public async exec(...[victim, moderator, guild, reason, caseID, dmSuccess]: BotClientEvents[TanzaniteEvent.Unmute]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/member-custom/bushWarn.ts b/src/listeners/member-custom/customWarnMember.ts index 822a491..3ca7e08 100644 --- a/src/listeners/member-custom/bushWarn.ts +++ b/src/listeners/member-custom/customWarnMember.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, type BushClientEvents } from '#lib'; +import { BotListener, colors, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder, GuildMember } from 'discord.js'; -export default class BushWarnListener extends BushListener { +export default class CustomWarnListener extends BotListener { public constructor() { - super('bushWarn', { + super(TanzaniteEvent.Warn, { emitter: 'client', - event: 'bushWarn', - category: 'member-custom' + event: TanzaniteEvent.Warn }); } - public async exec(...[victim, moderator, guild, reason, caseID, dmSuccess]: BushClientEvents['bushWarn']) { + public async exec(...[victim, moderator, guild, reason, caseID, dmSuccess]: BotClientEvents[TanzaniteEvent.Warn]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/member-custom/bushLevelUpdate.ts b/src/listeners/member-custom/levelUpdate.ts index 702f7cc..64dd388 100644 --- a/src/listeners/member-custom/bushLevelUpdate.ts +++ b/src/listeners/member-custom/levelUpdate.ts @@ -1,15 +1,14 @@ -import { BushListener, format, type BushClientEvents } from '#lib'; +import { BotListener, format, TanzaniteEvent, type BotClientEvents } from '#lib'; import assert from 'assert/strict'; import { type TextChannel } from 'discord.js'; -type Args = BushClientEvents['bushLevelUpdate']; +type Args = BotClientEvents[TanzaniteEvent.LevelUpdate]; -export default class BushLevelUpdateListener extends BushListener { +export default class LevelUpdateListener extends BotListener { public constructor() { - super('bushLevelUpdate', { + super(TanzaniteEvent.LevelUpdate, { emitter: 'client', - event: 'bushLevelUpdate', - category: 'member-custom' + event: TanzaniteEvent.LevelUpdate }); } @@ -32,7 +31,7 @@ export default class BushLevelUpdateListener extends BushListener { if (!success) await message.guild.error( - 'bushLevelUpdate', + 'LevelUpdate', `Could not send level up message for ${member.user.tag} in <#${message.channel.id}>.` ); } @@ -54,7 +53,7 @@ export default class BushLevelUpdateListener extends BushListener { if (promises.length) await Promise.all(promises); } catch (e: any) { await member.guild.error( - 'bushLevelUpdate', + 'LevelUpdate', `There was an error adding level roles to ${member.user.tag} upon reaching to level ${newLevel}.\n${ 'message' in e ? e.message : e }` diff --git a/src/listeners/member-custom/massBan.ts b/src/listeners/member-custom/massBan.ts index ca41f29..7a6cd34 100644 --- a/src/listeners/member-custom/massBan.ts +++ b/src/listeners/member-custom/massBan.ts @@ -1,15 +1,14 @@ -import { BanResponse, banResponse, BushListener, colors, emojis, overflowEmbed, type BushClientEvents } from '#lib'; +import { BanResponse, banResponse, BotListener, colors, emojis, overflowEmbed, TanzaniteEvent, type BotClientEvents } from '#lib'; -export default class MassBanListener extends BushListener { +export default class MassBanListener extends BotListener { public constructor() { - super('massBan', { + super(TanzaniteEvent.MassBan, { emitter: 'client', - event: 'massBan', - category: 'member-custom' + event: TanzaniteEvent.MassBan }); } - public async exec(...[moderator, guild, reason, results]: BushClientEvents['massBan']) { + public async exec(...[moderator, guild, reason, results]: BotClientEvents[TanzaniteEvent.MassBan]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; diff --git a/src/listeners/member-custom/massEvidence.ts b/src/listeners/member-custom/massEvidence.ts index f0f75df..acfa4f7 100644 --- a/src/listeners/member-custom/massEvidence.ts +++ b/src/listeners/member-custom/massEvidence.ts @@ -1,15 +1,14 @@ -import { BushListener, colors, overflowEmbed, type BushClientEvents } from '#lib'; +import { BotListener, colors, overflowEmbed, TanzaniteEvent, type BotClientEvents } from '#lib'; -export default class MassEvidenceListener extends BushListener { +export default class MassEvidenceListener extends BotListener { public constructor() { - super('massEvidence', { + super(TanzaniteEvent.MassEvidence, { emitter: 'client', - event: 'massEvidence', - category: 'member-custom' + event: TanzaniteEvent.MassEvidence }); } - public async exec(...[moderator, guild, evidence, lines]: BushClientEvents['massEvidence']) { + public async exec(...[moderator, guild, evidence, lines]: BotClientEvents[TanzaniteEvent.MassEvidence]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; diff --git a/src/listeners/member-custom/bushPunishRole.ts b/src/listeners/member-custom/punishRole.ts index 1f28811..70a04d7 100644 --- a/src/listeners/member-custom/bushPunishRole.ts +++ b/src/listeners/member-custom/punishRole.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, humanizeDuration, type BushClientEvents } from '#lib'; +import { BotListener, colors, humanizeDuration, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder, GuildMember } from 'discord.js'; -export default class BushPunishRoleListener extends BushListener { +export default class PunishRoleListener extends BotListener { public constructor() { - super('bushPunishRole', { + super(TanzaniteEvent.PunishRoleAdd, { emitter: 'client', - event: 'bushPunishRole', - category: 'member-custom' + event: TanzaniteEvent.PunishRoleAdd }); } - public async exec(...[victim, moderator, guild, reason, caseID, duration]: BushClientEvents['bushPunishRole']) { + public async exec(...[victim, moderator, guild, reason, caseID, duration]: BotClientEvents[TanzaniteEvent.PunishRoleAdd]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/member-custom/bushPunishRoleRemove.ts b/src/listeners/member-custom/punishRoleRemove.ts index ef1d429..f144284 100644 --- a/src/listeners/member-custom/bushPunishRoleRemove.ts +++ b/src/listeners/member-custom/punishRoleRemove.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, type BushClientEvents } from '#lib'; +import { BotListener, colors, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder, GuildMember } from 'discord.js'; -export default class BushPunishRoleRemoveListener extends BushListener { +export default class PunishRoleRemoveListener extends BotListener { public constructor() { - super('bushPunishRoleRemove', { + super(TanzaniteEvent.PunishRoleRemove, { emitter: 'client', - event: 'bushPunishRoleRemove', - category: 'member-custom' + event: TanzaniteEvent.PunishRoleRemove }); } - public async exec(...[victim, moderator, guild, reason, caseID, role]: BushClientEvents['bushPunishRoleRemove']) { + public async exec(...[victim, moderator, guild, reason, caseID, role]: BotClientEvents[TanzaniteEvent.PunishRoleRemove]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/member-custom/bushUpdateModlog.ts b/src/listeners/member-custom/updateModlog.ts index 1896ede..f5f910d 100644 --- a/src/listeners/member-custom/bushUpdateModlog.ts +++ b/src/listeners/member-custom/updateModlog.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, type BushClientEvents } from '#lib'; +import { BotListener, colors, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder } from 'discord.js'; -export default class BushUpdateModlogListener extends BushListener { +export default class UpdateModlogListener extends BotListener { public constructor() { - super('bushUpdateModlog', { + super(TanzaniteEvent.UpdateModlog, { emitter: 'client', - event: 'bushUpdateModlog', - category: 'member-custom' + event: TanzaniteEvent.UpdateModlog }); } - public async exec(...[moderator, modlogID, key, oldModlog, newModlog]: BushClientEvents['bushUpdateModlog']) { + public async exec(...[moderator, modlogID, key, oldModlog, newModlog]: BotClientEvents[TanzaniteEvent.UpdateModlog]) { const logChannel = await moderator.guild.getLogChannel('moderation'); if (!logChannel) return; diff --git a/src/listeners/member-custom/bushUpdateSettings.ts b/src/listeners/member-custom/updateSettings.ts index a0be2f9..329212a 100644 --- a/src/listeners/member-custom/bushUpdateSettings.ts +++ b/src/listeners/member-custom/updateSettings.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, type BushClientEvents } from '#lib'; +import { BotListener, colors, TanzaniteEvent, type BotClientEvents } from '#lib'; import { EmbedBuilder } from 'discord.js'; -export default class BushUpdateSettingsListener extends BushListener { +export default class UpdateSettingsListener extends BotListener { public constructor() { - super('bushUpdateSettings', { + super(TanzaniteEvent.UpdateSettings, { emitter: 'client', - event: 'bushUpdateSettings', - category: 'member-custom' + event: TanzaniteEvent.UpdateSettings }); } - public async exec(...[setting, guild, oldSettings, newSettings, moderator]: BushClientEvents['bushUpdateSettings']) { + public async exec(...[setting, guild, oldSettings, newSettings, moderator]: BotClientEvents[TanzaniteEvent.UpdateSettings]) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; diff --git a/src/listeners/message/autoPublisher.ts b/src/listeners/message/autoPublisher.ts index a6fb7e0..36dcbe2 100644 --- a/src/listeners/message/autoPublisher.ts +++ b/src/listeners/message/autoPublisher.ts @@ -1,16 +1,15 @@ -import { BushListener, type BushClientEvents } from '#lib'; +import { BotListener, type BotClientEvents } from '#lib'; import { ChannelType } from 'discord.js'; -export default class autoPublisherListener extends BushListener { +export default class autoPublisherListener extends BotListener { public constructor() { super('autoPublisher', { emitter: 'client', - event: 'messageCreate', - category: 'message' + event: 'messageCreate' }); } - public async exec(...[message]: BushClientEvents['messageCreate']) { + public async exec(...[message]: BotClientEvents['messageCreate']) { if (!message.guild || !(await message.guild.hasFeature('autoPublish'))) return; const autoPublishChannels = await message.guild.getSetting('autoPublishChannels'); if (autoPublishChannels) { diff --git a/src/listeners/message/blacklistedFile.ts b/src/listeners/message/blacklistedFile.ts index f3e082c..31fbe9d 100644 --- a/src/listeners/message/blacklistedFile.ts +++ b/src/listeners/message/blacklistedFile.ts @@ -1,9 +1,9 @@ -// import { BushListener, type BushClientEvents } from '#lib'; +// import { CustomListener, type CustomClientEvents } from '#lib'; // import * as crypto from 'crypto'; // import { ChannelType } from 'discord.js'; // import got from 'got'; -// export default class BlacklistedFileListener extends BushListener { +// export default class BlacklistedFileListener extends CustomListener { // #blacklistedFiles: { hash: string[]; name: string; description: string }[] = [ // { // hash: ['a0f5e30426234bc9d09306ffc9474422'], @@ -61,11 +61,10 @@ // super('blacklistedFile', { // emitter: 'client', // event: 'messageCreate', -// category: 'message' // }); // } -// public async exec(...[message]: BushClientEvents['messageCreate']) { +// public async exec(...[message]: CustomClientEvents['messageCreate']) { // if (!message.guild || !(await message.guild.hasFeature('blacklistedFile'))) return; // // const embedAttachments = message.embeds.filter((e) => ['image', 'video', 'gifv'].includes(e.type)); // const foundEmojis = [...message.content.matchAll(/<(?<animated>a?):\w+:(?<id>\d+)>/g)]; diff --git a/src/listeners/message/boosterMessage.ts b/src/listeners/message/boosterMessage.ts index 0879ced..43fb04e 100644 --- a/src/listeners/message/boosterMessage.ts +++ b/src/listeners/message/boosterMessage.ts @@ -1,16 +1,15 @@ -import { BushListener, type BushClientEvents } from '#lib'; +import { BotListener, type BotClientEvents } from '#lib'; import { MessageType } from 'discord.js'; -export default class BoosterMessageListener extends BushListener { +export default class BoosterMessageListener extends BotListener { public constructor() { super('boosterMessage', { emitter: 'client', - event: 'messageCreate', - category: 'message' + event: 'messageCreate' }); } - public async exec(...[message]: BushClientEvents['messageCreate']) { + public async exec(...[message]: BotClientEvents['messageCreate']) { if (!message.guild || !(await message.guild?.hasFeature('boosterMessageReact'))) return; if ( [MessageType.GuildBoost, MessageType.GuildBoostTier1, MessageType.GuildBoostTier2, MessageType.GuildBoostTier3].includes( diff --git a/src/listeners/message/directMessage.ts b/src/listeners/message/directMessage.ts index 7278e63..efa5bb6 100644 --- a/src/listeners/message/directMessage.ts +++ b/src/listeners/message/directMessage.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, type BushClientEvents } from '#lib'; +import { BotListener, colors, type BotClientEvents } from '#lib'; import { ChannelType, EmbedBuilder } from 'discord.js'; -export default class DirectMessageListener extends BushListener { +export default class DirectMessageListener extends BotListener { public constructor() { super('directMessage', { emitter: 'client', - event: 'messageCreate', - category: 'message' + event: 'messageCreate' }); } - public async exec(...[message]: BushClientEvents['messageCreate']) { + public async exec(...[message]: BotClientEvents['messageCreate']) { if (message.channel.type === ChannelType.DM) { if (!(message.author.id == this.client.user!.id) && message.author.bot) return; if (this.client.cache.global.blacklistedUsers.includes(message.author.id)) return; diff --git a/src/listeners/message/highlight.ts b/src/listeners/message/highlight.ts index d9d3c0b..d5d8304 100644 --- a/src/listeners/message/highlight.ts +++ b/src/listeners/message/highlight.ts @@ -1,15 +1,14 @@ -import { BushListener, type BushClientEvents } from '#lib'; +import { BotListener, type BotClientEvents } from '#lib'; -export default class HighlightListener extends BushListener { +export default class HighlightListener extends BotListener { public constructor() { super('highlight', { emitter: 'client', - event: 'messageCreate', - category: 'message' + event: 'messageCreate' }); } - public async exec(...[message]: BushClientEvents['messageCreate']) { + public async exec(...[message]: BotClientEvents['messageCreate']) { if (!message.inGuild()) return; if (message.author.bot || message.system) return; if (!(await message.guild.hasFeature('highlight'))) return; // allows highlighting to be disabled on a guild-by-guild basis diff --git a/src/listeners/message/level.ts b/src/listeners/message/level.ts index 526dac9..5c314a8 100644 --- a/src/listeners/message/level.ts +++ b/src/listeners/message/level.ts @@ -1,17 +1,16 @@ -import { BushListener, Level, type BushCommandHandlerEvents } from '#lib'; +import { BotListener, Level, TanzaniteEvent, type BotCommandHandlerEvents } from '#lib'; import { MessageType } from 'discord.js'; -export default class LevelListener extends BushListener { +export default class LevelListener extends BotListener { #levelCooldowns: Set<string> = new Set(); public constructor() { super('level', { emitter: 'commandHandler', - event: 'messageInvalid', // Using messageInvalid here so commands don't give xp - category: 'message' + event: 'messageInvalid' // Using messageInvalid here so commands don't give xp }); } - public async exec(...[message]: BushCommandHandlerEvents['messageInvalid']) { + public async exec(...[message]: BotCommandHandlerEvents['messageInvalid']) { if (message.author.bot || !message.author || !message.inGuild()) return; if (!(await message.guild.hasFeature('leveling'))) return; if (this.#levelCooldowns.has(`${message.guildId}-${message.author.id}`)) return; @@ -38,7 +37,7 @@ export default class LevelListener extends BushListener { }); const newLevel = Level.convertXpToLevel(user.xp); if (previousLevel !== newLevel) - this.client.emit('bushLevelUpdate', message.member!, previousLevel, newLevel, user.xp, message); + this.client.emit(TanzaniteEvent.LevelUpdate, message.member!, previousLevel, newLevel, user.xp, message); if (success) void this.client.logger.verbose(`level`, `Gave <<${xpToGive}>> XP to <<${message.author.tag}>> in <<${message.guild}>>.`); this.#levelCooldowns.add(`${message.guildId}-${message.author.id}`); diff --git a/src/listeners/message/quoteCreate.ts b/src/listeners/message/quoteCreate.ts index 166bbb7..9bad9b8 100644 --- a/src/listeners/message/quoteCreate.ts +++ b/src/listeners/message/quoteCreate.ts @@ -1,15 +1,14 @@ -import { BushListener, mappings, type BushClientEvents } from '#lib'; +import { BotListener, mappings, type BotClientEvents } from '#lib'; -export default class QuoteCreateListener extends BushListener { +export default class QuoteCreateListener extends BotListener { public constructor() { super('quoteCreate', { emitter: 'client', - event: 'messageCreate', - category: 'message' + event: 'messageCreate' }); } - public async exec(...[message]: BushClientEvents['messageCreate']) { + public async exec(...[message]: BotClientEvents['messageCreate']) { if (message.author.id !== mappings.users['IRONM00N'] || !this.client.config.isProduction) return; if (!message.inGuild()) return; diff --git a/src/listeners/message/quoteEdit.ts b/src/listeners/message/quoteEdit.ts index 7da0d95..8422026 100644 --- a/src/listeners/message/quoteEdit.ts +++ b/src/listeners/message/quoteEdit.ts @@ -1,15 +1,14 @@ -// import { BushListener, type BushClientEvents } from '#lib'; +// import { CustomListener, type CustomClientEvents } from '#lib'; -// export default class QuoteEditListener extends BushListener { +// export default class QuoteEditListener extends CustomListener { // public constructor() { // super('quoteEdit', { // emitter: 'client', // event: 'messageUpdate', -// category: 'message' // }); // } -// public async exec(...[_, newMessage]: BushClientEvents['messageUpdate']) { +// public async exec(...[_, newMessage]: CustomClientEvents['messageUpdate']) { // return; // // if (newMessage.partial) newMessage = await newMessage.fetch(); // // return new QuoteCreateListener().exec(newMessage); diff --git a/src/listeners/message/verbose.ts b/src/listeners/message/verbose.ts index f5e94de..9c4ac3a 100644 --- a/src/listeners/message/verbose.ts +++ b/src/listeners/message/verbose.ts @@ -1,16 +1,15 @@ -import { BushListener, type BushClientEvents } from '#lib'; +import { BotListener, type BotClientEvents } from '#lib'; import { ChannelType } from 'discord.js'; -export default class MessageVerboseListener extends BushListener { +export default class MessageVerboseListener extends BotListener { public constructor() { super('messageVerbose', { emitter: 'client', - event: 'messageCreate', - category: 'message' + event: 'messageCreate' }); } - public exec(...[message]: BushClientEvents['messageCreate']): void { + public exec(...[message]: BotClientEvents['messageCreate']): void { if (this.client.customReady) { if (message.channel?.type === ChannelType.DM) return; void this.client.console.verbose( diff --git a/src/listeners/other/consoleListener.ts b/src/listeners/other/consoleListener.ts index b9da46e..dc6b66b 100644 --- a/src/listeners/other/consoleListener.ts +++ b/src/listeners/other/consoleListener.ts @@ -1,60 +1,60 @@ -import { BushListener } from '#lib'; -import { exec } from 'child_process'; -import { promisify } from 'util'; +// import { CustomListener } from '#lib'; +// import { exec } from 'child_process'; +// import { promisify } from 'util'; -// eslint-disable-next-line @typescript-eslint/no-unused-vars -/* export default */ class ConsoleListener extends BushListener { - public constructor() { - super('console', { - emitter: 'stdin', - event: 'line' - }); - } +// // eslint-disable-next-line @typescript-eslint/no-unused-vars +// /* export default */ class ConsoleListener extends CustomListener { +// public constructor() { +// super('console', { +// emitter: 'stdin', +// event: 'line' +// }); +// } - public async exec(line: string) { - if (line.startsWith('eval ') || line.startsWith('ev ')) { - /* eslint-disable @typescript-eslint/no-unused-vars */ - const sh = promisify(exec), - bot = this.client, - client = this.client, - config = this.client.config, - { ActivePunishment, Global, Guild, Level, ModLog, StickyRole } = await import('#lib'), - { - ButtonInteraction, - Collector, - CommandInteraction, - Message, - ActionRow, - Attachment, - ButtonComponent, - MessageCollector, - InteractionCollector, - Embed, - SelectMenuComponent, - ReactionCollector, - Collection - } = await import('discord.js'); - /* eslint-enable @typescript-eslint/no-unused-vars */ - try { - const depth = /--depth (?<depth>\d+)/.exec(line)?.groups?.depth ?? undefined; - const hidden = /--hidden/.test(line); - if (depth) line = line.replace(/--depth \d+/, ''); - if (hidden) line = line.replace(/--hidden/, ''); - const input = line.replace('eval ', '').replace('ev ', ''); - const output = await eval(input); - console.dir(output, { - colors: true, - getters: true, - maxArrayLength: Infinity, - maxStringLength: Infinity, - depth: +(depth ?? 2), - showHidden: hidden - }); - } catch (e) { - console.error(e); - } - } else if (line.startsWith('stop')) { - process.exit(0); - } - } -} +// public async exec(line: string) { +// if (line.startsWith('eval ') || line.startsWith('ev ')) { +// /* eslint-disable @typescript-eslint/no-unused-vars */ +// const sh = promisify(exec), +// bot = this.client, +// client = this.client, +// config = this.client.config, +// { ActivePunishment, Global, Guild, Level, ModLog, StickyRole } = await import('#lib'), +// { +// ButtonInteraction, +// Collector, +// CommandInteraction, +// Message, +// ActionRow, +// Attachment, +// ButtonComponent, +// MessageCollector, +// InteractionCollector, +// Embed, +// SelectMenuComponent, +// ReactionCollector, +// Collection +// } = await import('discord.js'); +// /* eslint-enable @typescript-eslint/no-unused-vars */ +// try { +// const depth = /--depth (?<depth>\d+)/.exec(line)?.groups?.depth ?? undefined; +// const hidden = /--hidden/.test(line); +// if (depth) line = line.replace(/--depth \d+/, ''); +// if (hidden) line = line.replace(/--hidden/, ''); +// const input = line.replace('eval ', '').replace('ev ', ''); +// const output = await eval(input); +// console.dir(output, { +// colors: true, +// getters: true, +// maxArrayLength: Infinity, +// maxStringLength: Infinity, +// depth: +(depth ?? 2), +// showHidden: hidden +// }); +// } catch (e) { +// console.error(e); +// } +// } else if (line.startsWith('stop')) { +// process.exit(0); +// } +// } +// } diff --git a/src/listeners/other/exit.ts b/src/listeners/other/exit.ts index ac074df..e1c8fee 100644 --- a/src/listeners/other/exit.ts +++ b/src/listeners/other/exit.ts @@ -1,6 +1,6 @@ -import { BushListener } from '#lib'; +import { BotListener } from '#lib'; -export default class ExitListener extends BushListener { +export default class ExitListener extends BotListener { public constructor() { super('exit', { emitter: 'process', diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts index 4ff6c0e..b56cef9 100644 --- a/src/listeners/other/promiseRejection.ts +++ b/src/listeners/other/promiseRejection.ts @@ -1,6 +1,6 @@ -import { BushListener, formatError, generateErrorEmbed } from '#lib'; +import { BotListener, formatError, generateErrorEmbed } from '#lib'; -export default class PromiseRejectionListener extends BushListener { +export default class PromiseRejectionListener extends BotListener { public constructor() { super('promiseRejection', { emitter: 'process', diff --git a/src/listeners/other/uncaughtException.ts b/src/listeners/other/uncaughtException.ts index c976a22..ab1c1b7 100644 --- a/src/listeners/other/uncaughtException.ts +++ b/src/listeners/other/uncaughtException.ts @@ -1,6 +1,6 @@ -import { BushListener, formatError, generateErrorEmbed } from '#lib'; +import { BotListener, formatError, generateErrorEmbed } from '#lib'; -export default class UncaughtExceptionListener extends BushListener { +export default class UncaughtExceptionListener extends BotListener { public constructor() { super('uncaughtException', { emitter: 'process', diff --git a/src/listeners/other/warning.ts b/src/listeners/other/warning.ts index 5cf9764..7fdcd46 100644 --- a/src/listeners/other/warning.ts +++ b/src/listeners/other/warning.ts @@ -1,6 +1,6 @@ -import { BushListener, colors, formatError, generateErrorEmbed } from '#lib'; +import { BotListener, colors, formatError, generateErrorEmbed } from '#lib'; -export default class WarningListener extends BushListener { +export default class WarningListener extends BotListener { public constructor() { super('warning', { emitter: 'process', diff --git a/src/listeners/rest/rateLimit.ts b/src/listeners/rest/rateLimit.ts index 9071416..46e5471 100644 --- a/src/listeners/rest/rateLimit.ts +++ b/src/listeners/rest/rateLimit.ts @@ -1,12 +1,11 @@ -import { BushListener } from '#lib'; +import { BotListener } from '#lib'; import type { RestEvents } from '@discordjs/rest'; -export default class RateLimitedListener extends BushListener { +export default class RateLimitedListener extends BotListener { public constructor() { super('rateLimited', { emitter: 'rest', - event: 'rateLimited', - category: 'rest' + event: 'rateLimited' }); } diff --git a/src/listeners/track-manual-punishments/modlogSyncBan.ts b/src/listeners/track-manual-punishments/modlogSyncBan.ts index 3c0ff34..5ecb8f3 100644 --- a/src/listeners/track-manual-punishments/modlogSyncBan.ts +++ b/src/listeners/track-manual-punishments/modlogSyncBan.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, humanizeDuration, Moderation, ModLogType, sleep, Time, type BushClientEvents } from '#lib'; +import { BotListener, colors, humanizeDuration, Moderation, ModLogType, sleep, Time, type BotClientEvents } from '#lib'; import { AuditLogEvent, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; -export default class ModlogSyncBanListener extends BushListener { +export default class ModlogSyncBanListener extends BotListener { public constructor() { super('modlogSyncBan', { emitter: 'client', - event: 'guildBanAdd', - category: 'guild' + event: 'guildBanAdd' }); } - public async exec(...[ban]: BushClientEvents['guildBanAdd']) { + public async exec(...[ban]: BotClientEvents['guildBanAdd']) { if (!(await ban.guild.hasFeature('logManualPunishments'))) return; if (!ban.guild.members.me) return; // bot was banned if (!ban.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) { diff --git a/src/listeners/track-manual-punishments/modlogSyncKick.ts b/src/listeners/track-manual-punishments/modlogSyncKick.ts index 7f7e9bc..fc3fab9 100644 --- a/src/listeners/track-manual-punishments/modlogSyncKick.ts +++ b/src/listeners/track-manual-punishments/modlogSyncKick.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, humanizeDuration, Moderation, ModLogType, sleep, Time, type BushClientEvents } from '#lib'; +import { BotListener, colors, humanizeDuration, Moderation, ModLogType, sleep, Time, type BotClientEvents } from '#lib'; import { AuditLogEvent, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; -export default class ModlogSyncKickListener extends BushListener { +export default class ModlogSyncKickListener extends BotListener { public constructor() { super('modlogSyncKick', { emitter: 'client', - event: 'guildMemberRemove', - category: 'guild' + event: 'guildMemberRemove' }); } - public async exec(...[member]: BushClientEvents['guildMemberRemove']) { + public async exec(...[member]: BotClientEvents['guildMemberRemove']) { if (!(await member.guild.hasFeature('logManualPunishments'))) return; if (!member.guild.members.me) return; // bot was removed from guild if (!member.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) { diff --git a/src/listeners/track-manual-punishments/modlogSyncTimeout.ts b/src/listeners/track-manual-punishments/modlogSyncTimeout.ts index 50d1331..6248654 100644 --- a/src/listeners/track-manual-punishments/modlogSyncTimeout.ts +++ b/src/listeners/track-manual-punishments/modlogSyncTimeout.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, humanizeDuration, Moderation, ModLogType, sleep, Time, type BushClientEvents } from '#lib'; +import { BotListener, colors, humanizeDuration, Moderation, ModLogType, sleep, Time, type BotClientEvents } from '#lib'; import { AuditLogEvent, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; -export default class ModlogSyncTimeoutListener extends BushListener { +export default class ModlogSyncTimeoutListener extends BotListener { public constructor() { super('modlogSyncTimeout', { emitter: 'client', - event: 'guildMemberUpdate', - category: 'guild' + event: 'guildMemberUpdate' }); } - public async exec(...[_oldMember, newMember]: BushClientEvents['guildMemberUpdate']) { + public async exec(...[_oldMember, newMember]: BotClientEvents['guildMemberUpdate']) { if (!(await newMember.guild.hasFeature('logManualPunishments'))) return; if (!newMember.guild.members.me!.permissions.has(PermissionFlagsBits.ViewAuditLog)) { return newMember.guild.error( diff --git a/src/listeners/track-manual-punishments/modlogSyncUnban.ts b/src/listeners/track-manual-punishments/modlogSyncUnban.ts index 8dfd39b..96de018 100644 --- a/src/listeners/track-manual-punishments/modlogSyncUnban.ts +++ b/src/listeners/track-manual-punishments/modlogSyncUnban.ts @@ -1,16 +1,15 @@ -import { BushListener, colors, humanizeDuration, Moderation, ModLogType, sleep, Time, type BushClientEvents } from '#lib'; +import { BotListener, colors, humanizeDuration, Moderation, ModLogType, sleep, Time, type BotClientEvents } from '#lib'; import { AuditLogEvent, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; -export default class ModlogSyncUnbanListener extends BushListener { +export default class ModlogSyncUnbanListener extends BotListener { public constructor() { super('modlogSyncUnban', { emitter: 'client', - event: 'guildBanRemove', - category: 'guild' + event: 'guildBanRemove' }); } - public async exec(...[ban]: BushClientEvents['guildBanRemove']) { + public async exec(...[ban]: BotClientEvents['guildBanRemove']) { if (!(await ban.guild.hasFeature('logManualPunishments'))) return; if (!ban.guild.members.me!.permissions.has(PermissionFlagsBits.ViewAuditLog)) { return ban.guild.error( diff --git a/src/listeners/ws/INTERACTION_CREATE.ts b/src/listeners/ws/INTERACTION_CREATE.ts index 67fe56b..250d8b5 100644 --- a/src/listeners/ws/INTERACTION_CREATE.ts +++ b/src/listeners/ws/INTERACTION_CREATE.ts @@ -1,4 +1,4 @@ -import { BushListener, capitalize, colors, emojis, Moderation, PunishmentTypePresent } from '#lib'; +import { BotListener, capitalize, colors, emojis, Moderation, PunishmentTypePresent } from '#lib'; import assert from 'assert/strict'; import { ActionRowBuilder, @@ -21,12 +21,11 @@ import { type APIModalInteractionResponse } from 'discord.js'; -export default class WsInteractionCreateListener extends BushListener { +export default class WsInteractionCreateListener extends BotListener { public constructor() { super('wsInteractionCreate', { emitter: 'ws', - event: GatewayDispatchEvents.InteractionCreate, - category: 'ws' + event: GatewayDispatchEvents.InteractionCreate }); } diff --git a/src/tasks/cache/cpuUsage.ts b/src/tasks/cache/cpuUsage.ts index 61e7a54..3cd52ba 100644 --- a/src/tasks/cache/cpuUsage.ts +++ b/src/tasks/cache/cpuUsage.ts @@ -1,7 +1,7 @@ -import { BushTask, Time } from '#lib'; +import { BotTask, Time } from '#lib'; import os from 'node:os'; -export default class CpuUsageTask extends BushTask { +export default class CpuUsageTask extends BotTask { public constructor() { super('cpuUsage', { delay: Time.Minute, diff --git a/src/tasks/cache/updateCache.ts b/src/tasks/cache/updateCache.ts index 190e2a4..8b42ad3 100644 --- a/src/tasks/cache/updateCache.ts +++ b/src/tasks/cache/updateCache.ts @@ -1,6 +1,6 @@ -import { BushTask, Time, updateEveryCache } from '#lib'; +import { BotTask, Time, updateEveryCache } from '#lib'; -export default class UpdateCacheTask extends BushTask { +export default class UpdateCacheTask extends BotTask { public constructor() { super('updateCache', { delay: 5 * Time.Minute, diff --git a/src/tasks/cache/updateHighlightCache.ts b/src/tasks/cache/updateHighlightCache.ts index 4ab5544..90139a6 100644 --- a/src/tasks/cache/updateHighlightCache.ts +++ b/src/tasks/cache/updateHighlightCache.ts @@ -1,7 +1,6 @@ -import { BushTask } from '../../../lib/extensions/discord-akairo/BushTask.js'; -import { Time } from '../../../lib/utils/BushConstants.js'; +import { BotTask, Time } from '#lib'; -export default class UpdateHighlightCacheTask extends BushTask { +export default class UpdateHighlightCacheTask extends BotTask { public constructor() { super('updateHighlightCache', { delay: 5 * Time.Minute, diff --git a/src/tasks/cache/updateNeuItemCache.ts b/src/tasks/cache/updateNeuItemCache.ts index 14c107b..5c88377 100644 --- a/src/tasks/cache/updateNeuItemCache.ts +++ b/src/tasks/cache/updateNeuItemCache.ts @@ -1,6 +1,6 @@ -import { BushTask, Time } from '#lib'; +import { BotTask, Time } from '#lib'; -export default class UpdateNeuItemCache extends BushTask { +export default class UpdateNeuItemCache extends BotTask { public constructor() { super('updateNeuItemCache', { delay: 1 * Time.Hour, diff --git a/src/tasks/cache/updatePriceItemCache.ts b/src/tasks/cache/updatePriceItemCache.ts index bafbfaf..04ae19a 100644 --- a/src/tasks/cache/updatePriceItemCache.ts +++ b/src/tasks/cache/updatePriceItemCache.ts @@ -1,7 +1,7 @@ -import { BushTask, Time } from '#lib'; +import { BotTask, Time } from '#lib'; import PriceCommand, { AuctionAverages, Bazaar, LowestBIN } from '../../commands/utilities/price.js'; -export default class UpdatePriceItemCache extends BushTask { +export default class UpdatePriceItemCache extends BotTask { public constructor() { super('updatePriceItemCache', { delay: 10 * Time.Minute, diff --git a/src/tasks/feature/handleReminders.ts b/src/tasks/feature/handleReminders.ts index a9f5658..afe6dd6 100644 --- a/src/tasks/feature/handleReminders.ts +++ b/src/tasks/feature/handleReminders.ts @@ -1,7 +1,7 @@ -import { BushTask, dateDelta, format, Reminder, Time } from '#lib'; +import { BotTask, dateDelta, format, Reminder, Time } from '#lib'; import { Op } from 'sequelize'; -export default class HandlerRemindersTask extends BushTask { +export default class HandlerRemindersTask extends BotTask { public constructor() { super('handlerReminders', { delay: 30 * Time.Second, diff --git a/src/tasks/feature/removeExpiredPunishements.ts b/src/tasks/feature/removeExpiredPunishements.ts index 30b8eba..eac325a 100644 --- a/src/tasks/feature/removeExpiredPunishements.ts +++ b/src/tasks/feature/removeExpiredPunishements.ts @@ -1,8 +1,8 @@ -import { ActivePunishment, ActivePunishmentType, BushTask, Time } from '#lib'; +import { ActivePunishment, ActivePunishmentType, BotTask, Time } from '#lib'; import assert from 'assert/strict'; import { Op } from 'sequelize'; -export default class RemoveExpiredPunishmentsTask extends BushTask { +export default class RemoveExpiredPunishmentsTask extends BotTask { public constructor() { super('removeExpiredPunishments', { delay: 15 * Time.Second, @@ -37,7 +37,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask { switch (entry.type) { case ActivePunishmentType.BAN: { assert(user); - const result = await guild.bushUnban({ user: user, reason: 'Punishment expired' }); + const result = await guild.customUnban({ user: user, reason: 'Punishment expired' }); if (['success', 'user not banned', 'cannot resolve user'].includes(result)) await entry.destroy(); else throw new Error(result); void this.client.logger.verbose(`removeExpiredPunishments`, `Unbanned ${entry.user}.`); @@ -48,7 +48,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask { await entry.destroy(); // channel overrides are removed when the member leaves the guild return; } - const result = await member.bushUnblock({ reason: 'Punishment expired', channel: entry.extraInfo }); + const result = await member.customUnblock({ reason: 'Punishment expired', channel: entry.extraInfo }); if (['success', 'user not blocked'].includes(result)) await entry.destroy(); else throw new Error(result); void this.client.logger.verbose(`removeExpiredPunishments`, `Unblocked ${entry.user}.`); @@ -56,7 +56,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask { } case ActivePunishmentType.MUTE: { if (!member) return; - const result = await member.bushUnmute({ reason: 'Punishment expired' }); + const result = await member.customUnmute({ reason: 'Punishment expired' }); if (['success', 'failed to dm'].includes(result)) await entry.destroy(); else throw new Error(result); void this.client.logger.verbose(`removeExpiredPunishments`, `Unmuted ${entry.user}.`); @@ -66,7 +66,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask { if (!member) return; const role = guild?.roles?.cache?.get(entry.extraInfo); if (!role) throw new Error(`Cannot unmute ${member.user.tag} because I cannot find the mute role.`); - const result = await member.bushRemoveRole({ + const result = await member.customRemoveRole({ reason: 'Punishment expired', role: role, addToModlog: true diff --git a/src/tasks/feature/updateStats.ts b/src/tasks/feature/updateStats.ts index 77b7c30..ded7aa1 100644 --- a/src/tasks/feature/updateStats.ts +++ b/src/tasks/feature/updateStats.ts @@ -1,6 +1,6 @@ -import { BushTask, Stat, Time } from '#lib'; +import { BotTask, Stat, Time } from '#lib'; -export default class UpdateStatsTask extends BushTask { +export default class UpdateStatsTask extends BotTask { public constructor() { super('updateStats', { delay: 10 * Time.Minute, diff --git a/src/tasks/stats/guildCount.ts b/src/tasks/stats/guildCount.ts index f52dc95..177c959 100644 --- a/src/tasks/stats/guildCount.ts +++ b/src/tasks/stats/guildCount.ts @@ -1,7 +1,6 @@ -import { BushTask, Time } from '#lib'; -import { GuildCount } from '../../../lib/models/shared/GuildCount.js'; +import { BotTask, GuildCount, Time } from '#lib'; -export default class GuildCountTask extends BushTask { +export default class GuildCountTask extends BotTask { public constructor() { super('guildCount', { delay: 15 * Time.Minute, diff --git a/src/tasks/stats/memberCount.ts b/src/tasks/stats/memberCount.ts index 9c31c5b..7cafde5 100644 --- a/src/tasks/stats/memberCount.ts +++ b/src/tasks/stats/memberCount.ts @@ -1,7 +1,7 @@ -import { BushTask, MemberCount, Time } from '#lib'; +import { BotTask, MemberCount, Time } from '#lib'; import assert from 'assert/strict'; -export default class MemberCountTask extends BushTask { +export default class MemberCountTask extends BotTask { public constructor() { super('memberCount', { delay: Time.Minute, |