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