telegraf-cmd-args
v1.0.2
Published
middleware to parse telegraf commands
Downloads
3
Readme
telegraf-cmd-args
This is a plugin for the Telegraf Telegram Bot Framework.
It provides a middleware that splits a command in a Telegram text message.
The parsed command is stored in ctx.state.command
.
For example, if your text message is /start Hello world!
, the
ctx.state.command
will be set to:
{
"text": "/start Hello world!",
"command": "start",
"args": "Hello world!",
"splitArgs": ["Hello", "world!"],
}
installation
npm install telegraf-cmd-args
Usage
const { Telegraf } = require('telegraf');
const commandMiddleware = require('telegraf-cmd-args');
app.use(commandMiddleware);