telegraf-cmd-args
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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

/telegraf-cmd-args/

    Package Sidebar

    Install

    npm i telegraf-cmd-args

    Weekly Downloads

    2

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    12.7 kB

    Total Files

    7

    Last publish

    Collaborators

    • h1b9b