Ejemplo n.º 1
0
    def __init__(self):
        super().__init__(command_prefix=None)  # implemented in `get_prefix`
        self._session = None
        self._api = None
        self.metadata_loop = None
        self.formatter = SafeFormatter()
        self.loaded_cogs = ["cogs.modmail", "cogs.plugins", "cogs.utility"]
        self._connected = asyncio.Event()
        self.start_time = datetime.utcnow()

        self.config = ConfigManager(self)
        self.config.populate_cache()

        self.threads = ThreadManager(self)

        self.log_file_name = os.path.join(temp_dir, f"{self.token.split('.')[0]}.log")
        self._configure_logging()

        mongo_uri = self.config["mongo_uri"]
        if mongo_uri is None:
            logger.critical("A Mongo URI is necessary for the bot to function.")
            raise RuntimeError

        try:
            self.db = AsyncIOMotorClient(mongo_uri).modmail_bot
        except ConfigurationError as e:
            logger.critical(
                "Your MONGO_URI might be copied wrong, try re-copying from the source again. "
                "Otherwise noted in the following message:"
            )
            logger.critical(e)
            sys.exit(0)

        self.plugin_db = PluginDatabaseClient(self)
        self.startup()
Ejemplo n.º 2
0
    def __init__(self):
        super().__init__(command_prefix=None)  # implemented in `get_prefix`
        self._threads = None
        self._session = None
        self._config = None
        self._db = None

        self._configure_logging()

        self._db = AsyncIOMotorClient(self.config.mongo_uri).modmail_bot
        self._api = SelfHostedClient(self)
        self.plugin_db = PluginDatabaseClient(self)

        self.metadata_task = self.loop.create_task(self.metadata_loop())
        self.autoupdate_task = self.loop.create_task(self.autoupdate_loop())
        self._load_extensions()
Ejemplo n.º 3
0
    def __init__(self):
        super().__init__(command_prefix=None)  # implemented in `get_prefix`
        self._threads = None
        self._session = None
        self._config = None
        self._db = None
        self.start_time = datetime.utcnow()
        self._connected = asyncio.Event()

        self._configure_logging()
        # TODO: Raise fatal error if mongo_uri or other essentials are not found
        self._db = AsyncIOMotorClient(self.config.mongo_uri).modmail_bot
        self._api = ApiClient(self)
        self.plugin_db = PluginDatabaseClient(self)

        self.metadata_task = self.loop.create_task(self.metadata_loop())
        self._load_extensions()
Ejemplo n.º 4
0
    def __init__(self):
        super().__init__(command_prefix=None)  # implemented in `get_prefix`
        self._session = None
        self._api = None
        self.metadata_loop = None
        self.formatter = SafeFormatter()

        self._connected = asyncio.Event()
        self.start_time = datetime.utcnow()

        self.config = ConfigManager(self)
        self.config.populate_cache()

        self.threads = ThreadManager(self)

        self._configure_logging()

        mongo_uri = self.config["mongo_uri"]
        if mongo_uri is None:
            logger.critical(
                "A Mongo URI is necessary for the bot to function.")
            raise RuntimeError

        try:
            self.db = AsyncIOMotorClient(mongo_uri).modmail_bot
        except ConfigurationError as e:
            logger.critical(
                "Your MONGO_URI might be copied wrong, try re-copying from the source again. "
                "Otherwise noted in the following message:")
            logger.critical(str(e))
            sys.exit(0)

        self.plugin_db = PluginDatabaseClient(self)

        logger.line()
        logger.info("┌┬┐┌─┐┌┬┐┌┬┐┌─┐┬┬")
        logger.info("││││ │ │││││├─┤││")
        logger.info("┴ ┴└─┘─┴┘┴ ┴┴ ┴┴┴─┘")
        logger.info("v%s", __version__)
        logger.info("Author: OhlookitsVeld")
        logger.line()

        self._load_extensions()
        logger.line()
Ejemplo n.º 5
0
    def __init__(self):
        super().__init__(command_prefix=None)  # implemented in `get_prefix`
        self._session = None
        self._api = None
        self.metadata_loop = None
        self.formatter = SafeFormatter()
        self.loaded_cogs = ["cogs.modmail", "cogs.plugins", "cogs.utility"]
        self._connected = asyncio.Event()
        self.start_time = datetime.utcnow()

        self.config = ConfigManager(self)
        self.config.populate_cache()

        self.threads = ThreadManager(self)

        self.log_file_name = os.path.join(temp_dir, f"{self.token.split('.')[0]}.log")
        self._configure_logging()

        self.plugin_db = PluginDatabaseClient(self)  # Deprecated
        self.startup()
Ejemplo n.º 6
0
    def __init__(self):
        super().__init__(command_prefix=None)  # implemented in `get_prefix`
        self._session = None
        self._api = None
        self.metadata_loop = None
        self.formatter = SafeFormatter()
        self.loaded_cogs = ["cogs.modmail", "cogs.plugin", "cogs.utilita"]
        self._connected = asyncio.Event()
        self.start_time = datetime.utcnow()

        self.config = ConfigManager(self)
        self.config.populate_cache()

        self.threads = ThreadManager(self)

        self.log_file_name = os.path.join(temp_dir,
                                          f"{self.token.split('.')[0]}.log")
        self._configure_logging()

        mongo_uri = self.config["mongo_uri"]
        if mongo_uri is None:
            logger.critical(
                "Un Mongo URI è necessario per il funzionamento del bot.")
            raise RuntimeError

        try:
            self.db = AsyncIOMotorClient(mongo_uri).modmail_bot
        except ConfigurationError as e:
            logger.critical(
                "Il tuo MONGO_URI potrebbe essere copiato male, prova a ri-copiarlo dalla sorgente. "
                "Otherwise noted in the following message:")
            logger.critical(e)
            sys.exit(0)

        self.plugin_db = PluginDatabaseClient(self)
        self.startup()