sheweny
Version:
The powerful framework for create discord bots
123 lines (122 loc) • 5.79 kB
TypeScript
import { Collection, type ApplicationCommand, type ApplicationCommandData, type ApplicationCommandResolvable, type GuildResolvable, type Snowflake } from 'discord.js';
import { BaseManager } from './index.js';
import { Command } from '../structures/index.js';
import type { ShewenyClient } from '../client/Client.js';
import type { CommandsManagerOptions, CommandsManagerDefaultOptions, MessageCommandPrefix, CommandManagerRegisterStrategy } from '../typescript/index.js';
/**
* Manager for Commands
* @extends {EventEmitter}
*/
export declare class CommandsManager extends BaseManager {
/**
* If the applications commands are disabled according to the `userPermissions` array
* @type {boolean | undefined}
*/
applicationPermissions?: boolean;
/**
* Register application commands
* @type {boolean}
*/
autoRegisterApplicationCommands: boolean;
/**
* Collection of the commands
* @type {Collection<string, Command[]> | undefined}
*/
commands?: Collection<string, Command[]>;
/**
* Default data for the commands
* @type {CommandsManagerDefaultOptions}
*/
default: CommandsManagerDefaultOptions;
/**
* ID of the guild where are set Applications Commands
* @type {Snowflake | Snowflake[] | undefined}
*/
guildId?: Snowflake | Snowflake[];
/**
* Prefix for the Message Commands
* @type {string | undefined}
*/
prefix?: MessageCommandPrefix;
/**
* The strategy for register application commands
* @type {CommandManagerRegisterStrategy}
*/
registerStrategy?: CommandManagerRegisterStrategy;
/**
* Constructor of commands manager
* @param {ShewenyClient} client Client framework
* @param {CommandsManagerOptions} [options] Options of the commands manager
*/
constructor(client: ShewenyClient, options: CommandsManagerOptions);
/**
* Create a command in the client's application commands
* @param {Command} [command] Command to create
* @param {Snowflake | undefined} [guildId] Guild ID where the order will be created
* @returns {Promise<ApplicationCommand<Record<string, unknown>> | ApplicationCommand<{ guild: GuildResolvable }> | undefined>}
*/
createCommand(command: Command, guildId?: Snowflake): Promise<ApplicationCommand<Record<string, unknown>> | ApplicationCommand<{
guild: GuildResolvable;
}> | undefined>;
/**
* Delete all commands from the client's application commands
* @param {Snowflake | undefined} [guildId] Guild ID where all commands will be deleted
* @returns {Promise<Collection<string, ApplicationCommand<{}>> | Collection<string, ApplicationCommand<{ guild: GuildResolvable }>> | undefined>}
*/
deleteAllCommands(guildId?: Snowflake): Promise<Collection<string, ApplicationCommand<Record<string, unknown>>> | Collection<string, ApplicationCommand<{
guild: GuildResolvable;
}>> | undefined>;
/**
* Removes an command from the client's application commands
* @param {ApplicationCommandResolvable} command Command deleted
* @param {Snowflake | undefined} [guildId] Guild ID where the command will be deleted
* @returns {Promise<ApplicationCommand<{ guild: GuildResolvable }> | null | undefined>}
*/
deleteCommand(command: ApplicationCommandResolvable, guildId?: Snowflake): Promise<ApplicationCommand<{
guild: GuildResolvable;
}> | null | undefined>;
/**
* Edit an command with a new command in the client's application commands
* @param {ApplicationCommandResolvable} oldCommand Command edited
* @param {Command} newCommand The new command that will take the place of the old one
* @param {Snowflake | undefined} [guildId] Guild ID where the order will be edited
* @returns {Promise<ApplicationCommand<{}> | ApplicationCommand<{ guild: GuildResolvable }> | undefined>}
*/
editCommand(oldCommand: ApplicationCommandResolvable, newCommand: Command, guildId?: Snowflake): Promise<ApplicationCommand<Record<string, unknown>> | ApplicationCommand<{
guild: GuildResolvable;
}> | undefined>;
/**
* Get data of application command
* @param {Command} [command] The command to obtain data
* @returns {ApplicationCommandData | null}
*/
getApplicationCommandData(command: Command): ApplicationCommandData | null;
/**
* Get an array of ApplicationCommandData from a collection of commands;
* @param {Collection<string, Command>} [commands] The commandsToRegister
* @returns {ApplicationCommandData[] | null}
*/
getAllApplicationCommandData(commands: Collection<string, Command[]>): ApplicationCommandData[] | null;
/**
* Load all commands in collection
* @returns {Promise<Collection<string, Command[] | undefined>}
*/
loadAll(): Promise<Collection<string, Command[]> | undefined>;
/**
* Set all application commands from the collection of commands in the client application
* @param {Collection<string, Command> | undefined} [commands] Collection of the commands
* @returns {Promise<Collection<Snowflake, ApplicationCommand<{}>> | Collection<Snowflake, ApplicationCommand<{ guild: GuildResolvable }>> | undefined>}
*/
registerApplicationCommands(commands: Collection<string, Command[]>, guildId?: Snowflake | Snowflake[]): Promise<boolean | undefined>;
/**
* Rename command type to the type of Application command
* @param {"SLASH_COMMAND" | "CONTEXT_MENU_USER" | "CONTEXT_MENU_MESSAGE"} type Type of command
* @returns {ApplicationCommandType | undefined}
*/
private renameCommandType;
/**
* Unload all commands
* @returns {void}
*/
unloadAll(): void;
}