diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-01 20:37:34 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-01 20:37:34 -0400 |
commit | 2b06a59c57fdf7aad217d63db875cdb3d8868036 (patch) | |
tree | 76fc9ff0f4217c5c4c3a37291dbb8e589da25bcc /src/listeners/client | |
parent | ad26ae36bc57ad4fb77c6c3c3e86eb3303f09110 (diff) | |
download | tanzanite-2b06a59c57fdf7aad217d63db875cdb3d8868036.tar.gz tanzanite-2b06a59c57fdf7aad217d63db875cdb3d8868036.tar.bz2 tanzanite-2b06a59c57fdf7aad217d63db875cdb3d8868036.zip |
don't judge me part 2 & fix esbuild with eval command
Diffstat (limited to 'src/listeners/client')
-rw-r--r-- | src/listeners/client/interaction.ts | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/listeners/client/interaction.ts b/src/listeners/client/interaction.ts new file mode 100644 index 0000000..881d759 --- /dev/null +++ b/src/listeners/client/interaction.ts @@ -0,0 +1,37 @@ +import { ButtonInteraction, CommandInteraction, Interaction, SelectMenuInteraction } from 'discord.js'; +import { BushListener } from '../../lib/extensions/discord-akairo/BushListener'; + +export default class InteractionListener extends BushListener { + public constructor() { + super('interaction', { + emitter: 'client', + event: 'interaction', + category: 'client' + }); + } + + async exec(interaction: Interaction | CommandInteraction | ButtonInteraction | SelectMenuInteraction): Promise<unknown> { + if (!interaction) return; + if (interaction.isCommand()) { + this.client.console.info( + 'SlashCommand', + `The <<${interaction.commandName}>> command was used by <<${interaction.user.tag}>> in <<${ + interaction.channel.type == 'dm' ? interaction.channel.recipient + 's DMs' : interaction.channel.name + }>>.` + ); + return; + } else if (interaction.isButton()) { + if (interaction.customID.startsWith('paginate_')) return; + return await interaction.reply({ content: 'Buttons go brrr', ephemeral: true }); + } else if (interaction.isSelectMenu()) { + return await interaction.reply({ + content: `You selected ${ + Array.isArray(interaction.values) + ? this.client.util.oxford(this.client.util.surroundArray(interaction.values, '`'), 'and', '') + : `\`${interaction.values}\`` + }.`, + ephemeral: true + }); + } + } +} |