Skip to content

Commit

Permalink
Add name to interaction metadata
Browse files Browse the repository at this point in the history
discord/discord-api-docs#6734
Couldn't have been 2 hours earlier, huh. I had to make my release first
  • Loading branch information
DonovanDMC committed Mar 19, 2024
1 parent f6d78c2 commit 76894e9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/structures/Application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class Application extends ClientApplication {
customInstallURL?: string;
/** The description of the application. */
description: string;
/** If this application is a game sold on Discord, the guild to which it has been linked. This will only be present if recieved via `/applications/@me` {@link REST/Miscellaneous.getApplication | Miscellaneous#getApplication}). */
/** If this application is a game sold on Discord, the guild to which it has been linked. This will only be present if recieved via {@link REST/Applications.getCurrent | `/applications/@me`}. */
guild: OAuthGuild | null;
/** If this application is a game sold on Discord, the ID of the guild to which it has been linked. */
guildID: string | null;
Expand Down
2 changes: 2 additions & 0 deletions lib/structures/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ export default class Message<T extends AnyTextableChannel | Uncached = AnyTextab
authorizingIntegrationOwners: data.interaction_metadata.authorizing_integration_owners,
id: data.interaction_metadata.id,
interactedMessageID: data.interaction_metadata.interacted_message_id,
name: data.interaction_metadata.name,
originalResponseMessageID: data.interaction_metadata.original_response_message_id,
type: data.interaction_metadata.type,
user: this.client.users.get(data.interaction_metadata.user_id) || { id: data.interaction_metadata.user_id },
Expand Down Expand Up @@ -474,6 +475,7 @@ export default class Message<T extends AnyTextableChannel | Uncached = AnyTextab
interactionMetadata: this.interactionMetadata === undefined ? undefined : {
id: this.interactionMetadata.id,
interactedMessageID: this.interactionMetadata.interactedMessageID,
name: this.interactionMetadata.name,
originalResponseMessageID: this.interactionMetadata.originalResponseMessageID,
type: this.interactionMetadata.type,
user: this.interactionMetadata.user instanceof User ? this.interactionMetadata.user.toJSON() : this.interactionMetadata.user,
Expand Down
9 changes: 8 additions & 1 deletion lib/types/channels.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,18 +759,25 @@ export interface RawMessageInteractionMetadata {
authorizing_integration_owners: AuthorizingIntegrationOwners;
id: string;
interacted_message_id?: string;
name?: string;
original_response_message_id?: string;
triggering_interaction_metadata?: Omit<RawMessageInteractionMetadata, "triggering_interaction_metadata">;
type: InteractionTypes;
user_id: string;
}

export interface MessageInteractionMetadata {
/** Details about the authorizing user or server for the installation(s) relevant to the interaction. See [Discord's docs](https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) for more information. */
authorizingIntegrationOwners: AuthorizingIntegrationOwners;
id: string;
/** The ID of the message that contained interactive component, present only on messages created from component interactions */
interactedMessageID?: string;
/** Name of the command, including subcommands and subcommand groups, present only on application command interactions. */
name?: string;
/** The ID of the original response message, present only on follow-up messages. */
originalResponseMessageID?: string;
triggeringInteractionMetadata?: Omit<MessageInteractionMetadata, "triggeringInteractionMetadata">;
/** Metadata for the interaction that was used to open the modal, present only on modal submit interactions. */
triggeringInteractionMetadata?: Omit<MessageInteractionMetadata, "triggeringInteractionMetadata" | "name">;
type: InteractionTypes;
user: User | Uncached;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/types/gateway.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ interface GatewayOptions {
*/
reconnectDelay?: ReconnectDelayFunction;
/**
* If a check should be made before connecting, which will remove any disallowed intents. This requires making a request to {@link REST/Miscellaneous.getApplication | `/applications/@me`}. Any removed intents will be emitted via the `warn` event.
* If a check should be made before connecting, which will remove any disallowed intents. This requires making a request to {@link REST/MApplications.getCurrent | `/applications/@me`}. Any removed intents will be emitted via the `warn` event.
* @defaultValue false
*/
removeDisallowedIntents?: boolean;
Expand Down
1 change: 1 addition & 0 deletions lib/types/json.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ export interface JSONMessage extends JSONBase {
authorizingIntegrationOwners: AuthorizingIntegrationOwners;
id: string;
interactedMessageID?: string;
name?: string;
originalResponseMessageID?: string;
triggeringInteractionMetadata?: {
authorizingIntegrationOwners: AuthorizingIntegrationOwners;
Expand Down

0 comments on commit 76894e9

Please sign in to comment.