fix(types)!: Fix discordeno/channel.ts (#4355)

This commit is contained in:
Fleny
2025-08-15 22:09:56 -04:00
committed by GitHub
parent 5de802e352
commit 84087917ef
2 changed files with 19 additions and 13 deletions
+2 -2
View File
@@ -49,7 +49,7 @@ import type {
MessageTypes,
MfaLevels,
OAuth2Scope,
OverwriteReadable,
Overwrite,
PremiumTiers,
PremiumTypes,
PresenceStatus,
@@ -467,7 +467,7 @@ export interface Channel {
/** for group DM channels: whether the channel is managed by an application via the `gdm.join` OAuth2 scope */
managed: boolean
/** Explicit permission overwrites for members and roles. */
permissionOverwrites: OverwriteReadable[]
permissionOverwrites: Overwrite[]
}
export interface ForumTag {
+17 -11
View File
@@ -1,6 +1,6 @@
/** Types for: https://discord.com/developers/docs/resources/channel */
import type { ChannelTypes, ForumLayout, OverwriteTypes, SortOrderTypes, VideoQualityModes } from '../discord/channel.js'
import type { ChannelFlags, ChannelTypes, ForumLayout, OverwriteTypes, SortOrderTypes, VideoQualityModes } from '../discord/channel.js'
import type { TargetTypes } from '../discord/invite.js'
import type { DiscordAttachment, DiscordEmbed, MessageFlags } from '../discord/message.js'
import type { PermissionStrings } from '../discord/permissions.js'
@@ -16,11 +16,13 @@ export interface Overwrite {
/** Either 0 (role) or 1 (member) */
type: OverwriteTypes
// We allow PermissionStrings[] because in the rest manager we convert these value to the actual string discord wants
// NOTE:
// - We allow PermissionStrings[] because in the rest manager we convert these value to the actual string discord wants
// - Discord says that these are always present, we keep them as optional (and allow for null) because when it is sent it can be null / not present, https://discord.com/developers/docs/resources/guild#create-guild-channel-json-params, specificly the **
/** Permission bit set */
allow?: PermissionStrings[] | string
allow?: PermissionStrings[] | string | null
/** Permission bit set */
deny?: PermissionStrings[] | string
deny?: PermissionStrings[] | string | null
}
// This needs the prefix Discordeno to avoid conflicts with the @discordeno/bot types.
@@ -47,9 +49,6 @@ export interface DiscordenoForumTag {
emoji_name: string | null
}
/** https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure */
export interface OverwriteReadable extends Overwrite {}
// Since this is a merge of 3 types, the properties appear in order of their first appearance in the 3 types
/**
* - https://discord.com/developers/docs/resources/channel#modify-channel-json-params-group-dm
@@ -146,9 +145,9 @@ export interface ModifyChannel {
* Channel or category-specific permissions
*
* @remarks
* This is only valid when editing a guild channel of any type
* This is valid when editing a guild channel of any type
*/
permissionOverwrites?: OverwriteReadable[] | null
permissionOverwrites?: Overwrite[] | null
/**
* Id of the new parent category for a channel
*
@@ -186,6 +185,8 @@ export interface ModifyChannel {
* - `PINNED` can only be set for threads in {@link ChannelTypes.GuildForum} and {@link ChannelTypes.GuildMedia} channels
*
* This is only valid when editing a guild channel of type {@link ChannelTypes.GuildForum} or {@link ChannelTypes.GuildMedia}, or a thread.
*
* @see {@link ChannelFlags}
*/
flags?: number
/**
@@ -275,6 +276,7 @@ export interface EditChannelPermissionOverridesOptions {
// This is included in here however it is a route parameter
/** Role or user id */
id: BigString
/** Either 0 (role) or 1 (member) */
type: OverwriteTypes
@@ -365,8 +367,12 @@ export interface ForumAndMediaThreadMessage {
stickerIds?: BigString[]
/** Attachment objects with `filename` and `description` */
attachments?: Pick<DiscordAttachment, 'filename' | 'description' | 'id'>[]
/** Message flags combined as a bitfield, only SUPPRESS_EMBEDS, SUPPRESS_NOTIFICATIONS and IS_COMPONENTS_V2 can be set */
flags?: MessageFlags
/**
* Message flags combined as a bitfield, only SUPPRESS_EMBEDS, SUPPRESS_NOTIFICATIONS and IS_COMPONENTS_V2 can be set
*
* @see {@link MessageFlags}
*/
flags?: number
}
/** https://discord.com/developers/docs/resources/channel#get-thread-member-query-string-params */