25 lines
714 B
Python
25 lines
714 B
Python
|
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:
|
||
|
|