From 939cb93700ef1dd62a48c9999d46aef68f310756 Mon Sep 17 00:00:00 2001 From: LTS20050703 <87189679+lts20050703@users.noreply.github.com> Date: Fri, 13 May 2022 01:21:51 +0700 Subject: [PATCH] update DiscordInteractionData interface (#2208) * update DiscordInteractionData interface add guildId add type also update interaction transformers * revert re-order changes Co-authored-by: ITOH --- transformers/interaction.ts | 1 + types/discord.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/transformers/interaction.ts b/transformers/interaction.ts index b8056cf14..eb8f8292f 100644 --- a/transformers/interaction.ts +++ b/transformers/interaction.ts @@ -47,6 +47,7 @@ export function transformInteraction(bot: Bot, payload: DiscordInteraction) { : undefined, options: payload.data.options?.map((opt) => bot.transformers.interactionDataOptions(bot, opt)), targetId: payload.data.target_id ? bot.transformers.snowflake(payload.data.target_id) : undefined, + guildId: payload.data.guild_id ? bot.transformers.snowflake(payload.data.guild_id) : undefined, } : undefined, }; diff --git a/types/discord.ts b/types/discord.ts index 89a27375c..6ce3413f6 100644 --- a/types/discord.ts +++ b/types/discord.ts @@ -1275,6 +1275,7 @@ export interface DiscordInteraction { version: 1; /** For the message the button was attached to */ message?: DiscordMessage; + /** the command data payload */ data?: DiscordInteractionData; /** The selected language of the invoking user */ locale?: string; @@ -1301,6 +1302,8 @@ export interface DiscordInteractionData { id: string; /** The name of the invoked command */ name: string; + /** the type of the invoked command */ + type: ApplicationCommandTypes; /** Converted users + roles + channels + attachments */ resolved?: { /** The Ids and Message objects */ @@ -1320,6 +1323,8 @@ export interface DiscordInteractionData { options?: DiscordInteractionDataOption[]; /** The target id if this is a context menu command. */ target_id?: string; + /** the id of the guild the command is registered to */ + guild_id?: string; } export type DiscordInteractionDataOption = {