All Projects → telegraf → telegraf-command-parts

telegraf / telegraf-command-parts

Licence: other
Command parameters parser middleware for Telegraf

Programming Languages

javascript
184084 projects - #8 most used programming language

Command Parts for Telegraf

This module is a plugin for the Telegraf Telegram Bot Framework.

It provides a middleware that splits a command in a Telegram text message to its parts. These parts are stored in ctx.state.command.

For example, if your text message is /start@yourbot Hello world!, the ctx.state.command holds the following properties:

  • text '/start@yourbot Hello world!'
  • command 'start'
  • bot 'yourbot'
  • args 'Hello world!'
  • splitArgs ['Hello', 'world!']

installation

To use this module in your Telegraf app, require it and pass it to app.use.

const commandParts = require('telegraf-command-parts');

app.use(commandParts());
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].