iamai.adapter.gensokyo.event module#

GSK 适配器事件。

class iamai.adapter.gensokyo.event.Anonymous(*, id: int, name: str, flag: str)[source]#

Bases: BaseModel

匿名信息

flag: str#
id: int#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'flag': FieldInfo(annotation=str, required=True), 'id': FieldInfo(annotation=int, required=True), 'name': FieldInfo(annotation=str, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str#
class iamai.adapter.gensokyo.event.File(*, id: str, name: str, size: int, busid: int)[source]#

Bases: BaseModel

文件信息

busid: int#
id: str#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'busid': FieldInfo(annotation=int, required=True), 'id': FieldInfo(annotation=str, required=True), 'name': FieldInfo(annotation=str, required=True), 'size': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str#
size: int#
class iamai.adapter.gensokyo.event.FriendAddNoticeEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, notice_type: Literal['friend_add'], user_id: int, **extra_data: Any)[source]#

Bases: NoticeEvent

好友添加

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'notice_type': FieldInfo(annotation=Literal['friend_add'], required=True), 'post_type': FieldInfo(annotation=Literal['notice'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

notice_type: Literal['friend_add']#
user_id: int#
class iamai.adapter.gensokyo.event.FriendRecallNoticeEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, notice_type: Literal['friend_recall'], user_id: int, message_id: int, **extra_data: Any)[source]#

Bases: NoticeEvent

好友消息撤回

message_id: int#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'message_id': FieldInfo(annotation=int, required=True), 'notice_type': FieldInfo(annotation=Literal['friend_recall'], required=True), 'post_type': FieldInfo(annotation=Literal['notice'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

notice_type: Literal['friend_recall']#
user_id: int#
class iamai.adapter.gensokyo.event.FriendRequestEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, request_type: Literal['friend'], user_id: int, comment: str, flag: str, **extra_data: Any)[source]#

Bases: RequestEvent

加好友请求

async approve(remark: str = '') Dict[str, Any][source]#

同意请求。

Parameters:

remark – 好友备注。

Returns:

API 请求响应。

comment: str#
flag: str#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'comment': FieldInfo(annotation=str, required=True), 'flag': FieldInfo(annotation=str, required=True), 'post_type': FieldInfo(annotation=Literal['request'], required=True), 'request_type': FieldInfo(annotation=Literal['friend'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

async refuse() Dict[str, Any][source]#

拒绝请求。

Returns:

API 请求响应。

request_type: Literal['friend']#
user_id: int#
class iamai.adapter.gensokyo.event.GSKEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, **extra_data: Any)[source]#

Bases: Event[GSKAdapter]

GSK 事件基类

classmethod get_event_type() Tuple[str | None, str | None, str | None][source]#

获取事件类型。

Returns:

事件类型。

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'post_type': FieldInfo(annotation=str, required=True), 'self_id': FieldInfo(annotation=int, required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

post_type: str#
self_id: int#
time: int#
property to_me: bool#

当前事件的 user_id 是否等于 self_id

type: str | None#
class iamai.adapter.gensokyo.event.GroupAdminNoticeEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, notice_type: Literal['group_admin'], sub_type: Literal['set', 'unset'], user_id: int, group_id: int, **extra_data: Any)[source]#

Bases: NoticeEvent

群管理员变动

group_id: int#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'group_id': FieldInfo(annotation=int, required=True), 'notice_type': FieldInfo(annotation=Literal['group_admin'], required=True), 'post_type': FieldInfo(annotation=Literal['notice'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'sub_type': FieldInfo(annotation=Literal['set', 'unset'], required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

notice_type: Literal['group_admin']#
sub_type: Literal['set', 'unset']#
user_id: int#
class iamai.adapter.gensokyo.event.GroupBanNoticeEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, notice_type: Literal['group_ban'], sub_type: Literal['ban', 'lift_ban'], group_id: int, operator_id: int, user_id: int, duration: int, **extra_data: Any)[source]#

Bases: NoticeEvent

群禁言

