scroll- irc bot to play ascii art |
git clone git://git.acid.vegas/scroll.git |
Log | Files | Refs | Archive | README | LICENSE |
commit 7e492906c2e65ac91038a5d20457cdcc3bae26d9
parent a67d02291e0e00912fd9c29ab4ac813f26e66089 Author: acidvegas <acid.vegas@acid.vegas> Date: Tue, 6 Jun 2023 22:22:20 -0400 Fixed database syncing from not parsing the correct tree sha Diffstat:
|
1 file changed, 6 insertions(+), 3 deletions(-) |
diff --git a/scroll.py b/scroll.py @@ -110,16 +110,19 @@ class Bot(): else: await self.listen() finally: + for item in self.loops: + if self.loops[item]: + self.loops[item].cancel() self.loops = dict() self.playing = False self.slow = False await asyncio.sleep(30) async def sync(self): + cache = self.db + self.db = {'root':list()} try: - cache = self.db - self.db = {'root':list()} - sha = json.loads(urllib.request.urlopen('https://api.github.com/repos/ircart/ircart/contents').read().decode('utf-8'))[1]['sha'] + sha = [item['sha'] for item in json.loads(urllib.request.urlopen('https://api.github.com/repos/ircart/ircart/contents').read().decode('utf-8')) if item['path'] == 'ircart'][0] files = json.loads(urllib.request.urlopen(f'https://api.github.com/repos/ircart/ircart/git/trees/{sha}?recursive=true').read().decode('utf-8'))['tree'] for file in files: if file['type'] != 'tree': |