This template and this README.md are (un)licensed under the terms of Unlicense.
- Change project name in
pyproject.toml,MakefileandREADME.mdfiles. - Change default i18n language in
Makefilefile.
GitMakefilePython 3.11PoetryEdgeDB
Dockerdocker-compose
app- main application directory.app/settings.py- settings file; all values are taken from the environment variables.app/filters- filters for routers and handlers.app/routers- aiogram routers.app/routers/main.py- main router, includes all other routers.app/models- database models.app/middlewares- aiogram middlewares.app/setup- functions that will be called on startup.app/setup/setup.py- main on startup function, calls all other functions.app/__main__.py- main file, starts bot.scripts/run.sh- Docker entrypoint; makes migrations and starts bot.
This template uses rather strict linter settings. Please configure the linters as you wish.
- mypy -
mypy.ini - ruff -
pyproject.toml#tool.ruffandpyproject.toml#tool.ruff.mccabe - black -
pyproject.toml#tool.black
The bot is configured using environment variables.
Possible environment variables are described in the example.env file.
By default, the bot uses user language information from Telegram.
If you need to implement more complex logic, configure i18n middleware in app/setup/i18n.py.
More on https://docs.aiogram.dev/en/dev-3.x/utils/i18n.html
By default, the bot uses MemoryStorage and SimpleEventIsolation.
Please configure storage in app/setup/storage.py.
More on https://docs.aiogram.dev/en/dev-3.x/dispatcher/finite_state_machine/storages.html
Run make install.
This command will
- Install all dependencies via
poetry - Setup
pre-commit - Init
i18nstuff. - Init
EdgeDBproject. - Init Git repository and create first commit.
You can find other usefully commands via make help command.
- Run
make text-update. - Translate new strings in
app/{YOUR_LOCALES_DIR}/{LANG}/LC_MESSAGES/messages.po. - Run
make text-compile.
- Run
text-create-language language=YOUR_LANGUAGE. - Translate strings in
app/{YOUR_LOCALES_DIR}/{LANG}/LC_MESSAGES/messages.po. - Run
make text-compile.