import pprint from ..config import Telegram from pyrogram import Client from pyrogram.session import Session if Telegram.SECONDARY: plugins = None no_updates = True else: plugins = dict(root="FileStream/bot/plugins") no_updates = False # Create a custom session object with the sqlite.cloud connection string #session = Session( # api_id=Telegram.API_ID, # api_hash=Telegram.API_HASH, # db_uri="sqlitecloud://cgz1np12hz.g1.sqlite.cloud:8860/FileStream?apikey=NnfEaSHjnV1jpSUMlRMzm3agsn5jUb0dymlnCUXS2k8", # Set the custom database URI #) FileStream = Client( name="FileStream", api_id=Telegram.API_ID, api_hash=Telegram.API_HASH, workdir="FileStream", plugins=plugins, bot_token=Telegram.BOT_TOKEN, sleep_threshold=Telegram.SLEEP_THRESHOLD, workers=Telegram.WORKERS, no_updates=no_updates, ) WORK_LOADS = {} MULTI_CLIENTS = {} ACTIVE_CLIENTS = {} async def req_client(PUBLIC_IP:str)-> dict: index = min(WORK_LOADS, key=WORK_LOADS.get) faster_client = MULTI_CLIENTS[index] print("WorkLoads :",WORK_LOADS) return dict(index=index,public_ip=PUBLIC_IP, client=faster_client)