💬 Useful commands
First, run just outdated to check for outdated dependencies. Then, edit pyproject.toml file and
run the
following command to update dependencies:
just outdated
# Edit pyproject.toml
uv lock --upgrade
just syncjust outdatedjust lintjust mypyjust format💢 The term 'just' is not recognized as the name of a cmdlet, function, script file, or operable program.
Installation: https://just.systems/man/en/introduction.html
❓ How to install UV?
- Open PowerShell
- Install UV using the following command:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
- Restart PowerShell to apply changes.
- Verify the installation by running:
uv --version
- Open your terminal.
- Install UV using the following command:
curl -LsSf https://astral.sh/uv/install.sh | sh - Restart your terminal to apply changes.
- Verify the installation by running:
uv --version
❓ How to install Docker?
- Download Docker Desktop from the official Docker website: https://www.docker.com/products/docker-desktop
- Run the installer and follow the on-screen instructions.
- After installation, Docker Desktop should start automatically. If not, you can start it from the Start menu.
- Verify the installation by opening PowerShell and running:
docker --version - You may need to log in to Docker Desktop with your Docker Hub account or create a new one.
- Ensure that WSL 2 is enabled on your system for better performance.
- Restart your computer if prompted.
- Open https://docs.docker.com/engine/install
- Follow the instructions for your specific Linux distribution.
- After installation, you may need to start the Docker service:
sudo systemctl start docker
- Enable Docker to start on boot:
sudo systemctl enable --now docker - Verify the installation by running:
docker --version
❓ Why PyCharm marks import with red color?
I use "unique" project structure, where app directory contains code, but root directory contains configuration files.
In PyCharm, right-click on the bot directory and select Mark Directory as -> Sources Root. Also, unmark project root directory Unmark as Sources Root. This will fix the problem.
❓ Why You use __import__?
My inclinations make me do this to avoid some attack vector invented by my "paranoia"
❓ Why not use aiogram-cli?
It's a good library, but I prefer to use my own code 🤷♂️
❓ How to properly set up .env file?
-
After cloning the repository, navigate to the project root.
-
Copy the example file based on your development environment:
- For local:
cp env.example .env
- For local:
-
Open the new
.envfile in a text editor. -
Fill in the required variables:
DEV: Set toTruefor development environment,Falsefor production. (If set to True - all connections will be tolocalhost)BOT_TOKEN: Your Telegram bot token from BotFather.POSTGRES_USER,POSTGRES_PASSWORD,POSTGRES_DB: PostgreSQL credentials.REDIS_PASSWORD: Redis password (if using authentication).WEBHOOKS: Set toTrueif using webhooks, otherwise False.WEBHOOK_URLandWEBHOOK_SECRET_TOKEN: Required if webhooks are enabled.
-
Save the file. Avoid committing
.envto version control - add it to.gitignoreif not already.
❓ How to enable and configure webhooks?
- In your
.envfile, setWEBHOOKS=True. - Set
WEBHOOK_URLto your bot's webhook endpoint (e.g.,https://example.com/webhook). - Set
WEBHOOK_SECRET_TOKENto a secure random string. - Uncomment the
caddyservice indocker-compose.ymlto enable Caddy.


