From b86a05f4b21c62e18bf669e00646b715a409bdb0 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Tue, 8 Mar 2022 19:37:57 -0500 Subject: feat: misc changes for extentions --- src/listeners/client/interactionCreate.ts | 38 ------------------------- src/listeners/interaction/button.ts | 0 src/listeners/interaction/interactionCreate.ts | 39 ++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 38 deletions(-) delete mode 100644 src/listeners/client/interactionCreate.ts create mode 100644 src/listeners/interaction/button.ts create mode 100644 src/listeners/interaction/interactionCreate.ts (limited to 'src/listeners') diff --git a/src/listeners/client/interactionCreate.ts b/src/listeners/client/interactionCreate.ts deleted file mode 100644 index d123e09..0000000 --- a/src/listeners/client/interactionCreate.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { AutoMod, BushInteractionType, BushListener, type BushButtonInteraction, type BushClientEvents } from '#lib'; - -export default class InteractionCreateListener extends BushListener { - public constructor() { - super('interactionCreate', { - emitter: 'client', - event: 'interactionCreate', - category: 'client' - }); - } - - public override async exec(...[interaction]: BushClientEvents['interactionCreate']) { - if (!interaction) return; - if ('customId' in interaction && (interaction as any)['customId'].startsWith('test')) return; - void client.console.verbose( - 'interactionVerbose', - `An interaction of type <<${BushInteractionType[interaction.type]}>> was received from <<${interaction.user.tag}>>.` - ); - if (interaction.isCommand()) { - return; - } else if (interaction.isButton()) { - const id = interaction.customId; - if (['paginate_', 'command_', 'confirmationPrompt_', 'appeal'].some((s) => id.startsWith(s))) return; - else if (id.startsWith('automod;')) void AutoMod.handleInteraction(interaction as BushButtonInteraction); - else return await interaction.reply({ content: 'Buttons go brrr', ephemeral: true }); - } else if (interaction.isSelectMenu()) { - if (interaction.customId.startsWith('command_')) return; - return await interaction.reply({ - content: `You selected ${ - Array.isArray(interaction.values) - ? util.oxford(util.surroundArray(interaction.values, '`'), 'and', '') - : util.format.input(interaction.values) - }.`, - ephemeral: true - }); - } - } -} diff --git a/src/listeners/interaction/button.ts b/src/listeners/interaction/button.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/listeners/interaction/interactionCreate.ts b/src/listeners/interaction/interactionCreate.ts new file mode 100644 index 0000000..6916134 --- /dev/null +++ b/src/listeners/interaction/interactionCreate.ts @@ -0,0 +1,39 @@ +import { AutoMod, BushListener, type BushButtonInteraction, type BushClientEvents } from '#lib'; +import { InteractionType } from 'discord-api-types/v9'; + +export default class InteractionCreateListener extends BushListener { + public constructor() { + super('interactionCreate', { + emitter: 'client', + event: 'interactionCreate', + category: 'interaction' + }); + } + + public override async exec(...[interaction]: BushClientEvents['interactionCreate']) { + if (!interaction) return; + if ('customId' in interaction && (interaction as any)['customId'].startsWith('test')) return; + void client.console.verbose( + 'interactionVerbose', + `An interaction of type <<${InteractionType[interaction.type]}>> was received from <<${interaction.user.tag}>>.` + ); + if (interaction.isCommand()) { + return; + } else if (interaction.isButton()) { + const id = interaction.customId; + if (['paginate_', 'command_', 'confirmationPrompt_', 'appeal'].some((s) => id.startsWith(s))) return; + else if (id.startsWith('automod;')) void AutoMod.handleInteraction(interaction as BushButtonInteraction); + else return await interaction.reply({ content: 'Buttons go brrr', ephemeral: true }); + } else if (interaction.isSelectMenu()) { + if (interaction.customId.startsWith('command_')) return; + return await interaction.reply({ + content: `You selected ${ + Array.isArray(interaction.values) + ? util.oxford(util.surroundArray(interaction.values, '`'), 'and', '') + : util.format.input(interaction.values) + }.`, + ephemeral: true + }); + } + } +} -- cgit