start developing your telegram bot right away!
I built this project, so i could develop my bots faster.
this bot doesn't do anything useful but it's a template for building fully functional bots.
it's an example implementation, you can do it however you like and change it to your liking!
project will be updated and new features will be added soon...
this template project uses:
- Aiogram (Telegram-Bot API Framework)
- Tortoise-ORM (Db ORM)
- Aerich (Database migrations)
- aiomysql (MySql database driver for asyncio)
- aioredis (FSM and in memory db)
Develpment tools:
- flake8 (Linter)
- Black (Formatter)
- aiohttp-autoreload (Auto reload on saving files)
you need git and python +3.7 installed in your system
clone the repository:
first Fork this project on your github account if you want.
clone the repository:
example:
git clone https://github.com/sinaebrahimi1/aiogram-template.git
change directory to project's direcotry:
cd aiogram-template
install virtualenv
with pip if you don't have it:
pip install virtualenv
create a new virtualenv and enable it:
python -m virtualenv .venv
source .venv/bin/activate
now you need to install needed libraries:
pip install -r requirements.txt
now you need MySql installed on your system(or in a docker container) and also redis.
make sure to install these two dependencies for your linux distro.
you can also use sqlite or postgresql or anything else that is supported by Tortoise-ORM.
now it's time to create .env
file and enter your configuration:
mv .env.example .env
open the .env
file in your editor and complete the required variables and any other configuration you want based on app/config.py
file.
PROXY_URL
is optional, it's useful if you live in a country that telegram is banned.
I'ts done!
now you can test it:
first make bot.py
file executable: chmod +x app/bot.py
run the bot: app/bot.py
or cd app && ./bot.py
also you can run the bot in auto-reload mode so it will reload the application every time you change a file:
./bot.py --reload
- soon...
- None
If you have any question or it's anything wrong with the app just open a github issue.
Any suggestion or contribution will be appreciated.