fix(bot): Add entitlements to interactions (#4198)

* Add entitlements to interactions

* fix type error
This commit is contained in:
Fleny
2025-05-23 23:54:21 +02:00
committed by GitHub
parent 2eace55b9b
commit 17dc876a9e
3 changed files with 5 additions and 0 deletions

View File

@@ -418,6 +418,7 @@ export function createDesiredPropertiesObject<T extends RecursivePartial<Transfo
data: defaultValue,
locale: defaultValue,
guildLocale: defaultValue,
entitlements: defaultValue,
appPermissions: defaultValue,
authorizingIntegrationOwners: defaultValue,
context: defaultValue,

View File

@@ -148,6 +148,8 @@ export function transformInteraction(
if (props.channelId && payload.interaction.channel_id) interaction.channelId = bot.transformers.snowflake(payload.interaction.channel_id)
if (props.member && guildId && payload.interaction.member)
interaction.member = bot.transformers.member(bot, payload.interaction.member, guildId, user.id)
if (props.entitlements && payload.interaction.entitlements)
interaction.entitlements = payload.interaction.entitlements.map((e) => bot.transformers.entitlement(bot, e))
if (props.authorizingIntegrationOwners && payload.interaction.authorizing_integration_owners) {
interaction.authorizingIntegrationOwners = {}

View File

@@ -918,6 +918,8 @@ export interface Interaction {
locale?: string
/** The guild's preferred locale, if invoked in a guild */
guildLocale?: string
/** For monetized apps, any entitlements for the invoking user, representing access to premium SKUs */
entitlements: Entitlement[]
/** The computed permissions for a bot or app in the context of a specific interaction (including channel overwrites) */
appPermissions: bigint
/** Mapping of installation contexts that the interaction was authorized for to related user or guild IDs. */