Skip to content

rin-gil/python-telegram-bot-template

Repository files navigation

python-telegram-bot-template


python version python-telegram-bot version aiolimiter version Jinja2 version environs version MIT licence

Code style: black CodeQL Dependency Review MyPy Pylint Unit Tests


This template can be used for telegram bots written using the python-telegram-bot library.

Detailed materials on creating bots can be found in the documentation and wiki.

Template structure:

src/
├── tgbot/  
│   ├── assets/
│   ├── handlers/
│   ├── services/
│   ├── templates/
│   ├── utils/
│   ├── __init__.py
│   └── config.py
├──.env.example
└── bot.py

Description:

  • tgbot/ - the root package, which contains the other sub-packages and files necessary for the bot's operation
  • assets/ - resources that can be used in the bot, such as images, logos
  • handlers/ - handlers that respond to the actions of bot users
  • services/ - the business logic of the bot
  • templates/ - to avoid writing text in handlers, the message templates are placed in a separate module
  • utils/ - other support modules
  • config.py - configuration file
  • .env.example - file with environment variables, you need to rename it to .env and insert your bot's token into it
  • bot.py - entry point for the bot, performs preparatory operations and launches the bot

A more detailed description and documentation of all bot functions are in the template.

Developers

License

Available under MIT license