aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-12-26 17:16:32 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-12-26 17:16:32 -0500
commitfc390ffc300334c396d9d06b0feaf8fbc6ed2814 (patch)
treea6282a74cf99033291ac7bc9de123ae273d528d2 /src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts
parent062435590980b87f5b054418ed88604e26358ae9 (diff)
downloadtanzanite-fc390ffc300334c396d9d06b0feaf8fbc6ed2814.tar.gz
tanzanite-fc390ffc300334c396d9d06b0feaf8fbc6ed2814.tar.bz2
tanzanite-fc390ffc300334c396d9d06b0feaf8fbc6ed2814.zip
documentation, bug fixes etc
Diffstat (limited to 'src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts')
-rw-r--r--src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts101
1 files changed, 99 insertions, 2 deletions
diff --git a/src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts b/src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts
index 7947acd..2aa366d 100644
--- a/src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts
+++ b/src/lib/extensions/discord.js/BushApplicationCommandManager.d.ts
@@ -14,12 +14,19 @@ import {
type Snowflake
} from 'discord.js';
+/**
+ * Manages API methods for application commands and stores their cache.
+ */
export class BushApplicationCommandManager<
ApplicationCommandScope = BushApplicationCommand<{ guild: BushGuildResolvable }>,
PermissionsOptionsExtras = { guild: BushGuildResolvable },
PermissionsGuildType = null
> extends CachedManager<Snowflake, ApplicationCommandScope, BushApplicationCommandResolvable> {
public constructor(client: BushClient, iterable?: Iterable<unknown>);
+
+ /**
+ * The manager for permissions of arbitrary commands on arbitrary guilds
+ */
public permissions: BushApplicationCommandPermissionsManager<
{ command?: BushApplicationCommandResolvable } & PermissionsOptionsExtras,
{ command: BushApplicationCommandResolvable } & PermissionsOptionsExtras,
@@ -27,22 +34,112 @@ export class BushApplicationCommandManager<
PermissionsGuildType,
null
>;
+
+ /**
+ * The APIRouter path to the commands
+ * @param id The application command's id
+ * @param guildId The guild's id to use in the path,
+ * ignored when using a {@link GuildApplicationCommandManager}
+ */
private commandPath({ id, guildId }: { id?: Snowflake; guildId?: Snowflake }): unknown;
- public create(command: ApplicationCommandData): Promise<ApplicationCommandScope>;
- public create(command: ApplicationCommandData, guildId: Snowflake): Promise<BushApplicationCommand>;
+
+ /**
+ * Creates an application command.
+ * @param command The command
+ * @param guildId The guild's id to create this command in, ignored when using a {@link GuildApplicationCommandManager}
+ * @example
+ * // Create a new command
+ * client.application.commands.create({
+ * name: 'test',
+ * description: 'A test command',
+ * })
+ * .then(console.log)
+ * .catch(console.error);
+ */
+ public create(command: BushApplicationCommandResolvable, guildId?: Snowflake): Promise<ApplicationCommandScope>;
+
+ /**
+ * Deletes an application command.
+ * @param command The command to delete
+ * @param guildId The guild's id where the command is registered,
+ * ignored when using a {@link GuildApplicationCommandManager}
+ * @example
+ * // Delete a command
+ * guild.commands.delete('123456789012345678')
+ * .then(console.log)
+ * .catch(console.error);
+ */
public delete(command: BushApplicationCommandResolvable, guildId?: Snowflake): Promise<ApplicationCommandScope | null>;
+
+ /**
+ * Edits an application command.
+ * @param command The command to edit
+ * @param data The data to update the command with
+ * @param guildId The guild's id where the command registered,
+ * ignored when using a {@link GuildApplicationCommandManager}
+ * @example
+ * // Edit an existing command
+ * client.application.commands.edit('123456789012345678', {
+ * description: 'New description',
+ * })
+ * .then(console.log)
+ * .catch(console.error);
+ */
public edit(command: BushApplicationCommandResolvable, data: ApplicationCommandData): Promise<ApplicationCommandScope>;
public edit(
command: BushApplicationCommandResolvable,
data: ApplicationCommandData,
guildId: Snowflake
): Promise<BushApplicationCommand>;
+
+ /**
+ * Obtains one or multiple application commands from Discord, or the cache if it's already available.
+ * @param id The application command's id
+ * @param options Additional options for this fetch
+ * @example
+ * // Fetch a single command
+ * client.application.commands.fetch('123456789012345678')
+ * .then(command => console.log(`Fetched command ${command.name}`))
+ * .catch(console.error);
+ * @example
+ * // Fetch all commands
+ * guild.commands.fetch()
+ * .then(commands => console.log(`Fetched ${commands.size} commands`))
+ * .catch(console.error);
+ */
public fetch(id: Snowflake, options: FetchApplicationCommandOptions & { guildId: Snowflake }): Promise<BushApplicationCommand>;
public fetch(options: FetchApplicationCommandOptions): Promise<Collection<string, ApplicationCommandScope>>;
public fetch(id: Snowflake, options?: FetchApplicationCommandOptions): Promise<ApplicationCommandScope>;
public fetch(id?: Snowflake, options?: FetchApplicationCommandOptions): Promise<Collection<Snowflake, ApplicationCommandScope>>;
+
+ /**
+ * Sets all the commands for this application or guild.
+ * @param commands The commands
+ * @param guildId The guild's id to create the commands in,
+ * ignored when using a {@link GuildApplicationCommandManager}
+ * @example
+ * // Set all commands to just this one
+ * client.application.commands.set([
+ * {
+ * name: 'test',
+ * description: 'A test command',
+ * },
+ * ])
+ * .then(console.log)
+ * .catch(console.error);
+ * @example
+ * // Remove all commands
+ * guild.commands.set([])
+ * .then(console.log)
+ * .catch(console.error);
+ */
public set(commands: ApplicationCommandData[]): Promise<Collection<Snowflake, ApplicationCommandScope>>;
public set(commands: ApplicationCommandData[], guildId: Snowflake): Promise<Collection<Snowflake, BushApplicationCommand>>;
+
+ /**
+ * Transforms an {@link ApplicationCommandData} object into something that can be used with the API.
+ * @param command The command to transform
+ */
private static transformCommand(
command: ApplicationCommandData
): Omit<APIApplicationCommand, 'id' | 'application_id' | 'guild_id'>;