From 7e492906c2e65ac91038a5d20457cdcc3bae26d9 Mon Sep 17 00:00:00 2001 From: acidvegas Date: Tue, 6 Jun 2023 22:22:20 -0400 Subject: [PATCH] Fixed database syncing from not parsing the correct tree sha --- scroll.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scroll.py b/scroll.py index bb89955..5b7475d 100644 --- 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':