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:
for i in range(5):
print(i)
import asyncio
await asyncio.sleep(5)
await msg.delete()
orig.forward_to('Chat title')
photos = await client.get_profile_photos(msg.chat)
msg.reply(file=photos)
def save():
message = ctx.msg
original = await message.get_reply_message()
await original.forward_to('me')
return 'Saved!'
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.