mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 11:48:55 -05:00
[V3 Config] Fix clear throwing errors (#1374)
This commit is contained in:
parent
f378ea0d2e
commit
c9281f734b
@ -62,10 +62,11 @@ class JSON(BaseDriver):
|
||||
async def clear(self, *identifiers: str):
|
||||
partial = self.data
|
||||
full_identifiers = (self.unique_cog_identifier, *identifiers)
|
||||
try:
|
||||
for i in full_identifiers[:-1]:
|
||||
if i not in partial:
|
||||
break
|
||||
partial = partial[i]
|
||||
else:
|
||||
del partial[identifiers[-1]]
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
await self.jsonIO._threadsafe_save_json(self.data)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user