Skip to main content

Run Python code right in your Telegram messages

Project description

TGPy Logo

Supercharge Telegram with Python

PyPI Docker Image Version (latest semver) Open issues Docs



Write Python code and run it right inside your Telegram messages. For example:

  • Use it as an in-chat calculator.
  • Search for song lyrics within a chat.
  • Delete multiple messages with a command.
  • Find out the most active members in a chat.
  • Instantly convert TeX to Unicode in your messages: for example, x = \alpha^7 becomes x = α⁷.

TGPy uses Telegram API through the Telethon library.

Quick Start

Python 3.9+ required. Install TGPy and connect it to your Telegram account:

> pip install tgpy
> tgpy

You’re ready now. Send Python code to any chat, and it will run. Change your message to change the result. Details on installation

Learn

🙂 Basics Guide

😎 Extensibility Guide

📗 Reference

💬 Russian Chat

Demo

A message processed with TGPy Finding out the number of premium users in a chat


https://user-images.githubusercontent.com/38432588/181266550-c4640ff1-71f2-4868-ab83-6ea3690c01b6.mp4

Inspiration

TGPy is inspired by FTG and similar userbots. However, the key concept is different: TGPy is totally based on usage of code in Telegram rather than plugging extra modules. This leads both to convenience of single-use scripts and reusage flexibility.

Credits

TGPy is built on Telethon, which allows to integrate Telegram features in Python code.

Basic code transformation (such as auto-return of values) is based on meval.

License

This project is licensed under the terms of the MIT license.

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

tgpy-0.7.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

tgpy-0.7.0-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file tgpy-0.7.0.tar.gz.

File metadata

  • Download URL: tgpy-0.7.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.28.2 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.64.1 importlib-metadata/6.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.9

File hashes

Hashes for tgpy-0.7.0.tar.gz
Algorithm Hash digest
SHA256 074ed689c062d5326a4eebb4dd6a0b811a428f5cc06b22b135c5fac1a79fe41b
MD5 422ed4b0554dc7b141b5479cd2ed302e
BLAKE2b-256 9ac016e1fcd73e017925dfeb728c8805e7d53d3d9c26f3db83bea3fd109d7b61

See more details on using hashes here.

File details

Details for the file tgpy-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: tgpy-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.28.2 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.64.1 importlib-metadata/6.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.9

File hashes

Hashes for tgpy-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f9717c4fcee1e324c2aa549e60b89acae430b326b37778e28ad35a30486d8ba
MD5 471f91e92974c86ac64de005bf436c9c
BLAKE2b-256 8ddd5f372bd1a61fec3cb8a2ed1f49c0d6bedeb36f5d7ed21574662478b52ba3

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