feat: add app_permissions to channel resolved data (#5185)

This commit is contained in:
Fleny
2026-07-29 11:21:22 +05:30
committed by GitHub
parent 37610a3efd
commit b481d0a96e
5 changed files with 15 additions and 1 deletions
+1
View File
@@ -294,6 +294,7 @@ export function createDesiredPropertiesObject<T extends RecursivePartial<Transfo
permissionOverwrites: defaultValue,
id: defaultValue,
permissions: defaultValue,
appPermissions: defaultValue,
lastMessageId: defaultValue,
ownerId: defaultValue,
applicationId: defaultValue,
+1
View File
@@ -104,6 +104,7 @@ export function transformChannel(bot: Bot, payload: DiscordChannel, extra?: { gu
if (props.defaultAutoArchiveDuration && payload.default_auto_archive_duration)
channel.defaultAutoArchiveDuration = payload.default_auto_archive_duration;
if (props.permissions && payload.permissions) channel.permissions = new Permissions(payload.permissions);
if (props.appPermissions && payload.app_permissions) channel.appPermissions = new Permissions(payload.app_permissions);
if (props.flags) channel.flags = payload.flags;
if (props.permissionOverwrites && payload.permission_overwrites)
channel.internalOverwrites = payload.permission_overwrites.map((o) => packOverwrites(o.allow ?? '0', o.deny ?? '0', o.id, o.type));
+2
View File
@@ -503,6 +503,8 @@ export interface Channel {
defaultAutoArchiveDuration?: number;
/** computed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on an interaction. This does not include implicit permissions, which may need to be checked separately. */
permissions?: Permissions;
/**computed permissions for the bot user in the channel, including overwrites, only included when part of the resolved data received on an interaction. This does not include implicit permissions, which may need to be checked separately */
appPermissions?: Permissions;
/** The flags of the channel */
flags?: number;
/**
+10 -1
View File
@@ -106,11 +106,20 @@ export interface DiscordChannel extends Partial<DiscordThreadCreateExtra> {
* Computed permissions for the invoking user in the channel.
*
* @remarks
* The computed permissions include channel overwrites but does not include implicit permissions, those need to be checked separatly.
* This does not include implicit permissions, which may need to be checked separately
*
* Only presented when part of `resolved` data received on an interaction.
*/
permissions?: string;
/**
* computed permissions for the bot user in the channel, including overwrites.
*
* @remarks
* This does not include implicit permissions, which may need to be checked separately
*
* Only included when part of the `resolved` data received on an interaction.
*/
app_permissions?: string;
/** The flags of the channel */
flags?: ChannelFlags;
/** number of messages ever sent in a thread, it's similar to `message_count` on message creation, but will not decrement the number when a message is deleted */
@@ -156,6 +156,7 @@ export interface DiscordInteractionDataResolved {
| 'name'
| 'type'
| 'permissions'
| 'app_permissions'
| 'last_message_id'
| 'last_pin_timestamp'
| 'nsfw'