A type union containing possible options passed to an argument.
A type union of the string representations available as an argument type.
A type union containing possible resolved argument types.
A type alias for a function called by the command handler to construct the argument requirements for a command.
A user-defined type (object) matching argument names (property names) to value types.
A type alias containing a union of possible command argument types.
A type alias describing the way to define arguments for a command. To be returned by discord.command.ArgumentsParser.
A function called when a command is executed.
An object containing parsed arguments for a command.
Creates an un-attached command handler that can be attached to a CommandGroup using the attach method.
If you have no need to split your handlers across modules, it's generally more preferred to use CommandGroup.on!
const commandGroup = new discord.command.CommandGroup();
const hello = discord.command.handler(
ctx => ({name: ctx.text()}),
(msg, {name}) => msg.reply(`Hello ${name}`)
);
commandGroup.attach({hello});
This allows you to export commands directly from modules.
In main.ts
:
import * as EconomyCommands from './economy-commands';
const commandGroup = new discord.command.CommandGroup();
commandGroup.attach(EconomyCommands);
In economy-commands.ts
:
export const balance = discord.command.rawHandler((m) =>
m.reply('your balance is $50')
);
export const buy = discord.command.handler(
(ctx) => ({ item: ctx.string() }),
(m, { item }) => m.reply(`You bought **${item}**, your balance is now $0`)
);
A function that collects the argument types this command expects.
A function to be ran when command validation succeeds and the command should be executed.
A object containing the command options (filters, description, etc). It is not possible to specify a name here.
Creates an un-attached command handler which processes no arguments that can be attached to a discord.command.CommandGroup using the discord.command.CommandGroup.attach method.
If you have no need to split your handlers across modules, it's generally more preferred to use discord.command.CommandGroup.raw!
const commandGroup = new discord.command.CommandGroup();
const ping = discord.command.rawHandler(m => m.reply(`pong!`));
commandGroup.attach({pong});
For more examples, see the discord.command.handler.
A function to be ran when command validation succeeds and the command should be executed.
A object containing the command options (filters, description, etc). It is not possible to specify a name here.
Generated using TypeDoc
The built-in Pylon command handler. Provides utilities for building a bot that handles commands.
You can of course roll your own if you want, using the discord.Event.MESSAGE_CREATE event handler.