From da0590120f19707c3fe936d397fb867e78e815ff Mon Sep 17 00:00:00 2001 From: DeveloperDragon <42499964+TotoTheDragon@users.noreply.github.com> Date: Sun, 9 Apr 2023 23:59:49 +0200 Subject: [PATCH] feat(bot): add `Interaction.data.type` for Command interactions (#2987) * Add type property to data * Add back type I accidentally removed --------- Co-authored-by: ITOH --- packages/bot/src/transformers/interaction.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/bot/src/transformers/interaction.ts b/packages/bot/src/transformers/interaction.ts index 636a804c7..5be8cbcd1 100644 --- a/packages/bot/src/transformers/interaction.ts +++ b/packages/bot/src/transformers/interaction.ts @@ -1,5 +1,6 @@ import type { ApplicationCommandOptionTypes, + ApplicationCommandTypes, ChannelTypes, DiscordInteraction, DiscordInteractionDataOption, @@ -38,6 +39,7 @@ export interface Interaction { message?: Message /** the command data payload */ data?: { + type?: ApplicationCommandTypes componentType?: MessageComponentTypes customId?: string components?: Component[] @@ -79,6 +81,7 @@ export function transformInteraction(bot: Bot, payload: DiscordInteraction): Int if (payload.member && guildId && props.member) interaction.member = bot.transformers.member(bot, payload.member, guildId, user.id) if (payload.data && props.data) { interaction.data = { + type: payload.data.type, componentType: payload.data.component_type, customId: payload.data.custom_id, components: payload.data.components?.map((component) => bot.transformers.component(bot, component)),