duration: int#
group_id: int#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'duration': FieldInfo(annotation=int, required=True), 'group_id': FieldInfo(annotation=int, required=True), 'notice_type': FieldInfo(annotation=Literal['group_ban'], required=True), 'operator_id': FieldInfo(annotation=int, required=True), 'post_type': FieldInfo(annotation=Literal['notice'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'sub_type': FieldInfo(annotation=Literal['ban', 'lift_ban'], required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

notice_type: Literal['group_ban']#
operator_id: int#
sub_type: Literal['ban', 'lift_ban']#
user_id: int#
class iamai.adapter.gensokyo.event.GroupDecreaseNoticeEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, notice_type: Literal['group_decrease'], sub_type: Literal['leave', 'kick', 'kick_me'], group_id: int, operator_id: int, user_id: int, **extra_data: Any)[source]#

Bases: NoticeEvent

群成员减少

group_id: int#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'group_id': FieldInfo(annotation=int, required=True), 'notice_type': FieldInfo(annotation=Literal['group_decrease'], required=True), 'operator_id': FieldInfo(annotation=int, required=True), 'post_type': FieldInfo(annotation=Literal['notice'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'sub_type': FieldInfo(annotation=Literal['leave', 'kick', 'kick_me'], required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

notice_type: Literal['group_decrease']#
operator_id: int#
sub_type: Literal['leave', 'kick', 'kick_me']#
user_id: int#
class iamai.adapter.gensokyo.event.GroupHonorNotifyEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, notice_type: Literal['notify'], sub_type: Literal['honor'], group_id: int, user_id: int, honor_type: Literal['talkative', 'performer', 'emotion'], **extra_data: Any)[source]#

Bases: NotifyEvent

群成员荣誉变更

group_id: int#
honor_type: Literal['talkative', 'performer', 'emotion']#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'group_id': FieldInfo(annotation=int, required=True), 'honor_type': FieldInfo(annotation=Literal['talkative', 'performer', 'emotion'], required=True), 'notice_type': FieldInfo(annotation=Literal['notify'], required=True), 'post_type': FieldInfo(annotation=Literal['notice'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'sub_type': FieldInfo(annotation=Literal['honor'], required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

sub_type: Literal['honor']#
class iamai.adapter.gensokyo.event.GroupIncreaseNoticeEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, notice_type: Literal['group_increase'], sub_type: Literal['approve', 'invite'], group_id: int, operator_id: int, user_id: int, **extra_data: Any)[source]#

Bases: NoticeEvent

群成员增加

group_id: int#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'group_id': FieldInfo(annotation=int, required=True), 'notice_type': FieldInfo(annotation=Literal['group_increase'], required=True), 'operator_id': FieldInfo(annotation=int, required=True), 'post_type': FieldInfo(annotation=Literal['notice'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'sub_type': FieldInfo(annotation=Literal['approve', 'invite'], required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

notice_type: Literal['group_increase']#
operator_id: int#
sub_type: Literal['approve', 'invite']#
user_id: int#
class iamai.adapter.gensokyo.event.GroupLuckyKingNotifyEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, notice_type: Literal['notify'], sub_type: Literal['lucky_king'], group_id: int, user_id: int, target_id: int, **extra_data: Any)[source]#

Bases: NotifyEvent

群红包运气王

group_id: int#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'group_id': FieldInfo(annotation=int, required=True), 'notice_type': FieldInfo(annotation=Literal['notify'], required=True), 'post_type': FieldInfo(annotation=Literal['notice'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'sub_type': FieldInfo(annotation=Literal['lucky_king'], required=True), 'target_id': FieldInfo(annotation=int, required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

sub_type: Literal['lucky_king']#
target_id: int#
class iamai.adapter.gensokyo.event.GroupMessageEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, message_type: Literal['group'], sub_type: Literal['normal', 'anonymous', 'notice'], message_id: int, user_id: int, message: GSKMessage, raw_message: str, font: int, sender: Sender, group_id: int, anonymous: Anonymous | None = None, **extra_data: Any)[source]#

Bases: MessageEvent

