refactor(core): 优化权限管理和事件模型

- 重构 AdminManager 和 PermissionManager 以 Redis 为主要数据源
- 为所有事件模型添加 slots=True 提升性能
- 更新文档说明 Mypyc 编译注意事项
- 清理测试和调试文件
- 移动静态资源到 web_static 目录
This commit is contained in:
2026-01-13 08:35:54 +08:00
parent 7f331970dd
commit 3cbf5328bb
25 changed files with 434 additions and 409 deletions

View File

@@ -10,13 +10,14 @@ Bot 核心抽象模块
- 提供高级消息发送功能,如 `send_forwarded_messages`。
- 整合所有细分的 API 调用(消息、群组、好友等)。
"""
from typing import TYPE_CHECKING, Dict, Any, List, Union
from typing import TYPE_CHECKING, Dict, Any, List, Union, Optional
from models.events.base import OneBotEvent
from models.message import MessageSegment
from models.objects import GroupInfo, StrangerInfo
if TYPE_CHECKING:
from .ws import WS
from .utils.executor import CodeExecutor
from .api import MessageAPI, GroupAPI, FriendAPI, AccountAPI, MediaAPI
@@ -37,7 +38,7 @@ class Bot(MessageAPI, GroupAPI, FriendAPI, AccountAPI, MediaAPI):
ws_client (WS): WebSocket 客户端实例,负责底层的 API 请求和响应处理。
"""
super().__init__(ws_client, ws_client.self_id or 0)
self.code_executor = None
self.code_executor: Optional["CodeExecutor"] = None
async def get_group_list(self, no_cache: bool = False) -> List[GroupInfo]:
# GroupAPI.get_group_list 不支持 no_cache 参数,这里忽略它