diff options
Diffstat (limited to 'src/listeners/commands')
-rw-r--r-- | src/listeners/commands/commandBlocked.ts | 15 | ||||
-rw-r--r-- | src/listeners/commands/commandCooldown.ts | 9 | ||||
-rw-r--r-- | src/listeners/commands/commandError.ts | 9 | ||||
-rw-r--r-- | src/listeners/commands/commandLocked.ts | 9 | ||||
-rw-r--r-- | src/listeners/commands/commandMissingPermissions.ts | 13 | ||||
-rw-r--r-- | src/listeners/commands/commandStarted.ts | 9 | ||||
-rw-r--r-- | src/listeners/commands/messageBlocked.ts | 9 | ||||
-rw-r--r-- | src/listeners/commands/slashBlocked.ts | 9 | ||||
-rw-r--r-- | src/listeners/commands/slashCommandError.ts | 9 | ||||
-rw-r--r-- | src/listeners/commands/slashMissingPermissions.ts | 9 | ||||
-rw-r--r-- | src/listeners/commands/slashNotFound.ts | 9 | ||||
-rw-r--r-- | src/listeners/commands/slashStarted.ts | 9 |
12 files changed, 53 insertions, 65 deletions
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', |