群消息

anonymous: Anonymous | None#
group_id: int#
message_type: Literal['group']#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'anonymous': FieldInfo(annotation=Union[Anonymous, NoneType], required=False), 'font': FieldInfo(annotation=int, required=True), 'group_id': FieldInfo(annotation=int, required=True), 'message': FieldInfo(annotation=GSKMessage, required=True), 'message_id': FieldInfo(annotation=int, required=True), 'message_type': FieldInfo(annotation=Literal['group'], required=True), 'post_type': FieldInfo(annotation=Literal['message'], required=True), 'raw_message': FieldInfo(annotation=str, required=True), 'self_id': FieldInfo(annotation=int, required=True), 'sender': FieldInfo(annotation=Sender, required=True), 'sub_type': FieldInfo(annotation=Literal['normal', 'anonymous', 'notice'], required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

async reply(message: List[GSKMessageSegment] | GSKMessageSegment | str | Mapping[str, Any]) Dict[str, Any][source]#

回复消息。

Parameters:

message – 回复消息的内容,同 call_api() 方法。

Returns:

API 请求响应。

sub_type: Literal['normal', 'anonymous', 'notice']#
class iamai.adapter.gensokyo.event.GroupRecallNoticeEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, notice_type: Literal['group_recall'], group_id: int, operator_id: int, user_id: int, message_id: int, **extra_data: Any)[source]#

Bases: NoticeEvent

群消息撤回

group_id: int#
message_id: int#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'group_id': FieldInfo(annotation=int, required=True), 'message_id': FieldInfo(annotation=int, required=True), 'notice_type': FieldInfo(annotation=Literal['group_recall'], required=True), 'operator_id': FieldInfo(annotation=int, required=True), 'post_type': FieldInfo(annotation=Literal['notice'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

notice_type: Literal['group_recall']#
operator_id: int#
user_id: int#
class iamai.adapter.gensokyo.event.GroupRequestEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, request_type: Literal['group'], sub_type: Literal['add', 'invite'], group_id: int, user_id: int, comment: str, flag: str, **extra_data: Any)[source]#

Bases: RequestEvent

加群请求 / 邀请

async approve() Dict[str, Any][source]#

同意请求。

Returns:

API 请求响应。

comment: str#
flag: str#
group_id: int#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'comment': FieldInfo(annotation=str, required=True), 'flag': FieldInfo(annotation=str, required=True), 'group_id': FieldInfo(annotation=int, required=True), 'post_type': FieldInfo(annotation=Literal['request'], required=True), 'request_type': FieldInfo(annotation=Literal['group'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'sub_type': FieldInfo(annotation=Literal['add', 'invite'], required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

async refuse(reason: str = '') Dict[str, Any][source]#

拒绝请求。

Parameters:

reason – 拒绝原因。

Returns:

API 请求响应。

request_type: Literal['group']#
sub_type: Literal['add', 'invite']#
user_id: int#
class iamai.adapter.gensokyo.event.GroupUploadNoticeEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, notice_type: Literal['group_upload'], user_id: int, group_id: int, file: File, **extra_data: Any)[source]#

Bases: NoticeEvent

群文件上传

file: File#
group_id: int#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'file': FieldInfo(annotation=File, required=True), 'group_id': FieldInfo(annotation=int, required=True), 'notice_type': FieldInfo(annotation=Literal['group_upload'], required=True), 'post_type': FieldInfo(annotation=Literal['notice'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

notice_type: Literal['group_upload']#
user_id: int#
class iamai.adapter.gensokyo.event.HeartbeatMetaEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, meta_event_type: Literal['heartbeat'], status: Status, interval: int, **extra_data: Any)[source]#

Bases: MetaEvent

心跳

interval: int#
meta_event_type: Literal['heartbeat']#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'interval': FieldInfo(annotation=int, required=True), 'meta_event_type': FieldInfo(annotation=Literal['heartbeat'], required=True), 'post_type': FieldInfo(annotation=Literal['meta_event'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'status': FieldInfo(annotation=Status, required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

