UNPKG

@beni69/cmd

Version:

The command handler from my discord bot

64 lines 2.34 kB
import { ApplicationCommandOptionData, Client, CommandInteractionOptionResolver, EmojiIdentifierResolvable, Snowflake } from "discord.js"; import Handler from "./Handler"; import { Logger } from "./Logging"; import { ClassicTrigger, SlashTrigger } from "./Trigger"; export declare class Command { opts: CommandOptions & { names: string[]; }; run: CommandCallback; /** * Create a new command * @param {CommandOptions} opts - Parameters for the command * @param {CommandCallback} run - The actual function to run when the command is called */ constructor(opts: CommandOptions, run: CommandCallback); } export default Command; export declare type CommandOptions = { names: string[] | string; description: string; category?: string; /** command can not be invoked by a message */ noClassic?: boolean; /** command can not be invoked by a slash command */ noSlash?: boolean; /** command can not be invoked in direct messages */ noDM?: boolean; /** allow command usage only to pre-registered admins */ adminOnly?: boolean; /** command can only be used on a pre-registered test server */ test?: boolean; blacklist?: Array<Snowflake>; /** per-user cooldown */ cooldown?: number | string; /** per-guild cooldown */ globalCooldown?: number | string; /** emoji to react on the original message with on command success */ react?: EmojiIdentifierResolvable; minArgs?: number; maxArgs?: number; /** whether to use arguments based on postion or flag syntax */ yargs?: boolean; /** aliases to flag syntax arguments */ argvAliases?: { [key: string]: string[]; }; options?: Array<ApplicationCommandOptionData>; /** only the original user can see the reply */ ephemeral?: boolean; /** extend available response time by instantly sending a "waiting" thingy */ deferred?: boolean; }; export declare type CommandParams = { client: Client; trigger: ClassicTrigger | SlashTrigger; args: string[]; argv: CommandInteractionOptionResolver; prefix: string; handler: Handler; text: string; logger?: Logger; }; export declare type CommandCallback = (params: CommandParams) => Promise<boolean | void> | boolean | void; //# sourceMappingURL=Command.d.ts.map