Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/telegraf/telegraf-command-parts
Command parameters parser middleware for Telegraf
https://github.com/telegraf/telegraf-command-parts
Last synced: 3 months ago
JSON representation
Command parameters parser middleware for Telegraf
- Host: GitHub
- URL: https://github.com/telegraf/telegraf-command-parts
- Owner: telegraf
- Archived: true
- Created: 2016-10-11T15:57:57.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-10-21T20:55:37.000Z (about 1 year ago)
- Last Synced: 2024-04-25T11:21:26.034Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 40
- Watchers: 3
- Forks: 9
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ⚠️ This package is deprecated. Telegraf has a builtin command parser now. See [v4.13.0 release notes](https://github.com/telegraf/telegraf/releases/tag/v4.13.0).
# Command Parts for Telegraf
This module is a plugin for the [Telegraf](http://telegraf.js.org/) 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.
```javascript
const commandParts = require('telegraf-command-parts');app.use(commandParts());
```