https://github.com/lleballex/aiogram-template
Template of aiogram telegram bot
https://github.com/lleballex/aiogram-template
aiogram aiogram-bot-template aiogram3 python python-i18n telegram-bot template
Last synced: 24 days ago
JSON representation
Template of aiogram telegram bot
- Host: GitHub
- URL: https://github.com/lleballex/aiogram-template
- Owner: lleballex
- Created: 2023-01-24T17:17:26.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-09T15:11:53.000Z (over 2 years ago)
- Last Synced: 2025-04-28T13:28:50.010Z (24 days ago)
- Topics: aiogram, aiogram-bot-template, aiogram3, python, python-i18n, telegram-bot, template
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# โก Aiogram bot template
It is a template you can use for creating telegram bot with aiogram 3. It supports internationalization
### Tools:
- ๐ช Aiogram (v3)
- ๐ i18n
- ๐คน๐ฝ Loguru## ๐ฅ Getting started
### Requirements:
- Python
- Make### Installing
###### For linux
```bash
git clone [email protected]:lleballex/aiogram-template.git
cd aiogram-template
python3 -m venv env
. env/bin/activate
pip install -r requirements.txt
```###### For windows
```bash
git clone [email protected]:lleballex/aiogram-template.git
cd aiogram-template
python -m venv env
env\scripts\activate
pip install -r requirements.txt
```### Starting
```bash
python src/bot.py
```## โ Adding handlers
Just create new file in *src/handlers* folder or its subfolder
#### Initialize router and use it to handle events:
```python
from aiogram import Router
my_router = Router()
```#### Add created router to router list in *src/handlers/\_\_init\_\_.py*:
```python
from .my_file import my_router
routers = [my_router]
```## ๐ Internationalization
This template uses i18n. So wrap your messages in `aiogram.utils.i18n.gettext` to make it translatable\
More information you can find [here](https://docs.aiogram.dev/en/dev-3.x/utils/i18n.html#step-3-translate-texts)#### Extracting messages (creating .pot):
```bash
make i18n-extract
```#### Initializing a new language:
```
mkdir locales
pybabel init -i locales/messages.pot -d locales -D messages -l en
```#### Compiling translations (.po -> .mo):
```bash
make i18n-compile
```#### Updating translated messages (.po) with new extracted messages (.pot):
```bash
make i18n-update
```## ๐๐ฝโโ๏ธ Contact me
[
](https://t.me/lleballex)
[](https://vk.com/lleballex)