Skip to main content
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.

Metadata

Release files for tgpy 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tgpy 0.8.0
File Size Uploaded
tgpy-0.8.0.tar.gz 18.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tgpy 0.8.0
File Interpreter ABI Platform
tgpy-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 39.8 kB

Release files / tgpy-0.8.0.tar.gz

Download URL tgpy-0.8.0.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
48186be682ddfd9e27a9bde1f35faf680312c6fce512687760d3edad4f1d5547
BLAKE2b-256 checksum
How to use checksums
8502d721d28d538d6544ade8f40e17f9e70af43b96e2851833ca03a62d428a8d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / tgpy-0.8.0-py3-none-any.whl

Download URL tgpy-0.8.0-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f539721faa080b519801ff6eb6915af778393ef045528ffd7abd009d7f977b4
BLAKE2b-256 checksum
How to use checksums
545f7aa4bb2f068e7cae1df53b1393e904f09cb3b295480c7a63008999daa0ac
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

0.25.3

2 release files

0.25.2

2 release files

0.25.1

2 release files

0.25.0

2 release files

0.23.0

2 release files

0.22.1

2 release files

0.22.0

2 release files

0.21.0

2 release files

0.20.1

2 release files

0.20.0

2 release files

0.19.2

2 release files

0.18.1

2 release files

0.18.0

2 release files

0.17.1

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.13.2

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page