From 0f29b32e05abe89f70f72989024b9c63493782fa Mon Sep 17 00:00:00 2001 From: Advaith Date: Mon, 15 Mar 2021 16:00:04 -0700 Subject: [PATCH] feat(APIMessage): add `interaction` (#93) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Vlad Frangu --- deno/v8/payloads/channel.ts | 5 +++++ deno/v8/payloads/interactions.ts | 22 ++++++++++++++++++++++ v8/payloads/channel.ts | 5 +++++ v8/payloads/interactions.ts | 22 ++++++++++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/deno/v8/payloads/channel.ts b/deno/v8/payloads/channel.ts index b92fda41..10f141d3 100644 --- a/deno/v8/payloads/channel.ts +++ b/deno/v8/payloads/channel.ts @@ -5,6 +5,7 @@ import type { Permissions, Snowflake } from '../../common/mod.ts'; import type { APIPartialEmoji } from './emoji.ts'; import type { APIGuildMember } from './guild.ts'; +import type { APIMessageInteraction } from './interactions.ts'; import type { APIRole } from './permissions.ts'; import type { APIUser } from './user.ts'; @@ -307,6 +308,10 @@ export interface APIMessage { * See https://discord.com/developers/docs/resources/channel#message-object */ referenced_message?: APIMessage | null; + /** + * Sent if the message is a response to an Interaction + */ + interaction?: APIMessageInteraction; } /** diff --git a/deno/v8/payloads/interactions.ts b/deno/v8/payloads/interactions.ts index addb8486..822c44a9 100644 --- a/deno/v8/payloads/interactions.ts +++ b/deno/v8/payloads/interactions.ts @@ -245,6 +245,28 @@ export type APIInteractionApplicationCommandCallbackData = Omit< 'username' | 'avatar_url' > & { flags?: MessageFlags }; +/** + * https://discord.com/developers/docs/interactions/slash-commands#messageinteraction + */ +export interface APIMessageInteraction { + /** + * ID of the interaction + */ + id: Snowflake; + /** + * The type of interaction + */ + type: InteractionType; + /** + * The name of the ApplicationCommand + */ + name: string; + /** + * The user who invoked the interaction + */ + user: APIUser; +} + /** * @internal */ diff --git a/v8/payloads/channel.ts b/v8/payloads/channel.ts index 7ede6d2c..3caef012 100644 --- a/v8/payloads/channel.ts +++ b/v8/payloads/channel.ts @@ -5,6 +5,7 @@ import type { Permissions, Snowflake } from '../../common/index'; import type { APIPartialEmoji } from './emoji'; import type { APIGuildMember } from './guild'; +import type { APIMessageInteraction } from './interactions'; import type { APIRole } from './permissions'; import type { APIUser } from './user'; @@ -307,6 +308,10 @@ export interface APIMessage { * See https://discord.com/developers/docs/resources/channel#message-object */ referenced_message?: APIMessage | null; + /** + * Sent if the message is a response to an Interaction + */ + interaction?: APIMessageInteraction; } /** diff --git a/v8/payloads/interactions.ts b/v8/payloads/interactions.ts index 1df78792..7ba79fd6 100644 --- a/v8/payloads/interactions.ts +++ b/v8/payloads/interactions.ts @@ -245,6 +245,28 @@ export type APIInteractionApplicationCommandCallbackData = Omit< 'username' | 'avatar_url' > & { flags?: MessageFlags }; +/** + * https://discord.com/developers/docs/interactions/slash-commands#messageinteraction + */ +export interface APIMessageInteraction { + /** + * ID of the interaction + */ + id: Snowflake; + /** + * The type of interaction + */ + type: InteractionType; + /** + * The name of the ApplicationCommand + */ + name: string; + /** + * The user who invoked the interaction + */ + user: APIUser; +} + /** * @internal */