Files
NeoBot/models/events/request.py

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
class FriendRequestEvent(RequestEvent):
"""
加好友请求事件
"""
user_id: int = 0
"""发送请求的 QQ 号"""
comment: str = ""
"""验证信息"""
flag: str = ""
"""请求 flag在调用处理请求的 API 时需要传入此 flag"""
@dataclass
class GroupRequestEvent(RequestEvent):
"""
加群请求/邀请事件
"""
sub_type: str = ""
"""
子类型
add: 加群请求
invite: 邀请登录号入群
"""
group_id: int = 0
"""群号"""
user_id: int = 0
"""发送请求的 QQ 号"""
comment: str = ""
"""验证信息"""
flag: str = ""
"""请求 flag在调用处理请求的 API 时需要传入此 flag"""