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

@@ -5,7 +5,7 @@
事件类型常量 `EventType`。所有具体的事件模型都应继承自 `OneBotEvent`。
"""
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Optional
from typing import TYPE_CHECKING, Optional, Final
from abc import ABC, abstractmethod
if TYPE_CHECKING:
@@ -18,15 +18,15 @@ class EventType:
用于标识不同种类的事件上报。
"""
META = 'meta_event'
META: Final[str] = 'meta_event'
"""元事件 (meta_event): 如心跳、生命周期等。"""
REQUEST = 'request'
REQUEST: Final[str] = 'request'
"""请求事件 (request): 如加好友请求、加群请求等。"""
NOTICE = 'notice'
NOTICE: Final[str] = 'notice'
"""通知事件 (notice): 如群成员增加、文件上传等。"""
MESSAGE = 'message'
MESSAGE: Final[str] = 'message'
"""消息事件 (message): 如私聊消息、群消息等。"""
MESSAGE_SENT = 'message_sent'
MESSAGE_SENT: Final[str] = 'message_sent'
"""消息发送事件 (message_sent): 机器人自己发送消息的上报。"""