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 <to@itoh.at>
This commit is contained in:
DeveloperDragon
2023-04-09 21:59:49 +00:00
committed by GitHub
co-authored by ITOH
parent 5638766882
commit da0590120f
@@ -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)),