diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-10 21:05:01 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-10 21:05:01 -0500 |
commit | 728e1a473c9208aeb15e5733b59d730793df6b21 (patch) | |
tree | 1d48d494dca7c2ddd3a715283dcc49c00754a65a /src/listeners | |
parent | af9e5a0fe36442035c87b843fc2f17cf7c80a675 (diff) | |
download | tanzanite-728e1a473c9208aeb15e5733b59d730793df6b21.tar.gz tanzanite-728e1a473c9208aeb15e5733b59d730793df6b21.tar.bz2 tanzanite-728e1a473c9208aeb15e5733b59d730793df6b21.zip |
feat: testing modals
Diffstat (limited to 'src/listeners')
-rw-r--r-- | src/listeners/client/interactionCreate.ts | 1 | ||||
-rw-r--r-- | src/listeners/ws/INTERACTION_CREATE.ts | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/listeners/client/interactionCreate.ts b/src/listeners/client/interactionCreate.ts index 6543d03..636bb6e 100644 --- a/src/listeners/client/interactionCreate.ts +++ b/src/listeners/client/interactionCreate.ts @@ -11,6 +11,7 @@ export default class InteractionCreateListener extends BushListener { 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}>>.` diff --git a/src/listeners/ws/INTERACTION_CREATE.ts b/src/listeners/ws/INTERACTION_CREATE.ts new file mode 100644 index 0000000..a7c8a45 --- /dev/null +++ b/src/listeners/ws/INTERACTION_CREATE.ts @@ -0,0 +1,25 @@ +import { BushListener } from '#lib'; +// eslint-disable-next-line node/file-extension-in-import +import { GatewayDispatchEvents, Routes } from 'discord-api-types/v9'; + +export default class WsInteractionCreateListener extends BushListener { + public constructor() { + super('wsInteractionCreate', { + emitter: 'ws', + event: GatewayDispatchEvents.InteractionCreate, + category: 'ws' + }); + } + + public override async exec(interaction: any) { + // console.dir(interaction); + + if (interaction.type === 5) { + await this.client.rest.post(Routes.interactionCallback(interaction.id, interaction.token), { + body: { + type: 6 + } + }); + } + } +} |