status: Status#
class iamai.adapter.gensokyo.event.LifecycleMetaEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, meta_event_type: Literal['lifecycle'], sub_type: Literal['enable', 'disable', 'connect'], **extra_data: Any)[source]#

Bases: MetaEvent

生命周期

meta_event_type: Literal['lifecycle']#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'meta_event_type': FieldInfo(annotation=Literal['lifecycle'], required=True), 'post_type': FieldInfo(annotation=Literal['meta_event'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'sub_type': FieldInfo(annotation=Literal['enable', 'disable', 'connect'], required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

sub_type: Literal['enable', 'disable', 'connect']#
class iamai.adapter.gensokyo.event.MessageEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, message_type: Literal['private', 'group'], sub_type: str, message_id: int, user_id: int, message: GSKMessage, raw_message: str, font: int, sender: Sender, **extra_data: Any)[source]#

Bases: GSKEvent, MessageEvent[GSKAdapter]

消息事件

font: int#
get_plain_text() str[source]#

获取消息的纯文本内容。

Returns:

消息的纯文本内容。

async is_same_sender(other: Self) bool[source]#

判断自身和另一个事件是否是同一个发送者。

Parameters:

other – 另一个事件。

Returns:

是否是同一个发送者。

message: GSKMessage#
message_id: int#
message_type: Literal['private', 'group']#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'font': FieldInfo(annotation=int, required=True), 'message': FieldInfo(annotation=GSKMessage, required=True), 'message_id': FieldInfo(annotation=int, required=True), 'message_type': FieldInfo(annotation=Literal['private', 'group'], required=True), 'post_type': FieldInfo(annotation=Literal['message'], required=True), 'raw_message': FieldInfo(annotation=str, required=True), 'self_id': FieldInfo(annotation=int, required=True), 'sender': FieldInfo(annotation=Sender, required=True), 'sub_type': FieldInfo(annotation=str, required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

post_type: Literal['message']#
raw_message: str#
async reply(message: List[GSKMessageSegment] | GSKMessageSegment | str | Mapping[str, Any]) Dict[str, Any][source]#

回复消息。

Parameters:

message – 回复消息的内容,同 call_api() 方法。

Returns:

API 请求响应。

sender: Sender#
sub_type: str#
user_id: int#
class iamai.adapter.gensokyo.event.MetaEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, meta_event_type: str, **extra_data: Any)[source]#

Bases: GSKEvent

元事件

meta_event_type: str#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'meta_event_type': FieldInfo(annotation=str, required=True), 'post_type': FieldInfo(annotation=Literal['meta_event'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

post_type: Literal['meta_event']#
class iamai.adapter.gensokyo.event.NoticeEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, notice_type: str, **extra_data: Any)[source]#

Bases: GSKEvent

通知事件

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'notice_type': FieldInfo(annotation=str, required=True), 'post_type': FieldInfo(annotation=Literal['notice'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

notice_type: str#
post_type: Literal['notice']#
class iamai.adapter.gensokyo.event.NotifyEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, notice_type: Literal['notify'], sub_type: str, group_id: int | None = None, user_id: int, **extra_data: Any)[source]#

Bases: NoticeEvent

提醒事件

group_id: int | None#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'group_id': FieldInfo(annotation=Union[int, NoneType], required=False), 'notice_type': FieldInfo(annotation=Literal['notify'], required=True), 'post_type': FieldInfo(annotation=Literal['notice'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'sub_type': FieldInfo(annotation=str, required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

notice_type: Literal['notify']#
sub_type: str#
user_id: int#
class iamai.adapter.gensokyo.event.PokeNotifyEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, notice_type: Literal['notify'], sub_type: Literal['poke'], group_id: int | None = None, user_id: int, target_id: int, **extra_data: Any)[source]#

Bases: NotifyEvent

戳一戳

