update DiscordInteractionData interface (#2208)

* update DiscordInteractionData interface
add guildId
add type
also update interaction transformers

* revert re-order changes

Co-authored-by: ITOH <to@itoh.at>
This commit is contained in:
LTS20050703
2022-05-12 14:21:51 -04:00
committed by GitHub
co-authored by ITOH
parent a72ded7615
commit 939cb93700
2 changed files with 6 additions and 0 deletions
+1
View File
@@ -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,
};
+5
View File
@@ -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 = {