Telegram bot for automatically updating a telegram message containing a schedule according to week pairity.
- Python 3.13.3
- Aiogram
- PostgreSQL
- Docker
- Supports multiple chats, schedules, and schedule types
- Automatically updates the schedule message every week
- Ensures stable schedule updates by storing CRON jobs in a PostgreSQL database
- Generates schedules directly from a Google Spreadsheet
-
Create a Telegram bot
Use BotFather to create a bot and obtain a token.
-
Clone the project
git clone https://github.com/Pichus/tgschedulebot.git
-
Go to the project directory
cd tgschedulebot
-
To run this project, add the following environment variables to your .env file (use .env.example as a reference):
TELEGRAM_TOKEN=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11 # your telegram bot token retrieved from botfather DATABASE_CONNECTION_STRING="host=localhost port=5432 dbname=mydb user=some_user password=somepassword" DATABASE_URL_="postgresql+psycopg://user:password@localhost:5432/database_name" CRON_DAY_OF_WEEK=0 # int 0-6 CRON_HOUR = 0 # int 0-23 CRON_MINUTE = 0 # int 0-59 CRON_TIMEZONE = "Europe/Kyiv" # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones ADMIN_USER_IDS = "12345678910, 932483203, 2347234983" # telegram user ids of admins separated with commas; use https://t.me/userinfobot to get your user id GOOGLE_CREDENTIALS = ... # paste your service account credentials json as a single line
-
Ensure Docker and Docker Compose are installed, then start the bot:
docker compose up
Now the bot should be up and running
The bot is designed for deployment on Heroku, but it can be deployed on other platforms as well.
-
Improve code quality and maintainability
-
Add a feature for automatically fetching schedules from a Google Spreadsheet