更改Daily类名为Checkin

This commit is contained in:
2025-11-07 22:35:38 +08:00
parent b44871d9a9
commit 4d5154a2ac
2 changed files with 26 additions and 13 deletions

View File

@@ -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 "未签到"}