main.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:Pixie 作者: GetRektByMe 项目源码 文件源码
def run(self):
        # We load plugins in run rather than on_ready due to on_ready being able to be called multiple times
        for plugin in plugins:
            # We try to load the extension, and we account for if it fails
            try:
                self.load_extension(plugin)
                self.logger.info("{0} has been loaded".format(plugin))
            # Except discord.ClientException so it doesn't fail to load all cogs when a cog doesn't have a setup function
            except discord.ClientException:
                self.logger.critical("{0} does not have a setup function!".format(plugin))
            # Except import error (importlib raises this) so bot doesn't crash when it's raised
            except ImportError as IE:
                self.logger.critical(IE)
        # We check if discord.opus is loaded, despite it not having a reason to be
        if not discord.opus.is_loaded():
            # Load discord.opus so we can use voice
            discord.opus.load_opus()
            self.logger.info("Opus has been loaded")
        super().run(setup_file["discord"]["token"])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号