Пример #1
0
    def __init__(self):
        self.loop = loop
        self.initialised = False
        self.pool = None  # Async init
        self.session = None  # Async init
        self.proc = psutil.Process()
        self.owners = (402159684724719617, 214925855359631360)
        self.starttime = datetime.datetime.utcnow()

        self.defaults = {'eviee ', 'eviee pls ', '>>', 'eviee pls'}  # Prefix Defaults
        self.lru_prefix = utils.EvieeLRU(name='Prefix LRU', limit=120)
        self.lru_blocks = utils.EvieeLRU(name='Blocks LRU', limit=500)
        self._wspings = deque(maxlen=60)
        self._rtts = deque(maxlen=60)

        self._config = config
        self._abstract_commands = None
        self._reconnecting = asyncio.Event()
        self._last_result = None
        self.categories = {}
        self.extensions_other = {}

        self.fkey = Fernet(config.get('ENCRYPTION', '_token').encode())

        super().__init__(command_prefix=get_prefix)
        self.lavalink = pylava.Connection(bot=self,
                                          password=self._config.get("LL", "value"),
                                          rest_url='http://localhost:2333',
                                          ws_url='ws://localhost:8080')
Пример #2
0
    async def initialize_connection(self):
        self.bot.lava = pylava.Connection(self.bot,
                                          **self.bot.config.lava_creds)
        await self.bot.lava.connect()
        if not self.bot.lava.connected:
            print(
                f'[Error] Couldn"t connect to the Lavalink server, disabling {self.__class__.__name__}'
            )

            def unload_ext(bot):
                bot.unload_extension(f"cogs.{__name__}")

            await self.bot.loop.run_in_executor(None,
                                                partial(unload_ext, self.bot))