From 98da433945116bc83fde3b43398418711889edd8 Mon Sep 17 00:00:00 2001 From: lowking <33308659+lowking@users.noreply.github.com> Date: Wed, 10 Nov 2021 13:25:23 +0800 Subject: [PATCH] =?UTF-8?q?eat=20=E6=B7=BB=E5=8A=A0=E6=96=B0=E6=8C=87?= =?UTF-8?q?=E4=BB=A4=E6=9F=A5=E7=9C=8B=E7=9B=AE=E5=89=8D=E5=B7=B2=E6=9C=89?= =?UTF-8?q?=E6=89=80=E6=9C=89=E6=A8=A1=E7=89=88=20(#198)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(eat): support list all template id * chore(eat): update version Co-authored-by: Xtao_dada --- eat.py | 17 ++++++++++++++++- list.json | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/eat.py b/eat.py index 5c39464..a375b94 100644 --- a/eat.py +++ b/eat.py @@ -145,7 +145,8 @@ def mergeDict(d1, d2): "可选:当第二个参数是数字时,读取预存的配置;\n\n" "当第二个参数是.开头时,头像旋转180°,并且判断r后面是数字则读取对应的配置生成\n\n" "当第二个参数是/开头时,在/后面加url则从url下载配置文件保存到本地,如果就一个/,则直接更新配置文件,删除则是/delete\n\n" - "当第二个参数是-开头时,在d后面加上模版id,即可设置默认模版-eat直接使用该模版,删除默认模版是-eat -", + "当第二个参数是-开头时,在d后面加上模版id,即可设置默认模版-eat直接使用该模版,删除默认模版是-eat -\n\n" + "当第二个参数是!或者!开头时,列出当前可用模版", parameters=" [随意内容]") async def eat(context): if len(context.parameter) > 2: @@ -265,6 +266,20 @@ async def eat(context): else: await context.edit(f"从远程更新配置文件成功") return + elif p1[0] == "!" or p1[0] == "!": + # 加载配置 + if exists(configFilePath): + if await loadConfigFile(configFilePath, context) != 0: + await context.edit(f"加载配置文件异常,请确认从远程下载的配置文件格式是否正确") + return + txt = "" + if len(positions) > 0: + for key in positions: + txt = f"{txt},{key}" + if txt != "": + txt = txt[1:] + await context.edit(f"目前已有的模版列表如下:\n{txt}") + return defaultConfig = redis.get("eat.default-config") if isinstance(p2, str): number = p2 diff --git a/list.json b/list.json index 2cace94..b362094 100644 --- a/list.json +++ b/list.json @@ -202,7 +202,7 @@ }, { "name": "eat", - "version": "1.033", + "version": "1.034", "section": "profile", "maintainer": "SF_PICK", "size": "6.4 kb",