更改Daily类名为Checkin
This commit is contained in:
@@ -46,7 +46,7 @@ Yolo模式: Off
|
||||
- 状态:未确认
|
||||
|
||||
[2025-11-07_手动更新]
|
||||
- 已修改: Plugins/WPSDailyAPI
|
||||
- 已修改: Plugins/ConfigPlugin.py->Plugins/WPSDailyAPI
|
||||
- 更改: 放弃ES, 重新转向数据库持久化
|
||||
- 原因: 统一接口并实时读写
|
||||
- 阻碍因素: 无
|
||||
@@ -57,3 +57,10 @@ Yolo模式: Off
|
||||
- 更改: 完成签到功能与对应的提示功能
|
||||
- 阻碍因素: 无
|
||||
- 状态: 成功
|
||||
|
||||
[2025-11-07_22:33:00]
|
||||
- 已修改: Plugins/WPSDailyAPI->Plugins/WPSPointSystem
|
||||
- 更改: 更改Daily类名为Checkin
|
||||
- 原因: 原Daily类提供的功能不足以使用Daily的名称
|
||||
- 阻碍因素: 无
|
||||
- 状态: 成功
|
||||
|
||||
@@ -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 "未签到"}
|
||||
Reference in New Issue
Block a user