Beispiel #1
0
if __name__ == "__main__":

    #logging stuff
    #thread name is just kept for future use
    logging.basicConfig(
        level=logging.INFO,
        format="%(asctime)s %(levelname)s %(threadName)s %(name)s %(message)s")
    logging.getLogger("pyrogram").setLevel(logging.ERROR)

    # parallel connections limiter
    queue = asyncio.Queue()
    for i in range(1, 4):
        queue.put_nowait(i)

    # Telethon client creation
    ttkbot = TortkClient("TorToolkitBot", get_val("API_ID"),
                         get_val("API_HASH"))
    ttkbot.queue = queue
    ttkbot.start(bot_token=get_val("BOT_TOKEN"))
    logging.info("Telethon Client created.")

    # Pyro Client creation and linking
    pyroclient = Client("pyrosession",
                        api_id=get_val("API_ID"),
                        api_hash=get_val("API_HASH"),
                        bot_token=get_val("BOT_TOKEN"),
                        workers=343)
    pyroclient.start()
    ttkbot.pyro = pyroclient
    logging.info("Pryogram Client created.")

    # Associate the handlers
Beispiel #2
0
    # parallel connections limiter
    queue = asyncio.Queue()
    exqueue = asyncio.Queue()

    for i in range(1, 4):
        queue.put_nowait(i)

    for i in range(1, 5):
        exqueue.put_nowait(i)

    # Telethon client creation
    ttkbot = TortkClient("TorToolkitBot",
                         get_val("API_ID"),
                         get_val("API_HASH"),
                         timeout=20,
                         retry_delay=3,
                         request_retries=10,
                         connection_retries=10)
    ttkbot.queue = queue
    ttkbot.exqueue = exqueue
    ttkbot.start(bot_token=get_val("BOT_TOKEN"))
    logging.info("Telethon Client created.")

    # Pyro Client creation and linking
    pyroclient = Client("pyrosession",
                        api_id=get_val("API_ID"),
                        api_hash=get_val("API_HASH"),
                        bot_token=get_val("BOT_TOKEN"),
                        workers=100)
    pyroclient.start()