adonisjs-grammy
v1.0.0
Published
Use Webhook on Telegram Bot Framework
Downloads
17
Maintainers
Readme
Introduction
adonisjs-grammy
makes it easy for you to integrate AdonisJS with the Telegram Bot Framework
-Grammy-, allowing you to implement Webhooks instead of using Long Polling.
Learn more here and find out that
Grammy doesn't support AdonisJS.
Installation
node ace add adonisjs-grammy
Next steps?
Adjust the env configuration.
Create a tunnel if running on a local machine (recomended:
cloudflared
orloophole
)Set the webhook to
http://<tunneling-addres>/<bot-token>
using the following API.https://api.telegram.org/bot<bot-token>/setWebhook?url=http://<tunneling-address>/<bot-token>
Continue developing!
Usage
Open start/grammy.ts
and do whatever you want, as documented in the official
Grammy documentation.
Example
import grammy from 'adonisjs-grammy/services/main'
// handle the /start command
grammy.command('start', (ctx) => ctx.reply('Welcome! Up and running.'))
// handle other messages
grammy.on('message', (ctx) => ctx.reply('Got another message!'))
License
The MIT License (MIT). Please see LICENSE file for more information.
Disclaimer
This package is not officially maintained by Telegram. Telegram trademarks and logo are the property of Telegram Messenger LLP.