feat: 添加状态监控插件和Redis原子操作支持
- 新增 `/status` 指令,展示机器人运行状态和系统指标 - 实现Redis Lua脚本支持原子化计数器操作 - 添加消息收发统计功能 - 完善文档,包括插件开发和性能优化指南 - 重构WebSocket连接池,增加健康检查机制 - 移除旧版编译脚本,优化项目结构
This commit is contained in:
@@ -84,3 +84,76 @@ class FriendAPI(BaseAPI):
|
||||
"""
|
||||
return await self.call_api("set_friend_add_request", {"flag": flag, "approve": approve, "remark": remark})
|
||||
|
||||
async def get_friends_with_category(self) -> Dict[str, Any]:
|
||||
"""
|
||||
获取带分类的好友列表。
|
||||
|
||||
Returns:
|
||||
Dict[str, Any]: OneBot API 的响应数据。
|
||||
"""
|
||||
return await self.call_api("get_friends_with_category")
|
||||
|
||||
async def get_unidirectional_friend_list(self) -> Dict[str, Any]:
|
||||
"""
|
||||
获取单向好友列表。
|
||||
|
||||
Returns:
|
||||
Dict[str, Any]: OneBot API 的响应数据。
|
||||
"""
|
||||
return await self.call_api("get_unidirectional_friend_list")
|
||||
|
||||
async def friend_poke(self, user_id: int) -> Dict[str, Any]:
|
||||
"""
|
||||
发送好友戳一戳。
|
||||
|
||||
Args:
|
||||
user_id (int): 目标用户的 QQ 号。
|
||||
|
||||
Returns:
|
||||
Dict[str, Any]: OneBot API 的响应数据。
|
||||
"""
|
||||
return await self.call_api("friend_poke", {"user_id": user_id})
|
||||
|
||||
async def mark_private_msg_as_read(self, user_id: int, time: int = 0) -> Dict[str, Any]:
|
||||
"""
|
||||
标记私聊消息为已读。
|
||||
|
||||
Args:
|
||||
user_id (int): 目标用户的 QQ 号。
|
||||
time (int, optional): 标记此时间戳之前的消息为已读。Defaults to 0 (全部标记)。
|
||||
|
||||
Returns:
|
||||
Dict[str, Any]: OneBot API 的响应数据。
|
||||
"""
|
||||
params = {"user_id": user_id}
|
||||
if time > 0:
|
||||
params["time"] = time
|
||||
return await self.call_api("mark_private_msg_as_read", params)
|
||||
|
||||
async def get_friend_msg_history(self, user_id: int, count: int = 20) -> Dict[str, Any]:
|
||||
"""
|
||||
获取私聊消息历史记录。
|
||||
|
||||
Args:
|
||||
user_id (int): 目标用户的 QQ 号。
|
||||
count (int, optional): 要获取的消息数量。Defaults to 20.
|
||||
|
||||
Returns:
|
||||
Dict[str, Any]: OneBot API 的响应数据。
|
||||
"""
|
||||
return await self.call_api("get_friend_msg_history", {"user_id": user_id, "count": count})
|
||||
|
||||
async def forward_friend_single_msg(self, user_id: int, message_id: str) -> Dict[str, Any]:
|
||||
"""
|
||||
转发单条好友消息。
|
||||
|
||||
Args:
|
||||
user_id (int): 目标用户的 QQ 号。
|
||||
message_id (str): 要转发的消息 ID。
|
||||
|
||||
Returns:
|
||||
Dict[str, Any]: OneBot API 的响应数据。
|
||||
"""
|
||||
return await self.call_api("forward_friend_single_msg", {"user_id": user_id, "message_id": message_id})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user