diff --git a/packages/core/src/structures/channels.ts b/packages/core/src/structures/channels.ts index e7cb35b..b6e36ee 100644 --- a/packages/core/src/structures/channels.ts +++ b/packages/core/src/structures/channels.ts @@ -527,6 +527,12 @@ export interface ReturnThreadsArchive { hasMore: boolean; } +/** + * Represents a GuildChannel. + * @extends BaseChannel + * @see {@link BaseChannel} + * @link https://discord.com/developers/docs/resources/channel#channel-object + */ export class GuildChannel extends BaseChannel implements Model { constructor(session: Session, data: DiscordChannel, guildId: Snowflake) { super(session, data); @@ -540,19 +546,32 @@ export class GuildChannel extends BaseChannel implements Model { : []; } + /** Channel type. */ override type: Exclude; + /** Guild id. */ guildId: Snowflake; + /** Channel topic */ topic?: string; + /** Sorting position of the channel */ position?: number; + /** Id of the parent category for a channel (each parent category can contain up to 50 channels). */ parentId?: Snowflake; + /** Explicit permission overwrites for members and roles */ permissionOverwrites: PermissionsOverwrites[]; + /** + * Gets the channel invites for the channel. + */ async fetchInvites(): Promise { const invites = await this.session.rest.get(CHANNEL_INVITES(this.id)); return invites.map(invite => new Invite(this.session, invite)); } + /** + * Edits the channel. + * @param options - Options for edit the channel. + */ async edit(options: EditNewsChannelOptions): Promise; async edit(options: EditStageChannelOptions): Promise; async edit(options: EditVoiceChannelOptions): Promise; @@ -582,6 +601,10 @@ export class GuildChannel extends BaseChannel implements Model { return ChannelFactory.from(this.session, channel); } + /** + * Gets the channel archived threads. + * @param options - Options for select the archved threads. + */ async getArchivedThreads( options: ListArchivedThreads & { type: 'public' | 'private' | 'privateJoinedThreads' }, ): Promise { @@ -614,6 +637,10 @@ export class GuildChannel extends BaseChannel implements Model { }; } + /** + * Creates a new thread in the channel. + * @param options - Options for create a thread channel. + */ async createThread(options: ThreadCreateOptions): Promise { const thread = await this.session.rest.post( 'messageId' in options @@ -628,6 +655,10 @@ export class GuildChannel extends BaseChannel implements Model { return new ThreadChannel(this.session, thread, thread.guild_id ?? this.guildId); } + /** + * Sets the channel's permissions overwrites. Same as GuildChannel.edit({ permissionOverwrites: ... }). + * @param overwrites - The overwrites to add to the channel. + */ async setPermissions(overwrites: PermissionsOverwrites[]): Promise { return this.edit({ permissionOverwrites: overwrites } as EditGuildChannelOptions) }