From 9db69fa05bdd9da10c6feedff39ed95c4505f167 Mon Sep 17 00:00:00 2001 From: McElaga <1728903318@qq.com> Date: Sat, 18 Jun 2022 09:15:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E7=82=B9?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=B0=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/query_user/resin_remind/init_task.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/genshin/query_user/resin_remind/init_task.py b/plugins/genshin/query_user/resin_remind/init_task.py index d412d822..cc535930 100644 --- a/plugins/genshin/query_user/resin_remind/init_task.py +++ b/plugins/genshin/query_user/resin_remind/init_task.py @@ -149,12 +149,12 @@ async def _remind(user_id: int, uid: str): if current_resin < max_resin: user_manager.remove(uid) user_manager.remove_overflow(uid) - if current_resin <= max_resin - 40: - next_time = now + timedelta(minutes=(max_resin - 40 - current_resin + 1) * 8, seconds=10) - elif max_resin - 40 < current_resin <= max_resin - 20: - next_time = now + timedelta(minutes=(max_resin - 20 - current_resin + 1) * 8, seconds=10) - elif max_resin - 20 < current_resin < max_resin: - next_time = now + timedelta(minutes=(max_resin - current_resin) * 8, seconds=10) + if current_resin < max_resin - 40: + next_time = now + timedelta(minutes=(max_resin - 40 - current_resin) * 8) + elif max_resin - 40 <= current_resin < max_resin - 20: + next_time = now + timedelta(minutes=(max_resin - 20 - current_resin) * 8) + elif max_resin - 20 <= current_resin < max_resin: + next_time = now + timedelta(minutes=(max_resin - current_resin) * 8) elif current_resin == max_resin: custom_overflow_resin = Config.get_config("resin_remind", "CUSTOM_RESIN_OVERFLOW_REMIND") if user_manager.is_overflow(uid) and custom_overflow_resin: From ae466931fa0db779d280285c5844f611a5bc9f90 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Sun, 19 Jun 2022 16:44:37 +0800 Subject: [PATCH 2/3] fix webui --- README.md | 5 ++++- plugins/web_ui/__init__.py | 40 ++++++++++++++++++++++++-------------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index faab367d..6ce58b5d 100644 --- a/README.md +++ b/README.md @@ -243,9 +243,12 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__ ## 更新 +### 2022/6/19 + +* 暂时使用hook修复webui中plugins2setting修改时会改变plugins2setting.cmd为字符串 + ### 2022/6/18 -* 修复webui中plugins2setting修改时会改变plugins2setting.cmd为字符串 * 修复昵称系统`BLACK_WORD`为空时造成报错 * 修复特殊头像时背景透明化出错 * 修复text2image纯文本时换行时颜色不统一 diff --git a/plugins/web_ui/__init__.py b/plugins/web_ui/__init__.py index 189d847e..9a47fb47 100644 --- a/plugins/web_ui/__init__.py +++ b/plugins/web_ui/__init__.py @@ -1,20 +1,30 @@ from configs.config import Config as gConfig from .api import * from .auth import * - - -gConfig.add_plugin_config( - "web-ui", - "username", - "admin", - name="web-ui", - help_="前端管理用户名" +from nonebot.matcher import Matcher +from nonebot.message import run_preprocessor, IgnoredException +from utils.manager import plugins2settings_manager +from nonebot.typing import T_State +from nonebot.adapters.onebot.v11 import ( + Bot, + MessageEvent ) -gConfig.add_plugin_config( - "web-ui", - "password", - None, - name="web-ui", - help_="前端管理密码" -) + +gConfig.add_plugin_config("web-ui", "username", "admin", name="web-ui", help_="前端管理用户名") + +gConfig.add_plugin_config("web-ui", "password", None, name="web-ui", help_="前端管理密码") + + +# 使用webui访问api后plugins2settings中的cmd字段将从list变为str +# 暂时找不到原因 +# 先使用hook修复 +@run_preprocessor +async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State): + for module in plugins2settings_manager.keys(): + if isinstance(plugins2settings_manager.get_plugin_data(module).get("cmd"), str): + plugins2settings_manager.set_module_data( + module, + "cmd", + plugins2settings_manager.get_plugin_data(module).get("cmd").split(","), + ) From ad7377828610e234a090f7427114f39d6f0e8d14 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Sun, 19 Jun 2022 16:55:02 +0800 Subject: [PATCH 3/3] update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6ce58b5d..f8773e91 100644 --- a/README.md +++ b/README.md @@ -246,6 +246,7 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__ ### 2022/6/19 * 暂时使用hook修复webui中plugins2setting修改时会改变plugins2setting.cmd为字符串 +* 修复原神树脂重复提醒的bug [@pull/828](https://github.com/HibiKier/zhenxun_bot/pull/828) ### 2022/6/18