command method
Adds a handler for a specific command.
Parameters:
command: The command name (without leading slash)handler: The handler functioncaseSensitive: Whether command matching is case sensitive
Example:
bot.command('start', (ctx) async {
await ctx.reply('Welcome! 👋');
});
bot.command('Help', (ctx) async {
await ctx.reply('Available commands: /start, /help');
}, caseSensitive: true);
Implementation
Bot<CTX> command(
String command,
UpdateHandler<CTX> handler, {
bool caseSensitive = false,
}) {
return on(
CommandFilter<CTX>(command, caseSensitive: caseSensitive),
handler,
);
}