Run Python code right in your Telegram messages
Project description
TGPy
Runs Python code snippets within your Telegram messages
Guide: https://tgpy.tmat.me/guide
Recipes: https://tgpy.tmat.me/recipes
Discussion: https://t.me/tgpy_flood
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tgpy-0.16.0.tar.gz
.
File metadata
- Download URL: tgpy-0.16.0.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using 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.1.0 tqdm/4.66.1 importlib-metadata/7.0.0 keyring/24.3.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 691ea7abebb6fe0ceb91f596ef478a438e76392ed2c80b8d22def1118ceee19e |
|
MD5 | e601b12f932eb7d173e7b0764f6fd458 |
|
BLAKE2b-256 | 2053e1188c2de0ed2cbeb299262d81d90bad280d4ba998c6192c5abd42abb5ab |
File details
Details for the file tgpy-0.16.0-py3-none-any.whl
.
File metadata
- Download URL: tgpy-0.16.0-py3-none-any.whl
- Upload date:
- Size: 30.5 kB
- Tags: Python 3
- Uploaded using 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.1.0 tqdm/4.66.1 importlib-metadata/7.0.0 keyring/24.3.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5852b28ba07519efe1736085ea03b1381e87be20806f41468ad56a87e8f50ad |
|
MD5 | 776bef2ef7f4880949a5c29c9d21ab5b |
|
BLAKE2b-256 | 578faa5e42cdd3681a0709961417d3ee3eb3c15aa612768d49972e90de9a25a5 |