Last active
April 5, 2021 11:36
-
-
Save CustomIcon/9dd8f3bcb884553bbff20f6b95db832a to your computer and use it in GitHub Desktop.
A Console made to debug pyrogram methods (for personal use~)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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