mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 18:43:31 +01:00
types: More accurate types instead of GuildChannelResolvable (#6744)
This commit is contained in:
@@ -38,6 +38,18 @@ class GuildInviteManager extends CachedManager {
|
|||||||
* @typedef {string} InviteResolvable
|
* @typedef {string} InviteResolvable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data that can be resolved to a channel that an invite can be created on. This can be:
|
||||||
|
* * TextChannel
|
||||||
|
* * VoiceChannel
|
||||||
|
* * NewsChannel
|
||||||
|
* * StoreChannel
|
||||||
|
* * StageChannel
|
||||||
|
* * Snowflake
|
||||||
|
* @typedef {TextChannel|VoiceChannel|NewsChannel|StoreChannel|StageChannel|Snowflake}
|
||||||
|
* GuildInvitableChannelResolvable
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves an InviteResolvable to an Invite object.
|
* Resolves an InviteResolvable to an Invite object.
|
||||||
* @method resolve
|
* @method resolve
|
||||||
@@ -67,7 +79,8 @@ class GuildInviteManager extends CachedManager {
|
|||||||
/**
|
/**
|
||||||
* Options used to fetch all invites from a guild.
|
* Options used to fetch all invites from a guild.
|
||||||
* @typedef {Object} FetchInvitesOptions
|
* @typedef {Object} FetchInvitesOptions
|
||||||
* @property {GuildChannelResolvable} [channelId] The channel to fetch all invites from
|
* @property {GuildInvitableChannelResolvable} [channelId]
|
||||||
|
* The channel to fetch all invites from
|
||||||
* @property {boolean} [cache=true] Whether or not to cache the fetched invites
|
* @property {boolean} [cache=true] Whether or not to cache the fetched invites
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -153,7 +166,7 @@ class GuildInviteManager extends CachedManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an invite to the guild from the provided channel.
|
* Create an invite to the guild from the provided channel.
|
||||||
* @param {GuildChannelResolvable} channel The options for creating the invite from a channel.
|
* @param {GuildInvitableChannelResolvable} channel The options for creating the invite from a channel.
|
||||||
* @param {CreateInviteOptions} [options={}] The options for creating the invite from a channel.
|
* @param {CreateInviteOptions} [options={}] The options for creating the invite from a channel.
|
||||||
* @returns {Promise<Invite>}
|
* @returns {Promise<Invite>}
|
||||||
* @example
|
* @example
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const { Error } = require('../errors');
|
|||||||
class NewsChannel extends BaseGuildTextChannel {
|
class NewsChannel extends BaseGuildTextChannel {
|
||||||
/**
|
/**
|
||||||
* Adds the target to this channel's followers.
|
* Adds the target to this channel's followers.
|
||||||
* @param {GuildChannelResolvable} channel The channel where the webhook should be created
|
* @param {TextChannelResolvable} channel The channel where the webhook should be created
|
||||||
* @param {string} [reason] Reason for creating the webhook
|
* @param {string} [reason] Reason for creating the webhook
|
||||||
* @returns {Promise<NewsChannel>}
|
* @returns {Promise<NewsChannel>}
|
||||||
* @example
|
* @example
|
||||||
|
|||||||
14
typings/index.d.ts
vendored
14
typings/index.d.ts
vendored
@@ -1524,7 +1524,7 @@ export class MessageSelectMenu extends BaseMessageComponent {
|
|||||||
export class NewsChannel extends BaseGuildTextChannel {
|
export class NewsChannel extends BaseGuildTextChannel {
|
||||||
public threads: ThreadManager<AllowedThreadTypeForNewsChannel>;
|
public threads: ThreadManager<AllowedThreadTypeForNewsChannel>;
|
||||||
public type: 'GUILD_NEWS';
|
public type: 'GUILD_NEWS';
|
||||||
public addFollower(channel: GuildChannelResolvable, reason?: string): Promise<NewsChannel>;
|
public addFollower(channel: TextChannelResolvable, reason?: string): Promise<NewsChannel>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OAuth2Guild extends BaseGuild {
|
export class OAuth2Guild extends BaseGuild {
|
||||||
@@ -2664,7 +2664,7 @@ export class GuildBanManager extends CachedManager<Snowflake, GuildBan, GuildBan
|
|||||||
export class GuildInviteManager extends DataManager<string, Invite, InviteResolvable> {
|
export class GuildInviteManager extends DataManager<string, Invite, InviteResolvable> {
|
||||||
public constructor(guild: Guild, iterable?: Iterable<RawInviteData>);
|
public constructor(guild: Guild, iterable?: Iterable<RawInviteData>);
|
||||||
public guild: Guild;
|
public guild: Guild;
|
||||||
public create(channel: GuildChannelResolvable, options?: CreateInviteOptions): Promise<Invite>;
|
public create(channel: GuildInvitableChannelResolvable, options?: CreateInviteOptions): Promise<Invite>;
|
||||||
public fetch(options: InviteResolvable | FetchInviteOptions): Promise<Invite>;
|
public fetch(options: InviteResolvable | FetchInviteOptions): Promise<Invite>;
|
||||||
public fetch(options?: FetchInvitesOptions): Promise<Collection<string, Invite>>;
|
public fetch(options?: FetchInvitesOptions): Promise<Collection<string, Invite>>;
|
||||||
public delete(invite: InviteResolvable, reason?: string): Promise<Invite>;
|
public delete(invite: InviteResolvable, reason?: string): Promise<Invite>;
|
||||||
@@ -3836,7 +3836,7 @@ interface FetchInviteOptions extends BaseFetchOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface FetchInvitesOptions {
|
interface FetchInvitesOptions {
|
||||||
channelId?: GuildChannelResolvable;
|
channelId?: GuildInvitableChannelResolvable;
|
||||||
cache?: boolean;
|
cache?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4222,6 +4222,14 @@ export interface InviteGenerationOptions {
|
|||||||
scopes: InviteScope[];
|
scopes: InviteScope[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GuildInvitableChannelResolvable =
|
||||||
|
| TextChannel
|
||||||
|
| VoiceChannel
|
||||||
|
| NewsChannel
|
||||||
|
| StoreChannel
|
||||||
|
| StageChannel
|
||||||
|
| Snowflake;
|
||||||
|
|
||||||
export interface CreateInviteOptions {
|
export interface CreateInviteOptions {
|
||||||
temporary?: boolean;
|
temporary?: boolean;
|
||||||
maxAge?: number;
|
maxAge?: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user