/telegram-holidays-bot

:calendar: Bot to list upcoming holidays on Telegram.

Primary LanguagePythonMIT LicenseMIT

telegram-holidays-bot

GitHub

📆 Bot to list upcoming holidays on Telegram.

Introduction

Basically this is a bot to tell you what the next holiday is. It has some customizations to inform the name of the holiday, if it will be on a day of the week or on a weekend, and also, how many days are left before it happens. We currently list the holidays in Brazil and the United States (both specified in the csvs folder).

Development

If you want to run this bot in your development environment, I suggest that you follow the following steps:

  • Add your Telegram key generated by BotFather in the config/.env file (use the .env-example file as a base);
  • Make sure you have Docker and Docker Compose installed on your machine;
  • Run docker-compose up;
  • Access the bot by Telegram;

Production

We currently have all the settings for you to run the bot in the production environment using Heroku.

First of all, create an account on the platform. You can access the following URL for this: https://signup.heroku.com/.

After you have created your account and verified it, we will create a new app.

  • Click on the "Create new app" button;
  • Create a very cool name for your app;
  • Click on "Create app".

We still need to configure some environment variables:

  • Click on the "Settings" tab;
  • Click on "Reveal Config Vars";
  • Add TELEGRAM_TOKEN as a key and the token generated by Botfather as a value;

Environment variables successfully configured! We just need to deploy now.

  • Go to the terminal;
  • Go to the root directory of this project that you have cloned;
  • Use the heroku login command to authenticate to heroku;
  • Use the command heroku git:remote -a <APP NAME> to "link" the app remotely;
  • As we also use Docker to deploy (see file heroku.yml), we need to execute the following command also heroku stack:set container;
  • Now we just have to upload the application: git push heroku main;
  • The above command will take a while, right after it is finished, we need to "scale" our services;
  • Use heroku ps:scale worker=1;
  • You can follow the logs of your application using the command heroku logs --tail.

That's it. Now we have our service running at full speed on Heroku!

Contributing

Feel free to do whatever you want with this project. :-)

References