A clean and scalable Telegram bot template using Pyrotgfork (a forked version of Pyrogram) with multi-language support and SQLite database.
- 🌐 Multi-language support with easy switching
- 💾 SQLite database with SQLAlchemy ORM
- 📅 Task scheduling with APScheduler
- 📁 Clean and organized folder structure
- ⚙️ Environment variables management
- 🎯 Decorator-based user handling
-
Clone the repository:
git clone https://github.com/tufcoding/telegram-bot-template.git
-
Install requirements:
pip install -r requirements.txt
-
Configure environment variables: Create a
.env
file with:API_ID=your_api_id API_HASH=your_api_hash BOT_TOKEN=your_bot_token
-
Run the bot:
python main.py
Follow these simple steps to customize the bot:
- Add your commands in the
commands
folder - Add your callbacks in the
callbacks
folder - Register commands and callbacks in
handlers.py
file - Register tasks in
tasks.py
file - Add new languages in the
languages
folder - Create database models in the
database
folder
To upgrade to PostgreSQL:
-
Install PostgreSQL adapter:
pip install psycopg2-binary
-
Update database configuration: In
settings.py
, modify theDATABASE_URL
:DATABASE_URL=postgresql://user:password@localhost/dbname
This template follows Telegram bot development best practices and can be customized to suit your needs. For custom implementations, please reach out to us at any of the following links:
- Create a new branch for your features
- Submit pull requests for improvements
- Open issues for bugs or suggestions
This project is licensed under the MIT License - see the LICENSE file for details.