feat: 添加状态监控插件和Redis原子操作支持

- 新增 `/status` 指令,展示机器人运行状态和系统指标
- 实现Redis Lua脚本支持原子化计数器操作
- 添加消息收发统计功能
- 完善文档,包括插件开发和性能优化指南
- 重构WebSocket连接池,增加健康检查机制
- 移除旧版编译脚本,优化项目结构
This commit is contained in:
2026-01-23 15:54:45 +08:00
parent 489dd8c77d
commit d458413e4b
28 changed files with 1529 additions and 1177 deletions

View File

@@ -81,6 +81,28 @@ async def handle_who(event: MessageEvent, args: str):
- `level`: QQ 等级
- 其他可能的信息字段
### `get_friends_with_category` - 获取分类好友列表
```python
async def get_friends_with_category(self) -> Dict[str, Any]
```
获取带分组信息的好友列表。
**返回值:**
- 包含分组和好友信息的字典
### `get_unidirectional_friend_list` - 获取单向好友列表
```python
async def get_unidirectional_friend_list(self) -> Dict[str, Any]
```
获取单向好友(你加了对方,对方没加你)的列表。
**返回值:**
- 单向好友列表
## 互动功能
### `send_like` - 发送点赞(戳一戳)
@@ -119,6 +141,55 @@ async def handle_like(event: MessageEvent, args: str):
- 有每日次数限制,不要滥用
- 对方可能关闭了"戳一戳"功能,这时会失败
### `friend_poke` - 发送好友戳一戳 (新)
```python
async def friend_poke(self, user_id: int) -> Dict[str, Any]
```
对指定好友发送"戳一戳"(比 `send_like` 更通用的接口)。
**参数:**
- `user_id`: 目标用户的 QQ 号
## 消息历史与状态
### `mark_private_msg_as_read` - 标记私聊已读
```python
async def mark_private_msg_as_read(self, user_id: int, time: int = 0) -> Dict[str, Any]
```
将与指定用户的私聊消息标记为已读。
**参数:**
- `user_id`: 目标用户的 QQ 号
- `time`: 将此时间戳(秒)之前的消息标记为已读,传 `0` 表示全部标记
### `get_friend_msg_history` - 获取私聊历史
```python
async def get_friend_msg_history(self, user_id: int, count: int = 20) -> Dict[str, Any]
```
获取与指定用户的私聊历史记录。
**参数:**
- `user_id`: 目标用户的 QQ 号
- `count`: 要获取的消息数量,默认 20
### `forward_friend_single_msg` - 转发单条消息
```python
async def forward_friend_single_msg(self, user_id: int, message_id: str) -> Dict[str, Any]
```
将一条消息转发给指定好友。
**参数:**
- `user_id`: 接收消息的好友 QQ 号
- `message_id`: 要转发的消息的 ID
## 加好友请求处理
### `set_friend_add_request` - 处理加好友请求