1
0
Fork 0
mirror of synced 2024-06-29 19:50:25 +12:00

Changed up saving content, as this sometimes caused the config file to be completely erased

This commit is contained in:
Phxntxm 2016-08-12 14:38:59 -05:00
parent 600a704e8b
commit c95bdcbd96
2 changed files with 1 additions and 5 deletions

View file

@ -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

View file

@ -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()