mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
types: Implement GuildChannelEditOptions (#8184)
This commit is contained in:
@@ -199,8 +199,8 @@ class GuildChannelManager extends CachedManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* The data for a guild channel.
|
||||
* @typedef {Object} ChannelData
|
||||
* Options used to edit a guild channel.
|
||||
* @typedef {Object} GuildChannelEditOptions
|
||||
* @property {string} [name] The name of the channel
|
||||
* @property {ChannelType} [type] The type of the channel (only conversion between text and news is supported)
|
||||
* @property {number} [position] The position of the channel
|
||||
@@ -224,7 +224,7 @@ class GuildChannelManager extends CachedManager {
|
||||
/**
|
||||
* Edits the channel.
|
||||
* @param {GuildChannelResolvable} channel The channel to edit
|
||||
* @param {ChannelData} data The new data for the channel
|
||||
* @param {GuildChannelEditOptions} data Options for editing the channel
|
||||
* @returns {Promise<GuildChannel>}
|
||||
* @example
|
||||
* // Edit a channel
|
||||
|
||||
@@ -264,7 +264,7 @@ class GuildChannel extends BaseChannel {
|
||||
|
||||
/**
|
||||
* Edits the channel.
|
||||
* @param {ChannelEditData} data The new data for the channel
|
||||
* @param {GuildChannelEditOptions} data The new data for the channel
|
||||
* @returns {Promise<GuildChannel>}
|
||||
* @example
|
||||
* // Edit a channel
|
||||
|
||||
43
packages/discord.js/typings/index.d.ts
vendored
43
packages/discord.js/typings/index.d.ts
vendored
@@ -1248,7 +1248,7 @@ export abstract class GuildChannel extends BaseChannel {
|
||||
public get viewable(): boolean;
|
||||
public clone(options?: GuildChannelCloneOptions): Promise<this>;
|
||||
public delete(reason?: string): Promise<this>;
|
||||
public edit(data: ChannelEditData): Promise<this>;
|
||||
public edit(data: GuildChannelEditOptions): Promise<this>;
|
||||
public equals(channel: GuildChannel): boolean;
|
||||
public lockPermissions(): Promise<this>;
|
||||
public permissionsFor(memberOrRole: GuildMember | Role, checkAdmin?: boolean): Readonly<PermissionsBitField>;
|
||||
@@ -3330,7 +3330,7 @@ export class GuildChannelManager extends CachedManager<Snowflake, GuildBasedChan
|
||||
): Promise<MappedGuildChannelTypes[T]>;
|
||||
public create(options: GuildChannelCreateOptions): Promise<TextChannel>;
|
||||
public createWebhook(options: WebhookCreateOptions): Promise<Webhook>;
|
||||
public edit(channel: GuildChannelResolvable, data: ChannelEditData): Promise<GuildChannel>;
|
||||
public edit(channel: GuildChannelResolvable, data: GuildChannelEditOptions): Promise<GuildChannel>;
|
||||
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<NonThreadGuildBasedChannel | null>;
|
||||
public fetch(id?: undefined, options?: BaseFetchOptions): Promise<Collection<Snowflake, NonThreadGuildBasedChannel>>;
|
||||
public fetchWebhooks(channel: GuildChannelResolvable): Promise<Collection<Snowflake, Webhook>>;
|
||||
@@ -4011,27 +4011,6 @@ export interface ChannelCreationOverwrites {
|
||||
id: RoleResolvable | UserResolvable;
|
||||
}
|
||||
|
||||
export interface ChannelData {
|
||||
name?: string;
|
||||
type?: ChannelType.GuildText | ChannelType.GuildNews;
|
||||
position?: number;
|
||||
topic?: string | null;
|
||||
nsfw?: boolean;
|
||||
bitrate?: number;
|
||||
userLimit?: number;
|
||||
parent?: CategoryChannelResolvable | null;
|
||||
rateLimitPerUser?: number;
|
||||
lockPermissions?: boolean;
|
||||
permissionOverwrites?: readonly OverwriteResolvable[] | Collection<Snowflake, OverwriteResolvable>;
|
||||
defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
|
||||
rtcRegion?: string | null;
|
||||
videoQualityMode?: VideoQualityMode | null;
|
||||
}
|
||||
|
||||
export interface ChannelEditData extends ChannelData {
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
export type ChannelMention = `<#${Snowflake}>`;
|
||||
|
||||
export interface ChannelPosition {
|
||||
@@ -4681,6 +4660,24 @@ export interface GuildChannelCloneOptions extends Omit<GuildChannelCreateOptions
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export interface GuildChannelEditOptions {
|
||||
name?: string;
|
||||
type?: ChannelType.GuildText | ChannelType.GuildNews;
|
||||
position?: number;
|
||||
topic?: string | null;
|
||||
nsfw?: boolean;
|
||||
bitrate?: number;
|
||||
userLimit?: number;
|
||||
parent?: CategoryChannelResolvable | null;
|
||||
rateLimitPerUser?: number;
|
||||
lockPermissions?: boolean;
|
||||
permissionOverwrites?: readonly OverwriteResolvable[] | Collection<Snowflake, OverwriteResolvable>;
|
||||
defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
|
||||
rtcRegion?: string | null;
|
||||
videoQualityMode?: VideoQualityMode | null;
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
export interface GuildChannelOverwriteOptions {
|
||||
reason?: string;
|
||||
type?: number;
|
||||
|
||||
Reference in New Issue
Block a user