data.py 文件源码

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

项目:InfoBot 作者: gdude2002 项目源码 文件源码
def load_server(self, server_id) -> bool:
        if not os.path.exists("data/{}".format(server_id)):
            return False

        log.debug("Loading server: {}".format(server_id))

        config = yaml.safe_load(open("data/{}/config.yml".format(server_id), "r"))
        sections = yaml.safe_load(open("data/{}/sections.yml".format(server_id), "r"))

        if os.path.exists("data/{}/notes.yml".format(server_id)):
            notes = yaml.safe_load(open("data/{}/notes.yml".format(server_id), "r"))
        else:
            notes = DEFAULT_NOTES

        if "notes_channel" not in config:
            config["notes_channel"] = None

        self.data[server_id] = {
            "config": config,
            "sections": self.load_sections(sections)
        }

        self.notes[server_id] = notes

        return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号