group_id: int | None#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'group_id': FieldInfo(annotation=Union[int, NoneType], required=False), 'notice_type': FieldInfo(annotation=Literal['notify'], required=True), 'post_type': FieldInfo(annotation=Literal['notice'], required=True), 'self_id': FieldInfo(annotation=int, required=True), 'sub_type': FieldInfo(annotation=Literal['poke'], required=True), 'target_id': FieldInfo(annotation=int, required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

sub_type: Literal['poke']#
target_id: int#
class iamai.adapter.gensokyo.event.PrivateMessageEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, message_type: Literal['private'], sub_type: Literal['friend', 'group', 'other'], message_id: int, user_id: int, message: GSKMessage, raw_message: str, font: int, sender: Sender, **extra_data: Any)[source]#

Bases: MessageEvent

私聊消息

message_type: Literal['private']#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'font': FieldInfo(annotation=int, required=True), 'message': FieldInfo(annotation=GSKMessage, required=True), 'message_id': FieldInfo(annotation=int, required=True), 'message_type': FieldInfo(annotation=Literal['private'], required=True), 'post_type': FieldInfo(annotation=Literal['message'], required=True), 'raw_message': FieldInfo(annotation=str, required=True), 'self_id': FieldInfo(annotation=int, required=True), 'sender': FieldInfo(annotation=Sender, required=True), 'sub_type': FieldInfo(annotation=Literal['friend', 'group', 'other'], required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2), 'user_id': FieldInfo(annotation=int, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

async reply(message: List[GSKMessageSegment] | GSKMessageSegment | str | Mapping[str, Any]) Dict[str, Any][source]#

回复消息。

Parameters:

message – 回复消息的内容,同 call_api() 方法。

Returns:

API 请求响应。

sub_type: Literal['friend', 'group', 'other']#
class iamai.adapter.gensokyo.event.RequestEvent(*, adapter: Any, post_type: str | None, time: int, self_id: int, request_type: str, **extra_data: Any)[source]#

Bases: GSKEvent

请求事件

async approve() Dict[str, Any][source]#

同意请求。

Returns:

API 请求响应。

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adapter': FieldInfo(annotation=Any, required=True), 'post_type': FieldInfo(annotation=Literal['request'], required=True), 'request_type': FieldInfo(annotation=str, required=True), 'self_id': FieldInfo(annotation=int, required=True), 'time': FieldInfo(annotation=int, required=True), 'type': FieldInfo(annotation=Union[str, NoneType], required=True, alias='post_type', alias_priority=2)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

post_type: Literal['request']#
async refuse() Dict[str, Any][source]#

拒绝请求。

Returns:

API 请求响应。

request_type: str#
class iamai.adapter.gensokyo.event.Sender(*, user_id: int | None = None, nickname: str | None = None, card: str | None = None, sex: Literal['male', 'female', 'unknown'] | None = None, age: int | None = None, area: str | None = None, level: str | None = None, role: str | None = None, title: str | None = None)[source]#

Bases: BaseModel

发送人信息

age: int | None#
area: str | None#
card: str | None#
level: str | None#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'age': FieldInfo(annotation=Union[int, NoneType], required=False), 'area': FieldInfo(annotation=Union[str, NoneType], required=False), 'card': FieldInfo(annotation=Union[str, NoneType], required=False), 'level': FieldInfo(annotation=Union[str, NoneType], required=False), 'nickname': FieldInfo(annotation=Union[str, NoneType], required=False), 'role': FieldInfo(annotation=Union[str, NoneType], required=False), 'sex': FieldInfo(annotation=Union[Literal['male', 'female', 'unknown'], NoneType], required=False), 'title': FieldInfo(annotation=Union[str, NoneType], required=False), 'user_id': FieldInfo(annotation=Union[int, NoneType], required=False)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

nickname: str | None#
role: str | None#
sex: Literal['male', 'female', 'unknown'] | None#
title: str | None#
user_id: int | None#
class iamai.adapter.gensokyo.event.Status(*, online: bool, good: bool, **extra_data: Any)[source]#

Bases: BaseModel

状态信息

good: bool#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'good': FieldInfo(annotation=bool, required=True), 'online': FieldInfo(annotation=bool, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

online: bool#