Skip to content

Instantly share code, notes, and snippets.

@CustomIcon
Last active April 5, 2021 11:36
Show Gist options
  • Save CustomIcon/9dd8f3bcb884553bbff20f6b95db832a to your computer and use it in GitHub Desktop.
Save CustomIcon/9dd8f3bcb884553bbff20f6b95db832a to your computer and use it in GitHub Desktop.
A Console made to debug pyrogram methods (for personal use~)
# Requires Pyrogram==1.0.7 and up
# Client is binded to variable 'c'
# --Example:
# pyrogram-debug$: c.send_message('pyrogramlounge', '@jonakek is still gay')
#
# you can even pass the Client obj into print() in console to get the json response
# --Example:
# pyrogram-debug$: print(c.send_message('pyrogramlounge', '@haskell new pyrogram update wen'))
# Returns:
# json
from pyrogram import (
Client,
types,
raw
)
api_id = 0 # YOUR API_ID
api_hash = '' # YOUR API_HASH
with Client(
'debug',
api_id=api_id,
api_hash=api_hash,
app_version='debug_console'
) as c:
while True:
try:
a = input('pyrogram-debug$: ')
except KeyboardInterrupt:
print('\nexiting')
quit()
try:
eval(a)
print('- Success!')
except Exception as err:
print(f'- Error: {err}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment