This is a weather bot written in python using the aiogram framework
-
Send current weather.
-
Send today forecast
-
Enable/Disable weather daily forecast
-
General bot settings:
- Language settings (Russian, English)
- Time settings for daily forecast
- Change coords
- Change city
-
Button to add bot to a group as admin
-
Bot settings in group:
- Language settings for groups messages (Russian, English)
- Timezone settings
- 2 Daily forecast tasks with next settings:
- Time settings for daily forecast
- Change coords
- Change city
- Enable/Disable button
- Python 3.13.5;
- aiogram 3.x (Asynchronous Telegram Bot framework);
- aiogram_dialog (GUI framework for telegram bot);
- dynaconf (Configuration Management for Python);
- taskiq (Async Distributed Task Manager);
- fluentogram (Internationalization tool in the Fluent paradigm);
- Docker and Docker Compose (containerization);
- PostgreSQL (database);
- SQLAlchemy (ORM for SQL database);
- NATS (queue and delay tasks);
- Redis (FSM storage, cache, taskiq result backend);
- Alembic (database migrations with raw SQL).
- https://www.weatherapi.com/ - API to get weather
- https://www.openstreetmap.org/ - API for checking the availability of a city
📁 aiogram-weather-bot/
├── 📁 .github
│ └── 📁 workflows
│ ├── deploy.yml
│ └── release.yml
├── 📁 config
│ ├── config.py
│ └── settings.toml
├── 📁 locales
│ ├── 📁 en
│ │ └── txt.ftl
│ └── 📁 ru
│ └── txt.ftl
├── 📁 migration
│ ├── env.py
│ ├── script.py.mako
│ └── 📁 versions
├── 📁 nats_broker
│ ├── nats_connect.py
│ ├── 📁 config
│ │ └── server.conf
│ └── 📁 migrations
│ └── create_stream.py
├── 📁 src
│ ├── 📁 bot
│ │ ├── app_factory.py
│ │ ├── bot.py
│ │ ├── __init__.py
│ │ ├── 📁 dialogs
│ │ │ ├── 📁 flows
│ │ │ │ ├── __init__.py
│ │ │ │ ├── 📁 language_settings
│ │ │ │ │ ├── dialogs.py
│ │ │ │ │ ├── getters.py
│ │ │ │ │ ├── handlers.py
│ │ │ │ │ ├── keyboards.py
│ │ │ │ │ └── states.py
│ │ │ │ ├── 📁 registration
│ │ │ │ │ ├── dialogs.py
│ │ │ │ │ ├── getters.py
│ │ │ │ │ ├── handlers.py
│ │ │ │ │ ├── keyboards.py
│ │ │ │ │ ├── states.py
│ │ │ │ │ └── 📁 media
│ │ │ │ │ └── new.mp4
│ │ │ │ └── 📁 weather
│ │ │ │ ├── dialogs.py
│ │ │ │ ├── getters.py
│ │ │ │ ├── handlers.py
│ │ │ │ ├── keyboards.py
│ │ │ │ └── states.py
│ │ │ └── 📁 widgets
│ │ │ └── i18n.py
│ │ ├── 📁 enums
│ │ │ ├── actions.py
│ │ │ └── group_data.py
│ │ ├── 📁 filters
│ │ │ └── chat_type_filters.py
│ │ ├── 📁 handlers
│ │ │ ├── commands.py
│ │ │ ├── errors.py
│ │ │ ├── groups.py
│ │ │ ├── user_statuses.py
│ │ │ └── __init__.py
│ │ ├── 📁 keyboards
│ │ │ ├── inline_keyboards.py
│ │ │ └── menu_button.py
│ │ ├── 📁 middlewares
│ │ │ ├── database.py
│ │ │ ├── get_group.py
│ │ │ ├── get_user.py
│ │ │ ├── i18n.py
│ │ │ └── shadow_ban.py
│ │ ├── 📁 services
│ │ │ ├── group_admin_service.py
│ │ │ └── time_checker.py
│ │ └── 📁 states
│ │ └── states.py
│ ├── 📁 infrastructure
│ │ ├── 📁 cache
│ │ │ ├── connect_to_redis_pool.py
│ │ │ └── __init__.py
│ │ └── 📁 database
│ │ ├── dao.py
│ │ ├── db.py
│ │ └── models.py
│ └── 📁 services
│ ├── 📁 delay_service
│ │ ├── consumer.py
│ │ ├── publisher.py
│ │ ├── start_consumer.py
│ │ └── 📁 models
│ │ └── delayed_messages.py
│ ├── 📁 i18n
│ │ └── translator_hub.py
│ ├── 📁 open_street_map_api
│ │ ├── city_parsing.py
│ │ └── city_service.py
│ ├── 📁 scheduler
│ │ ├── taskiq_broker.py
│ │ └── tasks.py
│ └── 📁 weather_api
│ ├── weather_emojis.py
│ ├── weather_parsing.py
│ └── weather_service.py
├── .env
├── .env.example
├── .gitignore
├── alembic.ini
├── docker-compose.yml
├── main.py
├── pyproject.toml
├── README.md
└── uv.lock
- Clone the repository to your local machine via HTTPS:
git clone https://github.com/Ruslan-Droid/aiogram-weather-bot.gitor via SSH:
git@github.com:Ruslan-Droid/aiogram-weather-bot.git-
Create a
.envfile in the root of the project and copy the code from the.env.examplefile into it. Replace the required secrets (BOT_TOKEN, ADMINS_CHAT, etc). -
Run
docker-compose.ymlwithdocker compose upcommand. You need docker and docker-compose installed on your local machine. -
Create a virtual environment in the project root and activate it.
-
Install the required libraries in the virtual environment. With
uv:
uv sync- Apply database migrations using the command:
alembic upgrade head- Run
create_stream.pyto create NATS stream for delayed messages service:
python3 -m nats_broker.migrations.create_stream- Start the taskiq worker first:
taskiq worker src.services.scheduler.taskiq_broker:broker -fsdand then the scheduler:
taskiq scheduler src.services.scheduler.taskiq_broker:scheduler- Run
main.pyto start bot.
