Constructor
new CommandListener(options)
Create a bot command.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
options |
Object
|
The command options. See Listener. |
Examples
bot.use(new Bot.Listener.Command({
name: 'dice roller',
trigger: 'roll a die',
handler: new Bot.Responder.RandomMessage({
messages: [
'1', '2', '3', '4', '5', '6'
]
})
}));
bot.use(new Bot.Listener.Command({
name: 'meaning of life',
trigger: /what('?s| is) the meaning of life/i,
handler: async message => {
await bot.replyTo(message).with('42');
}
}));
Extends
Methods
(static) create() → {CommandListener}
Create a bot command (see CommandListener for parameters).
- Source: