Skip to content
On this page

alicebot.adapter.mirai.message

Mirai 适配器消息。

class MiraiMessage

Bases: alicebot.message.Message

Mirai 消息

method __init__(self, *messages) {#Message.__init__}

初始化。

  • Arguments

    • *messages (Union[List[~MessageSegmentT], ~MessageSegmentT, str, Mapping[str, Any]]) - 可以被转化为消息的数据。
  • Returns

    Type: None

method as_message_chain(self) {#MiraiMessage.as_message_chain}

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

  • Returns

    Type: List[Dict[str, Any]]

    messageChain 数组。

method get_segment_class() {#MiraiMessage.get_segment_class}

获取消息字段类。

  • Returns

    Type: Type[MiraiMessageSegment]

    消息字段类。

class MiraiMessageSegment

Bases: alicebot.message.MessageSegment[MiraiMessage]

Mirai 消息段

method __init__(self, type, **data) {#MiraiMessageSegment.__init__}

初始化。

  • Arguments

    • type (str) - 消息类型。

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

  • Returns

    Type: None

method app(content)

App 消息

  • Returns

    Type: typing_extensions.Self

method at(target)

At 消息

  • Returns

    Type: typing_extensions.Self

method at_all() {#MiraiMessageSegment.at_all}

AtAll 消息

  • Returns

    Type: typing_extensions.Self

method dice(value)

Dice 消息

  • Returns

    Type: typing_extensions.Self

method face(face_id = None, name = None)

Face 消息

  • Arguments

    • name (Optional[str])
  • Returns

    Type: typing_extensions.Self

method flash_image(image_id = None, url = None, path = None) {#MiraiMessageSegment.flash_image}

FlashImage 消息

  • Arguments

    • url (Optional[str])

    • path (Optional[str])

  • Returns

    Type: typing_extensions.Self

method from_str(msg) {#MiraiMessageSegment.from_str}

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

  • Returns

    Type: typing_extensions.Self

    str 转换的消息字段。

method get_message_class() {#MiraiMessageSegment.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: typing_extensions.Self

method is_text(self) {#MiraiMessageSegment.is_text}

是否是纯文本消息字段。

  • Returns

    Type: bool

    是否是纯文本消息字段。

method json(json_)

Json 消息

  • Returns

    Type: typing_extensions.Self

method music_share(kind, title, summary, jump_url, picture_url, music_url, brief) {#MiraiMessageSegment.music_share}

MusicShare 消息

  • Arguments

    • title (str)

    • summary (str)

    • jump_url (str)

    • picture_url (str)

    • music_url (str)

    • brief (str)

  • Returns

    Type: typing_extensions.Self

method plain(text)

Plain 消息

  • Returns

    Type: typing_extensions.Self

method poke(name)

Poke 消息

  • Returns

    Type: typing_extensions.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: typing_extensions.Self

method ser_model(self) {#MiraiMessageSegment.ser_model}

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

  • Returns

    Type: Dict[str, Any]

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

method source(id_, time)

Source 消息

  • Arguments

    • time (int)
  • Returns

    Type: typing_extensions.Self

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

Voice 消息

  • Arguments

    • url (Optional[str])

    • path (Optional[str])

  • Returns

    Type: typing_extensions.Self

method xml(xml)

Xml 消息

  • Returns

    Type: typing_extensions.Self

Released under the MIT License.