Skip to content

Telegram bot for weather, public transport and reminders.

License

Notifications You must be signed in to change notification settings

jgcarrillo/joserrabot

Repository files navigation

image

Telegram bot made with NodeJS, TypeScript and GrammY to create reminders and check the weather

Table of contents 👇

✨ Explanation

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.

🚀 Installation

  • git clone. Main and develop branches are currently the same.
  • Go to bot.ts and uncomment the bot.start() line.
  • Comment the code below bot.start().
  • npm run dev to run development server (local).

🎨 Features

🚩 Issues

See this example

🕸️ Vercel Configuration

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

💛 Contact

If you have some doubts or need to ask something about the project, feel free to reach me here: