feat(bot,types)!: Replace userId with User object in interactionMetadata (#3627)

* Replace userId with User object in interactionMetadata

* Fix type error

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
This commit is contained in:
Fleny
2024-05-26 19:36:48 +00:00
committed by GitHub
co-authored by Awesome Stickz
parent 5290078044
commit ad7e74c4cd
3 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -366,7 +366,7 @@ export interface Transformers {
interactionMetadata: {
id: boolean
type: boolean
userId: boolean
user: boolean
authorizingIntegrationOwners: boolean
originalResponseMessageId: boolean
interactedMessageId: boolean
@@ -984,7 +984,7 @@ export function createTransformers(options: Partial<Transformers>, opts?: Create
interactionMetadata: {
id: opts?.defaultDesiredPropertiesValue ?? false,
type: opts?.defaultDesiredPropertiesValue ?? false,
userId: opts?.defaultDesiredPropertiesValue ?? false,
user: opts?.defaultDesiredPropertiesValue ?? false,
authorizingIntegrationOwners: opts?.defaultDesiredPropertiesValue ?? false,
originalResponseMessageId: opts?.defaultDesiredPropertiesValue ?? false,
interactedMessageId: opts?.defaultDesiredPropertiesValue ?? false,
+3 -3
View File
@@ -417,7 +417,7 @@ export function transformMessageInteractionMetadata(bot: Bot, payload: DiscordMe
if (props.triggeringInteractionMetadata && payload.triggering_interaction_metadata)
metadata.triggeringInteractionMetadata = transformMessageInteractionMetadata(bot, payload.triggering_interaction_metadata)
if (props.type) metadata.type = payload.type
if (props.userId) metadata.userId = bot.transformers.snowflake(payload.user_id)
if (props.user && payload.user) metadata.user = bot.transformers.user(bot, payload.user)
return bot.transformers.customizers.messageInteractionMetadata(bot, payload, metadata)
}
@@ -437,8 +437,8 @@ export interface MessageInteractionMetadata {
id: bigint
/** The type of interaction */
type: InteractionTypes
/** ID of the user who triggered the interaction */
userId: bigint
/** User who triggered the interaction */
user: User
/** IDs for installation context(s) related to an interaction */
authorizingIntegrationOwners: Partial<Record<DiscordApplicationIntegrationType, bigint>>
/** ID of the original response message, present only on follow-up messages */
+2 -2
View File
@@ -1612,8 +1612,8 @@ export interface DiscordMessageInteractionMetadata {
id: string
/** The type of interaction */
type: InteractionTypes
/** ID of the user who triggered the interaction */
user_id: string
/** User who triggered the interaction */
user: DiscordUser
/** IDs for installation context(s) related to an interaction */
authorizing_integration_owners: Partial<Record<DiscordApplicationIntegrationType, string>>
/** ID of the original response message, present only on follow-up messages */