mirai_core.models package

Submodules

mirai_core.models.Entity module

class mirai_core.models.Entity.Friend(**data: Any)[source]

Bases: pydantic.main.BaseModel

id: int = None
nickname: str = None
remark: Optional[str] = None
get_avatar_url() → str[source]
class mirai_core.models.Entity.Permission[source]

Bases: enum.Enum

An enumeration.

Member = 'MEMBER'
Administrator = 'ADMINISTRATOR'
Owner = 'OWNER'
class mirai_core.models.Entity.Group(**data: Any)[source]

Bases: pydantic.main.BaseModel

id: int = None
name: str = None
permission: Permission = None
get_avatar_url() → str[source]
class mirai_core.models.Entity.Member(**data: Any)[source]

Bases: pydantic.main.BaseModel

id: int = None
memberName: str = None
permission: Permission = None
group: Group = None
get_avatar_url() → str[source]
class mirai_core.models.Entity.MemberChangeableSetting(**data: Any)[source]

Bases: pydantic.main.BaseModel

name: str = None
specialTitle: str = None
modify(**kwargs)[source]
class mirai_core.models.Entity.GroupSetting(**data: Any)[source]

Bases: pydantic.main.BaseModel

name: str = None
announcement: str = None
confessTalk: bool = None
allowMemberInvite: bool = None
autoApprove: bool = None
anonymousChat: bool = None
modify(**kwargs)[source]

mirai_core.models.Event module

class mirai_core.models.Event.BaseEvent(**data: Any)[source]

Bases: pydantic.main.BaseModel

type: str = None
class Config[source]

Bases: object

