Skip to main content

TGPy Logo

Runs Python code snippets
within your Telegram messages

PyPI - Downloads PyPI Docker Image Version (latest semver) Open issues Docs


Here are a few examples of how people use TGPy:

🧮 Run Python 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 messages:
For example, x = \alpha^7 becomes x = α⁷

About

TGPy allows you to easily write and execute code snippets directly within your Telegram messages. Combine Telegram features with the full power of Python: Integrate with libraries and APIs. Create functions and TGPy modules to reuse code in the future. Set up code transformers and hooks to create custom commands and tweak Python syntax.

TGPy uses Telegram API through the Telethon library.

Quick Start

Python 3.10+ 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. Read more on installation

Learn

🙂 Basics Guide

😎 Extensibility Guide

📗 Reference

💬 Russian-Speaking Chat

Demo

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


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

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. It was designed for running single-use scripts and reusing code flexibly. You can think of TGPy as a userbot for programmers.

Credits

TGPy is built on Telethon, a Python library to interact with Telegram API.

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.9.3

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.9.3
File Size Uploaded Provenance Actions
tgpy-0.9.3.tar.gz 22.1 kB Without provenance Details for tgpy-0.9.3.tar.gz

Built distribution (wheel)

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

Total release size: 50.5 kB

Release files / tgpy-0.9.3.tar.gz

Download URL tgpy-0.9.3.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e301804d5853dc6fa267edad80b173e9d5b81290f8b9dbc497f2a3f8513ee832
BLAKE2b-256 checksum
How to use checksums
b5a1a65bf313a35bcc0fb5229bdcfb358a1d6e84acabc58441e2a2a088dfe625
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.10

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

Download URL tgpy-0.9.3-py3-none-any.whl
Size 28.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ca751b77149361e3c924398123a8d45765f8226a16085915e483e9860e06cd0
BLAKE2b-256 checksum
How to use checksums
cfff5654143a511eeb319a5aa09172380a313d63abe24c1d856babcd9432c7ed
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.10

Security for tgpy 0.9.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.3 This release

2 release files No provenance

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