github.py 文件源码

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

项目:GeBeO 作者: professional-programmingers 项目源码 文件源码
def __init__(self, bot : commands.Bot):
        print("initializing github tracker")
        self.bot = bot
        # Registered channel format:
        # {channel_id : ("repo", "owner/repo")}
        # {"167319706863140864" : ("repo", "professional-programmingers/GeBeO")}
        self.registered_channels = {}
        self.file_name = "cache/github.json"
        self.api_base = "https://api.github.com/"

        # Create a cache dir if it doesn't exists.
        if not os.path.exists("cache"):
            os.makedirs("cache")

        # Check for cache file.
        if os.path.isfile(self.file_name) and os.stat(self.file_name).st_size != 0:
            f = open(self.file_name, "r")
            self.registered_channels = json.loads(f.read())
        else:
            f = open(self.file_name, "w+")
        f.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号