Example #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.")
Example #2
0
from tortoolkit.ttk_client import TortkClient

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")

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

    ttkbot = TortkClient("TorToolkitBot", get_val("API_ID"),
                         get_val("API_HASH"))
    ttkbot.queue = queue
    ttkbot.start(bot_token=get_val("BOT_TOKEN"))

    add_handlers(ttkbot)

    if get_val("IS_VPS"):
        ttkbot.loop.run_until_complete(start_server_async())
    try:
        ttkbot.loop.run_until_complete(get_rstuff())
    except:
        pass

    ttkbot.run_until_disconnected()