If you want to start to chat with the bot, simply search in Telegram for @larguebot or @joserrabot. At the moment, the bot only support private chats, so you won't be able to add the bot to a group chat. To change that, go to BotFather, select your bot and go to Bot Settings and then Allow Groups.
git clone. Main and develop branches are currently the same.- Go to
bot.tsand uncomment thebot.start()line. - Comment the code below
bot.start(). npm run devto run development server (local).
- Weather forecast with Open Weather Map
- Database of reminders with Mongo Atlas Database
- Conversations with GrammY Conversations
- Internal session storage
- User authentication with custom password
Create a vercel.json file in your root folder and add the following:
{
"functions": {
"api/bot.ts": {
"memory": 1024,
"maxDuration": 10
}
}
}This line export default webhookCallback(bot, 'http'); at the end of the bot.ts file do the trick!
In vercel, set the following data:
- Output directory:
build - Install command:
npm install
Set then the environment variables. Later, create the webhook with the following command. Be sure to use the domain to your application, I mean, avoid https://joserrabot-d140bs3z9-jgcarrillo.vercel.app/ with the numbers and create the webhook with https://joserrabot.vercel.app/.
- Set the webhook:
https://api.telegram.org/bot{bot-key}/setWebhook?url={host-url}
In this case the correct url to create the webhook is https://joserrabot.vercel.app/api/bot. Don't forget to add the /api/bot at the end of the URL of Vercel.
Other useful commands are:
- Info about webhook:
https://api.telegram.org/bot{bot-key}/getWebhookInfo - Delete webhook:
https://api.telegram.org/bot{bot-key}/deleteWebhook
If you have some doubts or need to ask something about the project, feel free to reach me here:
- Twitter: https://twitter.com/jgcarrillo
- LinkedIn: https://es.linkedin.com/in/jgcarrilloweb
- Website: https://jgcarrillo.com/

