from pyrogram import Client

from config import API_HASH, API_ID

from .logs import LOGGER


class userBot(Client):
    def __init__(self):
        super().__init__(
            name="session/movieo=spanner-cli",
            api_id=API_ID,
            api_hash=API_HASH,
            plugins=dict(root="base/plugins"),
            sleep_threshold=60,
            workers=32,
            # max_concurrent_transmissions=5
            )

    async def start(self):
        await super().start()
        me = await self.get_me()
        text = f"New session started for {me.first_name}({me.username})"
        LOGGER.info(text)

    async def stop(self):
        await super().stop()
        LOGGER.info("Session stopped. Bye!!")
