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
video_example.mp4
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
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 = ฮฑโท
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.
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.
This project is licensed under the terms of the MIT license.