extra = 'allow'
class mirai_core.models.Event.BotOnlineEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['BotOnlineEvent'] = None
qq: int = None
class mirai_core.models.Event.BotOfflineEventActive(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['BotOfflineEventActive'] = None
qq: int = None
class mirai_core.models.Event.BotOfflineEventForce(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['BotOfflineEventForce'] = None
qq: int = None
class mirai_core.models.Event.BotOfflineEventDropped(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['BotOfflineEventDropped'] = None
qq: int = None
class mirai_core.models.Event.BotReloginEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['BotReloginEvent'] = None
qq: int = None
class mirai_core.models.Event.BotGroupPermissionChangeEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['BotGroupPermissionChangeEvent'] = None
origin: Permission = None
current: Permission = None
group: Group = None
class mirai_core.models.Event.BotMuteEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['BotMuteEvent'] = None
durationSeconds: int = None
operator: Optional[Member] = None
class mirai_core.models.Event.BotUnmuteEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['BotUnmuteEvent'] = None
operator: Optional[Member] = None
class mirai_core.models.Event.BotJoinGroupEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['BotJoinGroupEvent'] = None
group: Group = None
class mirai_core.models.Event.BotLeaveEventActive(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['BotLeaveEventActive'] = None
group: Group = None
class mirai_core.models.Event.BotLeaveEventKick(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['BotLeaveEventKick'] = None
group: Group = None
class mirai_core.models.Event.GroupRecallEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['GroupRecallEvent'] = None
authorId: int = None
messageId: int = None
time: datetime = None
group: Group = None
operator: Optional[Member] = None
class mirai_core.models.Event.FriendRecallEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['FriendRecallEvent'] = None
authorId: int = None
messageId: int = None
time: int = None
operator: int = None
class mirai_core.models.Event.GroupNameChangeEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['GroupNameChangeEvent'] = None
origin: str = None
current: str = None
group: Group = None
operator: bool = None
class mirai_core.models.Event.GroupEntranceAnnouncementChangeEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['GroupEntranceAnnouncementChangeEvent'] = None
origin: str = None
current: str = None
group: Group = None
operator: Optional[Member] = None
class mirai_core.models.Event.GroupMuteAllEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['GroupMuteAllEvent'] = None
origin: bool = None
current: bool = None
group: Group = None
operator: Optional[Member] = None
class mirai_core.models.Event.GroupAllowAnonymousChatEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['GroupAllowAnonymousChatEvent'] = None
origin: bool = None
current: bool = None
group: Group = None
operator: Optional[Member] = None
class mirai_core.models.Event.GroupAllowConfessTalkEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['GroupAllowAnonymousChatEvent'] = None
origin: bool = None
current: bool = None
group: Group = None
isByBot: bool = None
class mirai_core.models.Event.GroupAllowMemberInviteEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['GroupAllowMemberInviteEvent'] = None
origin: bool = None
current: bool = None
group: Group = None
operator: Optional[Member] = None
class mirai_core.models.Event.MemberJoinEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['MemberJoinEvent'] = None
member: Member = None
class mirai_core.models.Event.MemberLeaveEventKick(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['MemberLeaveEventKick'] = None
member: Member = None
operator: Optional[Member] = None
class mirai_core.models.Event.MemberLeaveEventQuit(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['MemberLeaveEventQuit'] = None
member: Member = None
class mirai_core.models.Event.MemberCardChangeEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['MemberCardChangeEvent'] = None
origin: str = None
current: str = None
member: Member = None
operator: Optional[Member] = None
class mirai_core.models.Event.MemberSpecialTitleChangeEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['MemberSpecialTitleChangeEvent'] = None
origin: str = None
current: str = None
member: Member = None
class mirai_core.models.Event.MemberPermissionChangeEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['MemberPermissionChangeEvent'] = None
origin: str = None
current: str = None
member: Member = None
class mirai_core.models.Event.MemberMuteEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['MemberMuteEvent'] = None
durationSeconds: int = None
member: Member = None
operator: Optional[Member] = None
class mirai_core.models.Event.MemberUnmuteEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['MemberUnmuteEvent'] = None
member: Member = None
operator: Optional[Member] = None
class mirai_core.models.Event.Message(messageChain: mirai_core.models.Message.MessageChain = None, **kwargs)[source]

Bases: mirai_core.models.Event.BaseEvent

type: MessageType = None
messageChain: MessageChain = None
sender: Union[Friend, Member] = None
property member
property friend
class mirai_core.models.Event.NewFriendRequestEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['NewFriendRequestEvent'] = None
requestId: int = None
supplicant: int = None
sourceGroup: Optional[int] = None
nickname: str = None
class mirai_core.models.Event.MemberJoinRequestEvent(**data: Any)[source]

Bases: mirai_core.models.Event.BaseEvent

type: Literal['MemberJoinRequestEvent'] = None
requestId: int = None
supplicant: int = None
sourceGroup: Optional[int] = None
groupName: str = None
nickname: str = None
mirai_core.models.Event.events() → Type[source]

mirai_core.models.Message module

class mirai_core.models.Message.BaseMessageComponent(**data: Any)[source]

Bases: pydantic.main.BaseModel

type: str = None
class Config[source]

Bases: object

extra = 'allow'
class mirai_core.models.Message.Source(**data: Any)[source]

Bases: mirai_core.models.Message.BaseMessageComponent

The source of the message Not a valid component for outbound message

type: Literal['Source'] = None
id: int = None
time: datetime.datetime = None
class mirai_core.models.Message.Plain(text: str, **kwargs)[source]

Bases: mirai_core.models.Message.BaseMessageComponent

Text component Available for outbound message

Construct text component

Parameters

text – message text

type: Literal['Plain'] = None
text: str = None
class mirai_core.models.Message.At(target, **kwargs)[source]

Bases: mirai_core.models.Message.BaseMessageComponent

At component Available for outbound message

Construct at component

Parameters

target – target qq number

type: Literal['At'] = None
target: int = None
display: str = None
class mirai_core.models.Message.AtAll(**data: Any)[source]

Bases: mirai_core.models.Message.BaseMessageComponent

AtAll component Available for outbound message

type: Literal['AtAll'] = None
class mirai_core.models.Message.Face(faceId, **kwargs)[source]

Bases: mirai_core.models.Message.BaseMessageComponent

Face component Available for outbound message

Construct Face component

Parameters

face_id – unsigned 8-bit face id

type: Literal['Face'] = None
faceId: int = None
class mirai_core.models.Message.Image(imageId: Optional[str] = None, url: Optional[pydantic.networks.HttpUrl] = None, path: Optional[str] = None, **kwargs)[source]

Bases: mirai_core.models.Message.BaseMessageComponent

Received image component Available for outbound message

Construct Image from mirai styled uuid, http url or local file path

Parameters
type: Literal['Image'] = None
imageId: Optional[str] = None
url: Optional[HttpUrl] = None
path: Optional[str] = None
property image_type

get image type from pattern

Returns

‘friend’ or ‘group’, if uuid is invalid format, return ‘unknown’

class mirai_core.models.Message.FlashImage(imageId: Optional[str] = None, url: Optional[pydantic.networks.HttpUrl] = None, path: Optional[str] = None, **kwargs)[source]

Bases: mirai_core.models.Message.BaseMessageComponent

Received image component Available for outbound message

Construct Image from mirai styled uuid, http url or local file path

Parameters
type: Literal['FlashImage'] = None
imageId: Optional[str] = None
url: Optional[HttpUrl] = None
path: Optional[str] = None
property image_type

get image type from pattern

Returns

‘friend’ or ‘group’, if uuid is invalid format, return ‘unknown’

class mirai_core.models.Message.Xml(xml: str, **kwargs)[source]

Bases: mirai_core.models.Message.BaseMessageComponent

Xml component Available for outbound message

Construct Xml component

Parameters

xml – str contains xml

type: Literal['Xml'] = None
xml: str = None
class mirai_core.models.Message.Json(Json: str, **kwargs)[source]

Bases: mirai_core.models.Message.BaseMessageComponent

Json component Available for outbound message

Construct Json component

Parameters

json – json content

type: Literal['Json'] = None
Json: str = None
class mirai_core.models.Message.App(content: str, **kwargs)[source]

Bases: mirai_core.models.Message.BaseMessageComponent

App component Available for outbound message

Construct App component

Parameters

content – app content

type: Literal['App'] = None
content: str = None
class mirai_core.models.Message.Poke(name: mirai_core.models.Message.PokeChoices, **kwargs)[source]

Bases: mirai_core.models.Message.BaseMessageComponent

Poke component Available for outbound message

Construct Poke component

Parameters

name – Poke content

type: Literal['Poke'] = None
name: PokeChoices = None
class mirai_core.models.Message.Quote(origin=None, **kwargs)[source]

Bases: mirai_core.models.Message.BaseMessageComponent

Quote component Not a valid component for outbound message

type: Literal['Quote'] = None
id: int = None
groupId: int = None
senderId: int = None
targetId: int = None
origin: QuoteMessageChain = None
class mirai_core.models.Message.MessageChain(**data: Any)[source]

Bases: pydantic.main.BaseModel

insert(index: int, object) → None[source]
has(component_class) → bool[source]

test if any item in MessageChain is component_class

Parameters

component_class – the class for the component

Returns

boolean

get_first(component_class) → Optional[mirai_core.models.Message.BaseMessageComponent][source]

Get the first component with component_class

Parameters

component_class – the class for the component

Returns

None or the component

get_all(component_class) → List[mirai_core.models.Message.BaseMessageComponent][source]
get_source() → mirai_core.models.Message.Source[source]
get_quote() → mirai_core.models.Message.Quote[source]
class mirai_core.models.Message.BotMessage(**data: Any)[source]

Bases: pydantic.main.BaseModel

type: str = None
messageId: int = None

mirai_core.models.Types module

class mirai_core.models.Types.NewFriendRequestResponse[source]

Bases: enum.Enum

An enumeration.

ACCEPT = 0
REFUSE = 1
REFUSE_AND_BLACKLIST = 2
class mirai_core.models.Types.MemberJoinRequestResponse[source]

Bases: enum.Enum

An enumeration.

ACCEPT = 0
REFUSE = 1
IGNORE = 2
REFUSE_AND_BLACKLIST = 3
IGNORE_AND_BLACKLIST = 4
class mirai_core.models.Types.MessageType[source]

Bases: str, enum.Enum

An enumeration.

GROUP = 'GroupMessage'
FRIEND = 'FriendMessage'
TEMP = 'TempMessage'

Module contents