fix(applicationcommandmanager): explicitly allow passing builders to methods (v13)
v13.9 #8229
This commit is contained in:
parent
0e50134def
commit
1a656854c0
@ -55,6 +55,13 @@ class ApplicationCommandManager extends CachedManager {
|
|||||||
* @typedef {ApplicationCommand|Snowflake} ApplicationCommandResolvable
|
* @typedef {ApplicationCommand|Snowflake} ApplicationCommandResolvable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* eslint-disable max-len */
|
||||||
|
/**
|
||||||
|
* Data that resolves to the data of an ApplicationCommand
|
||||||
|
* @typedef {ApplicationCommandDataResolvable|SlashCommandBuilder|ContextMenuCommandBuilder} ApplicationCommandDataResolvable
|
||||||
|
*/
|
||||||
|
/* eslint-enable max-len */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Options used to fetch data from Discord
|
* Options used to fetch data from Discord
|
||||||
* @typedef {Object} BaseFetchOptions
|
* @typedef {Object} BaseFetchOptions
|
||||||
@ -111,7 +118,7 @@ class ApplicationCommandManager extends CachedManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an application command.
|
* Creates an application command.
|
||||||
* @param {ApplicationCommandData|APIApplicationCommand} command The command
|
* @param {ApplicationCommandDataResolvable} command The command
|
||||||
* @param {Snowflake} [guildId] The guild's id to create this command in,
|
* @param {Snowflake} [guildId] The guild's id to create this command in,
|
||||||
* ignored when using a {@link GuildApplicationCommandManager}
|
* ignored when using a {@link GuildApplicationCommandManager}
|
||||||
* @returns {Promise<ApplicationCommand>}
|
* @returns {Promise<ApplicationCommand>}
|
||||||
@ -134,7 +141,7 @@ class ApplicationCommandManager extends CachedManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets all the commands for this application or guild.
|
* Sets all the commands for this application or guild.
|
||||||
* @param {ApplicationCommandData[]|APIApplicationCommand[]} commands The commands
|
* @param {ApplicationCommandDataResolvable[]} commands The commands
|
||||||
* @param {Snowflake} [guildId] The guild's id to create the commands in,
|
* @param {Snowflake} [guildId] The guild's id to create the commands in,
|
||||||
* ignored when using a {@link GuildApplicationCommandManager}
|
* ignored when using a {@link GuildApplicationCommandManager}
|
||||||
* @returns {Promise<Collection<Snowflake, ApplicationCommand>>}
|
* @returns {Promise<Collection<Snowflake, ApplicationCommand>>}
|
||||||
@ -165,7 +172,7 @@ class ApplicationCommandManager extends CachedManager {
|
|||||||
/**
|
/**
|
||||||
* Edits an application command.
|
* Edits an application command.
|
||||||
* @param {ApplicationCommandResolvable} command The command to edit
|
* @param {ApplicationCommandResolvable} command The command to edit
|
||||||
* @param {Partial<ApplicationCommandData|APIApplicationCommand>} data The data to update the command with
|
* @param {Partial<ApplicationCommandDataResolvable>} data The data to update the command with
|
||||||
* @param {Snowflake} [guildId] The guild's id where the command registered,
|
* @param {Snowflake} [guildId] The guild's id where the command registered,
|
||||||
* ignored when using a {@link GuildApplicationCommandManager}
|
* ignored when using a {@link GuildApplicationCommandManager}
|
||||||
* @returns {Promise<ApplicationCommand>}
|
* @returns {Promise<ApplicationCommand>}
|
||||||
@ -214,7 +221,7 @@ class ApplicationCommandManager extends CachedManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Transforms an {@link ApplicationCommandData} object into something that can be used with the API.
|
* Transforms an {@link ApplicationCommandData} object into something that can be used with the API.
|
||||||
* @param {ApplicationCommandData|APIApplicationCommand} command The command to transform
|
* @param {ApplicationCommandDataResolvable} command The command to transform
|
||||||
* @returns {APIApplicationCommand}
|
* @returns {APIApplicationCommand}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@ -247,3 +254,13 @@ class ApplicationCommandManager extends CachedManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ApplicationCommandManager;
|
module.exports = ApplicationCommandManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @external SlashCommandBuilder
|
||||||
|
* @see {@link https://discord.js.org/#/docs/builders/main/class/SlashCommandBuilder}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @external ContextMenuCommandBuilder
|
||||||
|
* @see {@link https://discord.js.org/#/docs/builders/main/class/ContextMenuCommandBuilder}
|
||||||
|
*/
|
||||||
|
15
typings/index.d.ts
vendored
15
typings/index.d.ts
vendored
@ -3,13 +3,16 @@ import {
|
|||||||
bold,
|
bold,
|
||||||
channelMention,
|
channelMention,
|
||||||
codeBlock,
|
codeBlock,
|
||||||
|
ContextMenuCommandBuilder,
|
||||||
formatEmoji,
|
formatEmoji,
|
||||||
hideLinkEmbed,
|
hideLinkEmbed,
|
||||||
hyperlink,
|
hyperlink,
|
||||||
inlineCode,
|
inlineCode,
|
||||||
italic,
|
italic,
|
||||||
|
JSONEncodable,
|
||||||
quote,
|
quote,
|
||||||
roleMention,
|
roleMention,
|
||||||
|
SlashCommandBuilder,
|
||||||
spoiler,
|
spoiler,
|
||||||
strikethrough,
|
strikethrough,
|
||||||
time,
|
time,
|
||||||
@ -3208,7 +3211,11 @@ export abstract class CachedManager<K, Holds, R> extends DataManager<K, Holds, R
|
|||||||
private _add(data: unknown, cache?: boolean, { id, extras }?: { id: K; extras: unknown[] }): Holds;
|
private _add(data: unknown, cache?: boolean, { id, extras }?: { id: K; extras: unknown[] }): Holds;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ApplicationCommandDataResolvable = ApplicationCommandData | RESTPostAPIApplicationCommandsJSONBody;
|
export type ApplicationCommandDataResolvable =
|
||||||
|
| ApplicationCommandData
|
||||||
|
| RESTPostAPIApplicationCommandsJSONBody
|
||||||
|
| SlashCommandBuilder
|
||||||
|
| ContextMenuCommandBuilder;
|
||||||
|
|
||||||
export class ApplicationCommandManager<
|
export class ApplicationCommandManager<
|
||||||
ApplicationCommandScope = ApplicationCommand<{ guild: GuildResolvable }>,
|
ApplicationCommandScope = ApplicationCommand<{ guild: GuildResolvable }>,
|
||||||
@ -3251,9 +3258,7 @@ export class ApplicationCommandManager<
|
|||||||
commands: ApplicationCommandDataResolvable[],
|
commands: ApplicationCommandDataResolvable[],
|
||||||
guildId: Snowflake,
|
guildId: Snowflake,
|
||||||
): Promise<Collection<Snowflake, ApplicationCommand>>;
|
): Promise<Collection<Snowflake, ApplicationCommand>>;
|
||||||
private static transformCommand(
|
private static transformCommand(command: ApplicationCommandDataResolvable): RESTPostAPIApplicationCommandsJSONBody;
|
||||||
command: ApplicationCommandData,
|
|
||||||
): Omit<APIApplicationCommand, 'id' | 'application_id' | 'guild_id'>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ApplicationCommandPermissionsManager<
|
export class ApplicationCommandPermissionsManager<
|
||||||
@ -3369,7 +3374,7 @@ export class GuildApplicationCommandManager extends ApplicationCommandManager<Ap
|
|||||||
public delete(command: ApplicationCommandResolvable): Promise<ApplicationCommand | null>;
|
public delete(command: ApplicationCommandResolvable): Promise<ApplicationCommand | null>;
|
||||||
public edit(
|
public edit(
|
||||||
command: ApplicationCommandResolvable,
|
command: ApplicationCommandResolvable,
|
||||||
data: ApplicationCommandDataResolvable,
|
data: Partial<ApplicationCommandDataResolvable>,
|
||||||
): Promise<ApplicationCommand>;
|
): Promise<ApplicationCommand>;
|
||||||
public fetch(id: Snowflake, options?: FetchGuildApplicationCommandFetchOptions): Promise<ApplicationCommand>;
|
public fetch(id: Snowflake, options?: FetchGuildApplicationCommandFetchOptions): Promise<ApplicationCommand>;
|
||||||
public fetch(options: FetchGuildApplicationCommandFetchOptions): Promise<Collection<Snowflake, ApplicationCommand>>;
|
public fetch(options: FetchGuildApplicationCommandFetchOptions): Promise<Collection<Snowflake, ApplicationCommand>>;
|
||||||
|
Loading…
Reference in New Issue
Block a user