mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
Update GuildChannel docs
This commit is contained in:
parent
9ed913a821
commit
147d13f403
@ -527,6 +527,12 @@ export interface ReturnThreadsArchive {
|
|||||||
hasMore: boolean;
|
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 {
|
export class GuildChannel extends BaseChannel implements Model {
|
||||||
constructor(session: Session, data: DiscordChannel, guildId: Snowflake) {
|
constructor(session: Session, data: DiscordChannel, guildId: Snowflake) {
|
||||||
super(session, data);
|
super(session, data);
|
||||||
@ -540,19 +546,32 @@ export class GuildChannel extends BaseChannel implements Model {
|
|||||||
: [];
|
: [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Channel type. */
|
||||||
override type: Exclude<ChannelTypes, ChannelTypes.DM | ChannelTypes.GroupDm>;
|
override type: Exclude<ChannelTypes, ChannelTypes.DM | ChannelTypes.GroupDm>;
|
||||||
|
/** Guild id. */
|
||||||
guildId: Snowflake;
|
guildId: Snowflake;
|
||||||
|
/** Channel topic */
|
||||||
topic?: string;
|
topic?: string;
|
||||||
|
/** Sorting position of the channel */
|
||||||
position?: number;
|
position?: number;
|
||||||
|
/** Id of the parent category for a channel (each parent category can contain up to 50 channels). */
|
||||||
parentId?: Snowflake;
|
parentId?: Snowflake;
|
||||||
|
/** Explicit permission overwrites for members and roles */
|
||||||
permissionOverwrites: PermissionsOverwrites[];
|
permissionOverwrites: PermissionsOverwrites[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the channel invites for the channel.
|
||||||
|
*/
|
||||||
async fetchInvites(): Promise<Invite[]> {
|
async fetchInvites(): Promise<Invite[]> {
|
||||||
const invites = await this.session.rest.get<DiscordInviteMetadata[]>(CHANNEL_INVITES(this.id));
|
const invites = await this.session.rest.get<DiscordInviteMetadata[]>(CHANNEL_INVITES(this.id));
|
||||||
|
|
||||||
return invites.map(invite => new Invite(this.session, invite));
|
return invites.map(invite => new Invite(this.session, invite));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edits the channel.
|
||||||
|
* @param options - Options for edit the channel.
|
||||||
|
*/
|
||||||
async edit(options: EditNewsChannelOptions): Promise<NewsChannel>;
|
async edit(options: EditNewsChannelOptions): Promise<NewsChannel>;
|
||||||
async edit(options: EditStageChannelOptions): Promise<StageChannel>;
|
async edit(options: EditStageChannelOptions): Promise<StageChannel>;
|
||||||
async edit(options: EditVoiceChannelOptions): Promise<VoiceChannel>;
|
async edit(options: EditVoiceChannelOptions): Promise<VoiceChannel>;
|
||||||
@ -582,6 +601,10 @@ export class GuildChannel extends BaseChannel implements Model {
|
|||||||
return ChannelFactory.from(this.session, channel);
|
return ChannelFactory.from(this.session, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the channel archived threads.
|
||||||
|
* @param options - Options for select the archved threads.
|
||||||
|
*/
|
||||||
async getArchivedThreads(
|
async getArchivedThreads(
|
||||||
options: ListArchivedThreads & { type: 'public' | 'private' | 'privateJoinedThreads' },
|
options: ListArchivedThreads & { type: 'public' | 'private' | 'privateJoinedThreads' },
|
||||||
): Promise<ReturnThreadsArchive> {
|
): Promise<ReturnThreadsArchive> {
|
||||||
@ -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<ThreadChannel> {
|
async createThread(options: ThreadCreateOptions): Promise<ThreadChannel> {
|
||||||
const thread = await this.session.rest.post<DiscordChannel>(
|
const thread = await this.session.rest.post<DiscordChannel>(
|
||||||
'messageId' in options
|
'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);
|
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<Channel> {
|
async setPermissions(overwrites: PermissionsOverwrites[]): Promise<Channel> {
|
||||||
return this.edit({ permissionOverwrites: overwrites } as EditGuildChannelOptions)
|
return this.edit({ permissionOverwrites: overwrites } as EditGuildChannelOptions)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user