From 45898287a9c98cdc54494cc2e6a73ad820d8e43b Mon Sep 17 00:00:00 2001 From: Julio Date: Tue, 15 Oct 2019 17:49:30 +0200 Subject: [PATCH] init --- main.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 main.py 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: +