Skip to content

Dvurechensky-Templates/TelegramBotTemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✨Dvurechensky✨

Dvurechensky

✨ Telegram Bot Template ✨

Language: 🇨🇳 中文 | 🇷🇺 Russian | ✅ 🇺🇸 English (current)


Telegram Bot Template

Structure

bot/
 ├─ config/
 ├─ core/
 ├─ services/
 ├─ utils/
 ├─ main.py
 └─ __init__.py
  • core/ — core layer: DB managers, services, tests. Everything responsible for logic and infrastructure.
  • services/ — separate layer for specific functionality: callbacks, commands, keyboards, states, API. Each service is isolated and easily extendable.
  • utils/ — helper functions/utilities.
  • config/ — bot configuration (tokens, settings). Separated from logic.
  • main.py — entry point.

✅ Pros:

  • Clean layered architecture.
  • Easy to scale and add new commands/services.
  • Good separation of logic and services.
  • Suitable for team development — no one breaks the core while working on keyboards or callbacks.

⚠️ Cons/Notes:

  • If the project grows significantly, services/ may become too large and harder to navigate. Could be improved later with submodules or package namespaces.

Documentation

Features

  • ✨ Feature 1
  • 👹 Feature 2
  • 🔐 Feature 3
  • 💀 Feature 4
  • 💬 Feature 5
  • ☔ Feature 6
  • 🛡️ Feature 7
  • 💾 Feature 8
  • 📋 Feature 9
  • 🌁 Feature 10

Prerequisites

  • Python 3.8+
  • Telegram account
  • Bot token from @BotFather
  • API credentials from my.telegram.org

Getting Credentials

Bot Token

  • Message @BotFather in Telegram
  • Send /newbot
  • Follow the instructions to create your bot
  • Copy the token into your .env file
  • To get CHAT_ID — go to https://api.telegram.org/bot<YOUR_TOKEN_BOT>/getUpdates, first send /start to your bot and send 1 message in the chat where the bot is added as an administrator
  • API_HASH — obtained from your Telegram developer account at my.telegram.org
BOT_TOKEN=YOUR_BOT_TOKEN
API_ID=YOUR_API_ID
API_HASH=YOUR_API_HASH

API Credentials

  • Visit https://my.telegram.org
  • Log in using your phone number
  • Go to API Development tools
  • Select Create new application
  • Copy API ID, BOT TOKEN, and API Hash into your .env file
  • Specify allowed Telegram usernames in ADMIN_USERNAMES who will use your bot and become its administrators

Usage

  • Start the bot: /start
  • View help: /help
  • List your services: 🌀 My Services

Logging

All actions are logged in:

  • app.log (file)
  • Console output

✨Dvurechensky✨

Releases

No releases published

Packages

 
 
 

Contributors

Languages