更新基础内容
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -183,6 +183,6 @@ cython_debug/
|
||||
.vscode/
|
||||
|
||||
# Database
|
||||
data/bot.db
|
||||
Assets/db.db
|
||||
liubai_web.pid
|
||||
Assets/config_log.txt
|
||||
@@ -44,3 +44,10 @@ Yolo模式: Off
|
||||
- 原因:提供用户名、个人URL及积分的统一管理入口
|
||||
- 阻碍因素:无
|
||||
- 状态:未确认
|
||||
|
||||
[2025-11-07_手动更新]
|
||||
- 已修改: Plugins/WPSDailyAPI
|
||||
- 更改: 放弃ES, 重新转向数据库持久化
|
||||
- 原因: 统一接口并实时读写
|
||||
- 阻碍因素: 无
|
||||
- 状态: 未确认
|
||||
|
||||
BIN
Assets/db.db
BIN
Assets/db.db
Binary file not shown.
2
PWF
2
PWF
Submodule PWF updated: a1b3f51b61...477fbf1876
@@ -52,7 +52,7 @@ class MessageSender:
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
config.Log("Error", f"发送消息异常: {e}", exc_info=True)
|
||||
config.Log("Error", f"发送消息异常: {e}")
|
||||
return False
|
||||
|
||||
async def send_text(self, content: str, at_user_id: Optional[int] = None) -> bool:
|
||||
@@ -181,6 +181,7 @@ class BasicWPSInterface(PluginInterface):
|
||||
return None
|
||||
|
||||
result = await self.get_message_sender_function(webhook_url, self.get_message_sender_type())(message)
|
||||
if get_internal_verbose():
|
||||
config.Log("Info", f"Webhook URL: {webhook_url}, Message: {LimitStringLength(message)}, Result: {result}")
|
||||
return None
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class WPSConfigAPI(WPSAPI):
|
||||
return DatabaseModel(
|
||||
table_name="user_info",
|
||||
column_defs={
|
||||
"user_id": "INTEGER",
|
||||
"user_id": "INTEGER PRIMARY KEY",
|
||||
"username": "TEXT DEFAULT ''",
|
||||
"userurl": "TEXT DEFAULT ''",
|
||||
"userpoint": "INTEGER DEFAULT 0"
|
||||
@@ -60,18 +60,6 @@ class WPSConfigAPI(WPSAPI):
|
||||
message = await self.do_callback(message, chat_id, user_id)
|
||||
return await self.send_markdown_message(message, chat_id, user_id)
|
||||
|
||||
# def _parse_delta(self, action: str, token: str) -> Optional[int]:
|
||||
# try:
|
||||
# delta = int(token)
|
||||
# except ValueError:
|
||||
# return None
|
||||
#
|
||||
# if action == "add":
|
||||
# return abs(delta)
|
||||
# if action == "sub":
|
||||
# return -abs(delta)
|
||||
# return delta
|
||||
|
||||
async def _handle_set(self, chat_id: int, user_id: int, key: str, value: str) -> str:
|
||||
if key == "user.name":
|
||||
if not value:
|
||||
@@ -127,7 +115,7 @@ class WPSConfigAPI(WPSAPI):
|
||||
return self._adjust_db_points(user_id, delta)
|
||||
|
||||
def _get_user_record(self, user_id: int) -> Optional[Dict[str, Any]]:
|
||||
cursor = self._db.conn.cursor()
|
||||
cursor = get_db().conn.cursor()
|
||||
cursor.execute(
|
||||
"SELECT user_id, username, userurl, userpoint FROM user_info WHERE user_id = ?",
|
||||
(user_id,)
|
||||
@@ -136,7 +124,7 @@ class WPSConfigAPI(WPSAPI):
|
||||
return dict(row) if row else None
|
||||
|
||||
def _ensure_user_row(self, user_id: int) -> None:
|
||||
cursor = self._db.conn.cursor()
|
||||
cursor = get_db().conn.cursor()
|
||||
cursor.execute(
|
||||
"INSERT INTO user_info (user_id) VALUES (?) ON CONFLICT(user_id) DO NOTHING",
|
||||
(user_id,)
|
||||
@@ -144,7 +132,7 @@ class WPSConfigAPI(WPSAPI):
|
||||
|
||||
def _update_user_field(self, user_id: int, column: str, value: Any) -> None:
|
||||
self._ensure_user_row(user_id)
|
||||
cursor = self._db.conn.cursor()
|
||||
cursor = get_db().conn.cursor()
|
||||
cursor.execute(
|
||||
f"""
|
||||
INSERT INTO user_info (user_id, {column}) VALUES (?, ?)
|
||||
@@ -155,7 +143,7 @@ class WPSConfigAPI(WPSAPI):
|
||||
|
||||
def _adjust_db_points(self, user_id: int, delta: int) -> int:
|
||||
self._ensure_user_row(user_id)
|
||||
cursor = self._db.conn.cursor()
|
||||
cursor = get_db().conn.cursor()
|
||||
cursor.execute(
|
||||
"UPDATE user_info SET userpoint = COALESCE(userpoint, 0) + ? WHERE user_id = ?",
|
||||
(delta, user_id)
|
||||
@@ -194,16 +182,11 @@ class WPSConfigAPI(WPSAPI):
|
||||
return await self._adjust_points(chat_id, user_id, delta, reason)
|
||||
|
||||
def _help_message(self) -> str:
|
||||
return (
|
||||
"🛠️ Config 命令帮助:\n"
|
||||
"config set user.name <用户名>\n"
|
||||
"config set user.url <URL>\n"
|
||||
#"config set user.point <整数>\n"
|
||||
"config get user.name|user.url|user.point\n"
|
||||
#"config adjust user.point <整数> [原因]\n"
|
||||
#"config add user.point <整数> [原因]\n"
|
||||
#"config sub user.point <整数> [原因]"
|
||||
)
|
||||
return '''# 🛠️ Config 命令帮助
|
||||
- config set user.name <用户名>
|
||||
- config set user.url <URL>
|
||||
- config get user.name|user.url|user.point
|
||||
'''
|
||||
|
||||
|
||||
class WPSDailyAPI(WPSAPI):
|
||||
@@ -237,6 +220,11 @@ class WPSDailyAPI(WPSAPI):
|
||||
message = await self.do_callback(message, chat_id, user_id)
|
||||
return await self.send_markdown_message(message, chat_id, user_id)
|
||||
|
||||
def _help_message(self) -> str:
|
||||
return '''# 📅 Daily 命令帮助
|
||||
- daily checkin: 签到
|
||||
- daily get: 获取今日签到状态
|
||||
'''
|
||||
|
||||
config.SaveProperties()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user