TGPy
Run Python code right in your Telegram messages
Made with Telethon library, TGPy is a tool for evaluating expressions and Telegram API scripts.
- Do Python calculations in dialogs
- Interact with your messages and chats
- Automate sending messages and more
Installation
Python 3.9+ is required.
> pip install tgpy
> tgpy
Getting started
Just send Python code to any chat, and it will be executed. Change your message to change the result.
Examples
Send any of these examples to any chat to evaluate:
🐍 Do Python calculations
for i in range(5):
print(i)
⏳ Delete the current message in 5 seconds
import asyncio
await asyncio.sleep(5)
await msg.delete()
↪️ Forward the message you replied to to another chat
orig.forward_to('Chat title')
🖼 Send all chat profile photos to the same chat
photos = await client.get_profile_photos(msg.chat)
msg.reply(file=photos)
🔖 Define a function which forwards messages to Saved Messages with reply
def save():
message = ctx.msg
original = await message.get_reply_message()
await original.forward_to('me')
return 'Saved!'
🗑 Define a function which deletes messages with reply
async def delete():
message = ctx.msg
original = await message.get_reply_message()
await original.delete()
await message.delete()
TGPy Guide
Credits
License
This project is licensed under the terms of the MIT license.
Metadata
Release files for tgpy 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tgpy-0.4.0.tar.gz | 14.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tgpy-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.5 kB
Release files / tgpy-0.4.0.tar.gz
| Download URL | tgpy-0.4.0.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42bbc782260da913c18e1a4409e0a9d8636f87212497485bc85be445eefef18b
|
|
BLAKE2b-256 checksum How to use checksums |
7873063d32381ddfed248070c935dd7f2cbead3b9562f6ed8c0bebc488b31e8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|
Release files / tgpy-0.4.0-py3-none-any.whl
| Download URL | tgpy-0.4.0-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e73917c4eec1dd7532fa8ce6ae1dc69d12c86b6e90dd40ebdbbe65066496a45
|
|
BLAKE2b-256 checksum How to use checksums |
74174a9274d0d563504fb9267a32fc4761b97f004d94e425b9832ac3bc352f4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|