From c95bdcbd9693676102c17921fac4809271dca115 Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Fri, 12 Aug 2016 14:38:59 -0500 Subject: [PATCH] Changed up saving content, as this sometimes caused the config file to be completely erased --- cogs/core.py | 1 - cogs/utils/config.py | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/cogs/core.py b/cogs/core.py index 82b1e86..f06d105 100644 --- a/cogs/core.py +++ b/cogs/core.py @@ -106,7 +106,6 @@ class Core: try: dice = re.search("(\d*)d(\d*)", notation).group(1) num = int(re.search("(\d*)d(\d*)", notation).group(2)) - # This error will be hit if the notation is completely different than #d# except (AttributeError, ValueError): await self.bot.say("Please provide the die notation in #d#!") return diff --git a/cogs/utils/config.py b/cogs/utils/config.py index a874c91..7d15d97 100644 --- a/cogs/utils/config.py +++ b/cogs/utils/config.py @@ -34,10 +34,7 @@ except KeyError: def saveContent(key: str, content): with open("config.json", "a+") as jf: - try: - data = json.load(jf) - except json.JSONDecodeError: - data = {} + data = json.load(jf) data[key] = content jf.seek(0) jf.truncate()