diff --git a/main.py b/main.py new file mode 100644 index 0000000..b5c9af6 --- /dev/null +++ b/main.py @@ -0,0 +1,24 @@ +import os +import sys +import time + +#Gettit with pip bro +from telethon import TelegramClient, events, utils + +def get_env(name, message, cast=str): + if name in os.environ: + return os.environ[name] + while True: + value = input(message) + try: + return cast(value) + except ValueError as e: + print(e, file=sys.stderr) + time.sleep(1) +sesion = get_env('TG_SESION', 'Enter your API sesion name: ') +api_id = get_env('TG_API_ID', 'Enter your API ID: ', int) +api_hash = get_env('TG_API_HASH', 'Enter your API hash: ') + +# Create and start the client so we can make requests (we don't here) +with TelegramClient(sesion, api_id, api_hash).start() as client: +