From 78753e1cc5643d8ca5dc01d431d014794ad6360b Mon Sep 17 00:00:00 2001 From: Inkar-Suki Date: Thu, 11 Jul 2024 20:06:09 +0800 Subject: [PATCH] [feat]keyerror --- src/plugins/ban/__init__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/plugins/ban/__init__.py b/src/plugins/ban/__init__.py index 3bee7ef0..cdb24ef5 100644 --- a/src/plugins/ban/__init__.py +++ b/src/plugins/ban/__init__.py @@ -138,4 +138,20 @@ async def _(bot: Bot, event: Event, confirm: Message = Arg()): if u_input == "重置音卡": if os.path.exists(DATA + "/" + str(event.group_id)): shutil.rmtree(DATA + "/" + str(event.group_id)) + group_id = str(event.group_id) + files = { + "blacklist.json": [], + "settings.json": {"server": "", "group": group_id, "subscribe": [], "addtions": [], "welcome": "欢迎入群!"}, + "webhook.json": [], + "opening.json": [], + "wiki.json": {"startwiki":"","interwiki":[]}, + "record.json": [] + } + status = [] + for i in list(files): + if os.path.exists(DATA + "/" + group_id + "/" + i): + status.append(True) + continue + status.append(False) + write(DATA + "/" + group_id + "/" + i, json.dumps(files[i])) await dismiss.send("重置成功!可以重新开始绑定本群数据了!") \ No newline at end of file