From 4d5154a2acb45dfad6a82db1a52e89dd84430e4b Mon Sep 17 00:00:00 2001 From: ninemine <1371605831@qq.com> Date: Fri, 7 Nov 2025 22:35:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9Daily=E7=B1=BB=E5=90=8D?= =?UTF-8?q?=E4=B8=BACheckin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .tasks/2025-11-06_1_migrate-game-bot.md | 11 ++++++-- Plugins/{WPSDailyAPI.py => WPSPointSystem.py} | 28 +++++++++++-------- 2 files changed, 26 insertions(+), 13 deletions(-) rename Plugins/{WPSDailyAPI.py => WPSPointSystem.py} (92%) diff --git a/.tasks/2025-11-06_1_migrate-game-bot.md b/.tasks/2025-11-06_1_migrate-game-bot.md index bc0acde..06930e0 100644 --- a/.tasks/2025-11-06_1_migrate-game-bot.md +++ b/.tasks/2025-11-06_1_migrate-game-bot.md @@ -46,7 +46,7 @@ Yolo模式: Off - 状态:未确认 [2025-11-07_手动更新] -- 已修改: Plugins/WPSDailyAPI +- 已修改: Plugins/ConfigPlugin.py->Plugins/WPSDailyAPI - 更改: 放弃ES, 重新转向数据库持久化 - 原因: 统一接口并实时读写 - 阻碍因素: 无 @@ -56,4 +56,11 @@ Yolo模式: Off - 已修改: Plugins/WPSDailyAPI - 更改: 完成签到功能与对应的提示功能 - 阻碍因素: 无 -- 状态: 成功 \ No newline at end of file +- 状态: 成功 + +[2025-11-07_22:33:00] +- 已修改: Plugins/WPSDailyAPI->Plugins/WPSPointSystem +- 更改: 更改Daily类名为Checkin +- 原因: 原Daily类提供的功能不足以使用Daily的名称 +- 阻碍因素: 无 +- 状态: 成功 diff --git a/Plugins/WPSDailyAPI.py b/Plugins/WPSPointSystem.py similarity index 92% rename from Plugins/WPSDailyAPI.py rename to Plugins/WPSPointSystem.py index 6e0e1b0..e7e40ad 100644 --- a/Plugins/WPSDailyAPI.py +++ b/Plugins/WPSPointSystem.py @@ -190,7 +190,7 @@ class WPSConfigAPI(WPSAPI): ''' -class WPSDailyAPI(WPSAPI): +class WPSCheckinAPI(WPSAPI): @override def dependencies(self) -> List[Type]: return [WPSAPI] @@ -201,8 +201,9 @@ class WPSDailyAPI(WPSAPI): @override def wake_up(self) -> None: - config.Log("Info", f"{ConsoleFrontColor.GREEN}WPSDailyAPI 插件已加载{ConsoleFrontColor.RESET}") - self.register_plugin("daily") + config.Log("Info", f"{ConsoleFrontColor.GREEN}WPSCheckinAPI 插件已加载{ConsoleFrontColor.RESET}") + self.register_plugin("checkin") + self.register_plugin("签到") @override def register_db_model(self) -> DatabaseModel: @@ -226,13 +227,18 @@ class WPSDailyAPI(WPSAPI): get_db().conn.commit() async def do_callback(self, message: str, chat_id: int, user_id: int) -> Optional[str]: - tokens = [token.strip() for token in message.strip().split() if token.strip()] - if not tokens: - return self._help_message(chat_id, user_id) - action = tokens[0].lower() - if action == "checkin": - return await self._handle_checkin(chat_id, user_id) - return self._help_message() + checkin_message = await self._handle_checkin(chat_id, user_id) + return f"""{checkin_message} +--- +{self._help_message(chat_id, user_id)} +""" + # tokens = [token.strip() for token in message.strip().split() if token.strip()] + # if not tokens: + # return self._help_message(chat_id, user_id) + # action = tokens[0].lower() + # if action == "checkin": + # return await self._handle_checkin(chat_id, user_id) + # return self._help_message() async def _handle_checkin(self, chat_id: int, user_id: int) -> str: wps_config_api: "WPSConfigAPI" = Architecture.Get(WPSConfigAPI) @@ -250,7 +256,7 @@ class WPSDailyAPI(WPSAPI): def _help_message(self, chat_id: int, user_id: int) -> str: wps_config_api: "WPSConfigAPI" = Architecture.Get(WPSConfigAPI) return f'''# 📅 Daily 命令帮助 -- daily checkin: 签到 +- checkin: 签到 --- - 当前分数: {wps_config_api.get_user_points(chat_id, user_id)} - 今日签到状态: {"已签到" if self._get_today_checkin_status(user_id) else "未签到"}