import { Collection, EmojiIdentifierResolvable, Message, MessageEmbed, MessageOptions, MessageResolvable, NewsChannel, ReplyMessageOptions, StartThreadOptions, TextChannel } from 'discord.js'; import { Command, CommandHandler, MaybePromise } from '../../'; import { ArgumentParser, ArgumentResolved, CommandArgument } from '../arguments'; interface ReplyOptions extends ReplyMessageOptions { embed?: MessageEmbed; } interface SendOptions extends MessageOptions { embed?: MessageEmbed; } /** * The interface to create a new CommandContext. */ export interface CommandContextBuilder { /** * The command. */ command: Command; /** * The handler. */ handler: typeof CommandHandler; /** * The message that executed the command. */ message: Message; /** * The arguments in the message. */ rawArgs: string[]; } /** * @see {@link https://ayfri.gitbook.io/advanced-command-handler/concepts/commands/context} */ export declare class CommandContext implements CommandContextBuilder { /** * The argument parser of this context, if the command has no arguments it will be undefined. */ argumentParser?: ArgumentParser; /** * The command itself. */ command: Command; /** * The handler. */ handler: typeof CommandHandler; /** * The message that executed the command. */ message: Message; /** * The arguments in the message. */ rawArgs: string[]; /** * Creates a new CommandContext associated to a Command. * * @param options - The options of the CommandContext. */ constructor(options: CommandContextBuilder); /** * The old list of raw arguments. * * @deprecated - Use {@link CommandContext#rawArgs} instead. */ get args(): string[]; /** * Returns the arguments joined with a space between each. */ get argsString(): string; /** * Returns the list of arguments of the command. */ get arguments(): CommandArgument[]; /** * Returns the channel where the command was executed. */ get channel(): import("discord.js").TextBasedChannels; /** * Returns the client. */ get client(): import("../AdvancedClient").AdvancedClient; /** * Returns the name of the command executed. */ get commandName(): string; /** * Returns the content of the message. */ get content(): string; /** * Returns the guild of the message. */ get guild(): import("discord.js").Guild | null; /** * Returns true if the arguments are calling a SubCommand. */ get isCallingASubCommand(): boolean; /** * Returns the member of the message, `null` if executed in private messages. */ get member(): import("discord.js").GuildMember | null; /** * Returns the prefix used in the message. */ get prefix(): string; /** * Returns the channel where the command was executed as a TextChannel or undefined if it isn't. */ get textChannel(): TextChannel | NewsChannel | undefined; /** * Returns the channel where the command was executed as a ThreadChannel or undefined if it isn't. */ get thread(): import("discord.js").ThreadChannel | undefined; /** * Returns the author of the message. */ get user(): import("discord.js").User; /** * Returns an argument. * If the argument is errored or not found it will return `null`. * * @typeParam T - The type of the argument. * @param name - The name of the argument. * @returns - The argument in a promise or null if the argument is not found or errored or the command has no arguments. */ argument(name: string | (keyof this['command']['arguments'] & string)): Promise; bulkDeleteInChannel(number: number, filterOld?: boolean): Promise>; bulkDeleteInChannel(number: Collection, filterOld?: boolean): Promise>; bulkDeleteInChannel(number: readonly MessageResolvable[], filterOld?: boolean): Promise>; /** * Create a Thread, returns undefined if already in a Thread. * * @param options - The options of the Thread. * @returns - The resulting Thread. */ createThread(options: StartThreadOptions): Promise | undefined; /** * Deletes the message with an optional timeout. * * @param timeout - The time to wait in milliseconds before deleting the message. * @returns - The deleted message. */ deleteMessage(timeout?: number): Promise; /** * Add one or multiple reactions to a message. * * @remarks React in the order of emoji used. * @param emoji - The emoji to react with, can be custom or native. */ react(...emoji: EmojiIdentifierResolvable[]): Promise; /** * Remove all the reactions. */ removeAllReactions(): Promise; /** * Remove one or multiple reactions from emojis. * * @param emojis - The list of emoji reactions to remove. */ removeReaction(...emojis: EmojiIdentifierResolvable[]): Promise; /** * Remove one or multiple reactions from the bot. * * @param emojis - The emojis the bot has to remove reaction from. */ removeSelfReaction(...emojis: EmojiIdentifierResolvable[]): Promise; reply(options: ReplyOptions): Promise; reply(content: string): Promise; reply(content: string, options: ReplyOptions): Promise; /** * Resolves one of the argument. * If the argument is errored it will return a {@link CommandError}. * * @remarks Internally it uses {@link resolveArguments}. * @typeParam T - The type of the argument. * @param name - The name of the argument. * @returns - The result of the argument maybe in a promise or undefined if no arguments with this name exists or the command has no arguments. */ resolveArgument(name: string | (keyof this['command']['arguments'] & string)): undefined | MaybePromise>; /** * Resolves all of the arguments of the command. * If an argument has an error it will return a {@link CommandError}. * * @typeParam T - The type of the arguments as an union. * @returns - A map of arguments or undefined if the command has no arguments. */ resolveArguments(): Promise>>; send(options: SendOptions): Promise; send(content: string): Promise; send(content: string, options: SendOptions): Promise; /** * Sends the help menu from the default `HelpCommand` command (even if you are not using it). * * @returns - The message of the help menu. */ sendGlobalHelpMessage(): Promise; /** * Sends the help menu of the command from the default `HelpCommand` command (even if you are not using it). * * @param commandName - The name of the command to send the help menu. * @returns - The message of the help menu of the command. */ sendHelpMessage(commandName?: string): Promise; } export {};