1.0.2 • Published 3 years ago

telegraf-cmd-args v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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);
1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago