Example #1
0
 def __init__(self):
     super().__init__(command_prefix=self.get_pre)
     self.version = __version__
     self.start_time = datetime.datetime.utcnow()
     self.threads = ThreadManager(self)
     self.session = aiohttp.ClientSession(loop=self.loop)
     self.config = ConfigManager(self)
     self.selfhosted = bool(self.config.get('mongo_uri'))
     if self.selfhosted:
         self.db = AsyncIOMotorClient(self.config.mongo_uri).modmail_bot
     self.modmail_api = SelfhostedClient(self) if self.selfhosted else ModmailApiClient(self)
     self.data_task = self.loop.create_task(self.data_loop())
     self.autoupdate_task = self.loop.create_task(self.autoupdate_loop())
     self._add_commands()
Example #2
0
    def __init__(self):
        super().__init__(command_prefix=None)  # implemented in `get_prefix`
        self._threads = None
        self._session = None
        self._config = None
        self._connected = asyncio.Event()
        self._db = None

        if self.self_hosted:
            self._db = AsyncIOMotorClient(self.config.mongo_uri).modmail_bot
            self._api = SelfHostedClient(self)
        else:
            self._api = ModmailApiClient(self)

        self.data_task = self.loop.create_task(self.data_loop())
        self.autoupdate_task = self.loop.create_task(self.autoupdate_loop())
        self._load_extensions()
        self.owner = None