Telegram Bot Template v3 is a customizable template for creating Telegram Bots using Python and aiogram 3.X library. It provides a simple structure and basic functionality to kickstart your Telegram Bot development process.
- Integration with a PostgreSQL database for storing and retrieving data via SQLAlchemy ORM.
- Custom HTTP client for making requests to external APIs.
- Clear separation of concerns with distinct data and domain layers.
- Implementation of basic features of the aiogram 3.0 library.
- Implementation of basic localization feature
- Custom classes like broadcaster for additional functionality.
Follow these steps to set up your Telegram bot using this template:
- Clone this repository to your local machine.
- Install the required dependencies by running
pip install -r requirements.txt
. - Create a new Telegram Bot using BotFather.
- Copy your bot's token provided by BotFather.
- Replace the
TOKEN
variable in.env
with your Bot's token. - Customize the Bot's behavior and add your own functionality in the
bot.py
file. - Run
bot.py
to start your Bot:python bot.py
.
The bot.py
file contains the main code for your Telegram Bot. You can customize this file to add new commands, message handlers, or any other functionality your Bot requires.
Here's an example of handling text messages using the aiogram library:
@some_router.message()
async def handle_text(message: types.Message):
await message.answer("Hello! You said: " + message.text)