Skip to main content

TGPy

Runs Python code snippets within your Telegram messages

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


Guide: https://tgpy.tmat.me/guide

Recipes: https://tgpy.tmat.me/recipes

Discussion: https://t.me/tgpy_flood


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


Quick Start

Python 3.10+ required. Install using pipx:

pipx install tgpy
tgpy

or Docker:

docker pull tgpy/tgpy
docker run -it --rm -v /tgpy_data:/data tgpy/tgpy

Then follow instructions to connect your Telegram account.

More on installation: https://tgpy.tmat.me/installation

Next, learn TGPy basics: https://tgpy.tmat.me/basics

Use Cases

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.

Inspiration and Credits

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

We built TGPy with Telethon, a Python library to interact with Telegram API. Basic code transformation (such as auto-return of values) is based on meval.

TGPy Docs use Material for MKDocs with custom CSS.

License

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

Metadata

Release files for tgpy 0.10.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.10.0
File Size Uploaded Provenance Actions
tgpy-0.10.0.tar.gz 21.9 kB Without provenance Details for tgpy-0.10.0.tar.gz

Built distribution (wheel)

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

Total release size: 50.7 kB

Release files / tgpy-0.10.0.tar.gz

Download URL tgpy-0.10.0.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c42d26c0b2bd7a56d8dd1875590b9e955c79e538bf505d8159f8b8c5c598eede
BLAKE2b-256 checksum
How to use checksums
ffb990ec163e3351504ffddd6e5b6acb3ea5122f0db218b4d50fc637ea63b859
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.5 tqdm/4.66.1 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.13

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

Download URL tgpy-0.10.0-py3-none-any.whl
Size 28.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf66cefd0310bf3c6c8e919beb8ba850b528bf99e8928e9bb54257b2ba25c6be
BLAKE2b-256 checksum
How to use checksums
258767f8234ff6b291df013383c266b0c5f9d8b901a751f19ad78d90d29d455a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.5 tqdm/4.66.1 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.13

Security for tgpy 0.10.0

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