Skip to content

alicebot.adapter.mirai.message

Mirai 适配器消息。

class MiraiMessage

Bases: alicebot.message.Message

Mirai 消息

method as_message_chain(self)

返回符合 Mirai-api-http 标准的 messageChain 数组。

  • Returns

    Type: List[Dict[str, Any]]

    messageChain 数组。

method get_segment_class()

获取消息字段类。

  • Returns

    Type: Type[MiraiMessageSegment]

    消息字段类。

class MiraiMessageSegment

Bases: alicebot.message.MessageSegment[MiraiMessage]

Mirai 消息段

method __init__(self, type, **data)

初始化。

  • Arguments

    • type (str) - 消息类型。

    • **data (Any) - 消息内容。

  • Returns

    Type: None

method app(content)

App 消息

  • Returns

    Type: Self

method at(target)

At 消息

  • Returns

    Type: Self

method at_all()

AtAll 消息

  • Returns

    Type: Self

method dice(value)

Dice 消息

  • Returns

    Type: Self

method face(face_id = None, name = None)

Face 消息

  • Arguments

    • name (Optional[str])
  • Returns

    Type: Self

method flash_image(image_id = None, url = None, path = None)

FlashImage 消息

  • Arguments

    • url (Optional[str])

    • path (Optional[str])

  • Returns

    Type: Self

method from_str(msg)

用于将 str 转换为消息字段。

  • Returns

    Type: Self

    str 转换的消息字段。

method get_message_class()

获取消息类。

  • Returns

    Type: Type[MiraiMessage]

    消息类。

method image(image_id = None, url = None, path = None)

Image 消息

  • Arguments

    • url (Optional[str])

    • path (Optional[str])

  • Returns

    Type: Self

method is_text(self)

是否是纯文本消息字段。

  • Returns

    Type: bool

    是否是纯文本消息字段。

method json(json_)

Json 消息

  • Returns

    Type: Self

method music_share(kind, title, summary, jump_url, picture_url, music_url, brief)

MusicShare 消息

  • Arguments

    • title (str)

    • summary (str)

    • jump_url (str)

    • picture_url (str)

    • music_url (str)

    • brief (str)

  • Returns

    Type: Self

method plain(text)

Plain 消息

  • Returns

    Type: Self

method poke(name)

Poke 消息

  • Returns

    Type: Self

method quote(id_, group_id, sender_id, target_id, origin)

Quote 消息

  • Arguments

    • group_id (int)

    • sender_id (int)

    • target_id (int)

    • origin (MiraiMessage)

  • Returns

    Type: Self

method ser_model(self)

返回符合 Mirai-api-http 标准的消息字段字典。

  • Returns

    Type: Dict[str, Any]

    符合 Mirai-api-http 标准的消息字段字典。

method source(id_, time)

Source 消息

  • Arguments

    • time (int)
  • Returns

    Type: Self

method voice(voice_id = None, url = None, path = None)

Voice 消息

  • Arguments

    • url (Optional[str])

    • path (Optional[str])

  • Returns

    Type: Self

method xml(xml)

Xml 消息

  • Returns

    Type: Self

Released under the MIT License.