telegraf
Version:
📡 Modern Telegram bot framework
29 lines (17 loc) • 683 B
Markdown
For handling group/supergroup commands(`/start@your_bot`) you need to provide bot username.
```js
// Provide with options
const app = new Telegraf(process.env.BOT_TOKEN, {username: 'your_bot'})
// Or you can get username from Telegram server
const app = new Telegraf(process.env.BOT_TOKEN)
app.telegram.getMe().then((botInfo) => {
app.options.username = botInfo.username
})
app.command('start', (ctx) => ctx.reply('Hello World'))
```
[](https://github.com/telegraf/telegraf-flow/blob/master/lib/flow.js)
[](https://github.com/telegraf/telegraf/tree/develop/examples/custom-router-bot.js)