❗️ This version of the bot is not final, new functionality is being added
This bot was created for educational purposes and is a template with examples of using various functionality of the aiogram 3 framework for creating telegram bots. In this example, a bot with a registration form is implemented. You can register, view your profile and view the profiles of other users. Try, study, change existing functionality and add new ones!
This template has:
- virtual environment,
- custom filters,
- environment variables,
- bot configuration,
- strict modularity,
- routers,
- replyKeyboards,
- inlineKeyboards,
- setMyCommands,
- callback Factory,
- SQLite databases,
- FSM based on redis,
- Custom pagination.
Folder | Description |
---|---|
config | Configuration files, database |
filters | Admin filter |
handlers | Handlers of commands and callbacks |
keyboards | Dynamically generated keyboards |
lexicon | Dictionary with all text |
logs | Storage of all logs |
middlewares | Middlewares for antispam and etc. |
models | Modules for interacting with the database |
states | Modules that describe classes that reflect the possible states of users during interaction with the bot, for the implementation of FSM |
utils | Functions that run multiple times |
- For windows -
python -m venv venv
- For macOS & Linux -
python3 -m venv venv
- For windows -
venv\Scripts\activate.bat
- For Power Shell -
venv\Scripts\activate.ps1
- For macOS & Linux -
source venv/bin/activate
pip install -r requirements.txt
pip freeze > requirements.txt
deactivate
- For windows -
py start.py
- For macOS & Linux -
python3 start.py
If you want the bot to automatically restart every time you save files, you can use the nodemon tool:
npm i -g nodemon
You can launch the bot via:
nodemon --exec py/python3 start.py
❗️ Important
Before starting installation, check the system requirements:
- 64-bit architecture
- kernel no lower than version 3.10 (suitable for Ubuntu version 16.04 and higher)
Update the existing package list:
sudo apt update
Install a few necessary packages that allow apt
to use packages over HTTPS:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
Add the GPG key for the official Docker repository to your system:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the Docker repository to the APT sources:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
Update the package database and add the Docker packages from the newly added repository:
sudo apt update
Install Docker:
sudo apt install docker-ce
Docker must be installed. Check that it is running:
sudo systemctl status docker
You need to update packages and install make on the server:
sudo apt-get update && sudo apt-get -y install make
Check the installed version:
make -v
Go to the bot repository:
cd name
To create a container image you need:
make build
To start a container:
make run