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()
评论列表
文章目录