Skip to content


Control functions

Function Description
ping() Return basic info about your TGPy instance. Use ping() to check if TGPy is running.
restart() Restart TGPy.
update() Download the latest version of TGPy, update, and restart the instance.

Telethon objects

Object Description
client The Telethon client. See Telethon Client reference
msg The current message. See Telethon Message reference
orig Original message: the message you replied to. See Telethon Message reference


TGPy fetches orig message only if your code uses the orig variable. That’s because it requires an additional request to Telegram API.


Read on modules

Object Description
modules Object for module management.
modules.add(name: str, code: str) Add the given code as a module. If code isn’t specified, the code from the orig message will be added.
modules.remove(name: str) Remove the module named name.


Read on the ctx object

Object Description
ctx.msg The message where the code is running.
ctx.is_module True if the code is running from a module.
ctx.is_manual_output Can be set to True to prevent the last message edit by TGPy so you can edit it yourself.