Changed up saving content, as this sometimes caused the config file to be completely erased
This commit is contained in:
parent
600a704e8b
commit
c95bdcbd96
2 changed files with 1 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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[key] = content
|
||||
jf.seek(0)
|
||||
jf.truncate()
|
||||
|
|
Loading…
Reference in a new issue