Skip to main content

My Telegram Framework

Project description

Easy Telegram Bot 🎯 easy-tg-bot

This is my own Telegram bot framework for faster development and updating my bots.

Based on Python Telegram Bot.

Features

Quick start

easy-tg-bot run

The command will create .env in your working directory if the file does not exist, and in this case you would have to fill it and try again.

Other necessary files are created if they do not exist, and finally main.py in your working directory is launched.

Register commands with a decorator

from easy_tg_bot import command

@command()
async def help(update, context):
    pass

Text settings of the bot

By default, in the bot:

  • Through /admin -> "⚙️ ...", admins regulate the settings of the bot via .xlsx file manipulation.

  • All the bot text is stored in an exel file text.xlsx with "string_text_key":"value" structure, and the columns are the languages.

  • To add a text, simply add a unique text index and the corresponding value in at least one language (the first column) in the text.xlsx.

  • All the text info is preserved in the bot persistance.

  • from easytgbot import send_message <- this async function accepts update, context, and "string_text_key" from the .xlsx file, as well as regular text = text, parse mode = ... etc.

  • See __init__.py for more features.

Other

Logs are rotating automatically.

See main.py generated by easy-tg-bot run command for more examples of usage.

Installation

This is an installable Python package.

PyPI

poetry add easy-tg-bot / pip install easy-tg-bot / any other manager command

Poetry (manually from this folder)

Make sure poetry is installed. From this folder,

  1. poetry shell; poetry update;

  2. poetry build; poetry install;

Usage

! Fill the .env file in your working directory before or after this command

easy-tg-bot run - run the bot (polling); easy-tg-bot run --docker - deploy using .env file

In the bot if run is successful, try /admin.

Ctrl+C to exit.

easy-tg-bot run command runs "main.py" file, so one can as well run the file directly after it's created.

  • /admin - admin panel

  • /start -> makes user pick a language, agree to data_policy and share a phone number.

See main.py for more details on how to configure the start coveration and explore /admin

# TODO

  • Add more features description to README from __init__.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easy_tg_bot-0.3.3.tar.gz (42.5 kB view details)

Uploaded Source

Built Distribution

easy_tg_bot-0.3.3-py3-none-any.whl (52.8 kB view details)

Uploaded Python 3

File details

Details for the file easy_tg_bot-0.3.3.tar.gz.

File metadata

  • Download URL: easy_tg_bot-0.3.3.tar.gz
  • Upload date:
  • Size: 42.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.2 Windows/11

File hashes

Hashes for easy_tg_bot-0.3.3.tar.gz
Algorithm Hash digest
SHA256 4f4a5c46ed0b7249836612b45e35215455a019809a0b01667b81524ea592a278
MD5 f1e3af0760934e8655d0bcf33b780253
BLAKE2b-256 087c6dd06f3596251a622aa7cd5df42adb4d3607290add825ca17fdc2b9b2833

See more details on using hashes here.

File details

Details for the file easy_tg_bot-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: easy_tg_bot-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 52.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.2 Windows/11

File hashes

Hashes for easy_tg_bot-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fbf1935ccbd321bc8448e6b18f922ee54592053ab116d3bfc7fa875534f18f3d
MD5 85a90d90cee75ab4c1b9671e2b6af52a
BLAKE2b-256 6f5b740463404bec63879ce1a3eea27d525e3b58d01881dedbb0122972c1d6f3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page