Skip to main content

Run Python code right in your Telegram messages

Project description

TGPy Logo

Runs Python code snippets
within your Telegram messages

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


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.

Quick Start

Python 3.10+ required. Install TGPy and connect it to your Telegram account:

> pip install tgpy
> tgpy

You’re ready now. Send Python code to any chat, and it will run. Change your message to change the result. Read more on installation

Learn

🙂 Basics Guide

😎 Extensibility Guide

📗 Reference

💬 Russian-Speaking Chat

Demo

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


A message processed with TGPy Finding out the number of premium users in a chat

Inspiration

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.

Credits

TGPy is built on Telethon, a Python library to interact with Telegram API.

Basic code transformation (such as auto-return of values) is based on meval.

License

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tgpy-0.9.7.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

tgpy-0.9.7-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file tgpy-0.9.7.tar.gz.

File metadata

  • Download URL: tgpy-0.9.7.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.28.2 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.64.1 importlib-metadata/6.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.12

File hashes

Hashes for tgpy-0.9.7.tar.gz
Algorithm Hash digest
SHA256 47108f2ce9ad19f5ff33af0e785a0fd6b88219b82c4ed0d6d8b832fb3d48a927
MD5 1b0cd9355ed823982714c73c0b32253b
BLAKE2b-256 b4b9a4550a3bd318f228d572a7ef78e10af3769fbe5ea7805099b38b95d24f86

See more details on using hashes here.

File details

Details for the file tgpy-0.9.7-py3-none-any.whl.

File metadata

  • Download URL: tgpy-0.9.7-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.28.2 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.64.1 importlib-metadata/6.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.12

File hashes

Hashes for tgpy-0.9.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8b075cc25aa175941bce852c16023909808ccd91655f33d79fc88a30757a7ce1
MD5 81aca1c5efeaf1e2086bde3660d44bff
BLAKE2b-256 995ded1e9f9ccd575d7b775f9656123719fefa1d1a4414d54a25319d5e4b7187

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page