Files
NeoBot/models/events/request.py
K2cr2O1 3cbf5328bb refactor(core): 优化权限管理和事件模型
- 重构 AdminManager 和 PermissionManager 以 Redis 为主要数据源
- 为所有事件模型添加 slots=True 提升性能
- 更新文档说明 Mypyc 编译注意事项
- 清理测试和调试文件
- 移动静态资源到 web_static 目录
2026-01-13 08:35:54 +08:00

62 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
请求事件模型模块
定义了请求相关的事件类。
"""
from dataclasses import dataclass
from .base import OneBotEvent, EventType
@dataclass(slots=True)
class RequestEvent(OneBotEvent):
"""
请求事件基类
"""
request_type: str
"""请求类型"""
@property
def post_type(self) -> str:
return EventType.REQUEST
@dataclass(slots=True)
class FriendRequestEvent(RequestEvent):
"""
加好友请求事件
"""
user_id: int = 0
"""发送请求的 QQ 号"""
comment: str = ""
"""验证信息"""
flag: str = ""
"""请求 flag在调用处理请求的 API 时需要传入此 flag"""
@dataclass(slots=True)
class GroupRequestEvent(RequestEvent):
"""
加群请求/邀请事件
"""
sub_type: str = ""
"""
子类型
add: 加群请求
invite: 邀请登录号入群
"""
group_id: int = 0
"""群号"""
user_id: int = 0
"""发送请求的 QQ 号"""
comment: str = ""
"""验证信息"""
flag: str = ""
"""请求 flag在调用处理请求的 API 时需要传入此 flag"""