{"id":25646470,"url":"https://github.com/blazzed21/py-aiogram-template-bot","last_synced_at":"2025-04-15T13:53:54.114Z","repository":{"id":199527246,"uuid":"703064556","full_name":"BLazzeD21/py-aiogram-template-bot","owner":"BLazzeD21","description":"Template for quickly starting an async Telegram bot using redis, sqlite, docker, python asyncio","archived":false,"fork":false,"pushed_at":"2024-01-05T01:50:35.000Z","size":93,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T20:46:43.683Z","etag":null,"topics":["aiogram","asyncio","bot","docker","redis","telegram","telegram-bot-api"],"latest_commit_sha":null,"homepage":"https://aiogram.dev/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BLazzeD21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-10T14:25:09.000Z","updated_at":"2024-06-06T09:12:29.000Z","dependencies_parsed_at":"2023-11-14T11:31:02.166Z","dependency_job_id":"b15d58c9-4460-432f-ab29-4541d34c026a","html_url":"https://github.com/BLazzeD21/py-aiogram-template-bot","commit_stats":null,"previous_names":["blazzed21/py-aiogram-template-bot"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BLazzeD21%2Fpy-aiogram-template-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BLazzeD21%2Fpy-aiogram-template-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BLazzeD21%2Fpy-aiogram-template-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BLazzeD21%2Fpy-aiogram-template-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BLazzeD21","download_url":"https://codeload.github.com/BLazzeD21/py-aiogram-template-bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249085475,"owners_count":21210267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aiogram","asyncio","bot","docker","redis","telegram","telegram-bot-api"],"created_at":"2025-02-23T10:27:45.334Z","updated_at":"2025-04-15T13:53:54.096Z","avatar_url":"https://github.com/BLazzeD21.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge\u0026logo=python\u0026logoColor=ffdd54)\n![Redis](https://img.shields.io/badge/redis-%23DD0031.svg?style=for-the-badge\u0026logo=redis\u0026logoColor=white)\n![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge\u0026logo=docker\u0026logoColor=white)\n![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge\u0026logo=telegram\u0026logoColor=white)\n![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge\u0026logo=linux\u0026logoColor=black)\n![SQLite](https://img.shields.io/badge/sqlite-%2307405e.svg?style=for-the-badge\u0026logo=sqlite\u0026logoColor=white)\n\n\u003e ❗️ This version of the bot is not final, new functionality is being added\n\n# Template for creating a telegram bot using the aiogram framework\n\nThis 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!\n\n**This template has:**\n- virtual environment,\u003c/br\u003e\n- custom filters,\u003c/br\u003e\n- environment variables,\u003c/br\u003e\n- bot configuration,\u003c/br\u003e\n- strict modularity,\u003c/br\u003e\n- routers,\u003c/br\u003e\n- replyKeyboards,\u003c/br\u003e\n- inlineKeyboards,\u003c/br\u003e\n- setMyCommands,\u003c/br\u003e\n- callback Factory,\u003c/br\u003e\n- SQLite databases,\u003c/br\u003e\n- FSM based on redis,\u003c/br\u003e\n- Custom pagination.\u003c/br\u003e\n\n# Bot structure 📁\nFolder  | Description\n------------- | -------------\nconfig  | Configuration files, database\nfilters  | Admin filter\nhandlers  | Handlers of commands and callbacks\nkeyboards | Dynamically generated keyboards\nlexicon  | Dictionary with all text\nlogs | Storage of all logs\nmiddlewares  | Middlewares for antispam and etc.\nmodels  | Modules for interacting with the database\nstates  | Modules that describe classes that reflect the possible states of\u003cbr\u003eusers during interaction with the bot, for the implementation of FSM\nutils  | Functions that run multiple times\n\n# Development 🛠\n\n### 1. To create a virtual environment:\n\n- For windows - ```python -m venv venv```\n- For macOS \u0026 Linux - `python3 -m venv venv`\n\n### 2. The virtual environment is activated with the command:\n\n- For windows - `venv\\Scripts\\activate.bat`\n- For Power Shell - `venv\\Scripts\\activate.ps1`\n- For macOS \u0026 Linux - `source venv/bin/activate`\n\n### 3. To install all dependencies in a virtual environment:\n\n```bash\npip install -r requirements.txt\n```\n\n### 4. To add new dependencies:\n\n```bash\npip freeze \u003e requirements.txt\n```\n\n### 5. How to leave the virtual environment:\n\n```bash\ndeactivate\n```\n\n### 6. How to launch a bot:\n\n- For windows - `py start.py`\n- For macOS \u0026 Linux - `python3 start.py`\n\nIf you want the bot to automatically restart every time you save files, you can use the [nodemon](https://www.npmjs.com/package/nodemon) tool:\n\n```bash\nnpm i -g nodemon\n```\n\nYou can launch the bot via:\n\n```bash\nnodemon --exec py/python3 start.py\n```\n\n\n# Deploying a bot 💾\n\n### 1. Docker installation\n   **❗️ Important**\n   \n  Before starting installation, check the system requirements:\n  - 64-bit architecture\n  - kernel no lower than version 3.10 (suitable for Ubuntu version 16.04 and higher)\n\n  Update the existing package list:\n  ```bash\n  sudo apt update\n  ```\n\n  Install a few necessary packages that allow `apt` to use packages over HTTPS:\n  ```bash\n  sudo apt install apt-transport-https ca-certificates curl software-properties-common\n  ```\n\n  Add the GPG key for the official Docker repository to your system:\n  ```bash\n  curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -\n  ```\n\n  Add the Docker repository to the APT sources:\n  ```bash\n  sudo add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable\"\n  ```\n\n  Update the package database and add the Docker packages from the newly added repository:\n  ```bash\n  sudo apt update\n  ```\n\n  Install Docker:\n  ```bash\n  sudo apt install docker-ce\n  ```\n\n  Docker must be installed. Check that it is running:\n  ```bash\n  sudo systemctl status docker\n  ```\n\n### 2. Installation make\n\n  You need to update packages and install make on the server:\n  ```bash\n  sudo apt-get update \u0026\u0026 sudo apt-get -y install make\n  ```\n\n  Check the installed version:\n  ```bash\n  make -v\n  ```\n\n### 3. Docker container\n Go to the bot repository:\n  ```bash\n  cd name\n  ```\n  \n  To create a container image you need:\n  ```bash\n  make build\n  ```\n\n  To start a container:\n  ```bash\n  make run\n  ```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblazzed21%2Fpy-aiogram-template-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblazzed21%2Fpy-aiogram-template-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblazzed21%2Fpy-aiogram-template-bot/lists"}