Skip to content

alicebot.adapter.telegram.entity

Telegram Entity 模型。

abstract class Entity

Bases: alicebot.message.MessageSegment

消息字段。

本类实现了所有 Mapping 类型的方法,这些方法全部是对 data 属性的操作。 本类重写了 ++= 运算符,可以直接和 Message, MessageSegment 等类型的对象执行取和运算,返回 Message 对象。 适配器开发者需要继承本类并重写 get_message_class() 方法。

  • Attributes

    • type - 消息字段类型。

    • data - 消息字段内容。

method blockquote(text)

  • Returns

    Type: Self

method bold(text)

  • Returns

    Type: Self

method bot_command(text)

  • Returns

    Type: Self

method cashtag(text)

  • Returns

    Type: Self

method code(text)

  • Returns

    Type: Self

method custom_emoji(text, custom_emoji_id = None)

  • Arguments

    • custom_emoji_id (Optional[str])
  • Returns

    Type: Self

method email(text)

  • Returns

    Type: Self

method expandable_blockquote(text)

  • Returns

    Type: Self

method hashtag(text)

  • Returns

    Type: Self

method italic(text)

  • Returns

    Type: Self

method mention(text)

  • Returns

    Type: Self

method phone_number(text)

  • Returns

    Type: Self

method pre(text, language = None)

  • Arguments

    • language (Optional[str])
  • Returns

    Type: Self

method spoiler(text)

  • Returns

    Type: Self

method strikethrough(text)

  • Returns

    Type: Self

  • Arguments

    • url (Optional[str])
  • Returns

    Type: Self

method text_mention(text, user = None)

  • Arguments

    • user (Optional[alicebot.adapter.telegram.model.User])
  • Returns

    Type: Self

method underline(text)

  • Returns

    Type: Self

method url(text)

  • Returns

    Type: Self

abstract class Entity[TelegramMessage]

Bases: alicebot.adapter.telegram.entity.Entity

消息字段。

本类实现了所有 Mapping 类型的方法,这些方法全部是对 data 属性的操作。 本类重写了 ++= 运算符,可以直接和 Message, MessageSegment 等类型的对象执行取和运算,返回 Message 对象。 适配器开发者需要继承本类并重写 get_message_class() 方法。

  • Attributes

    • type - 消息字段类型。

    • data - 消息字段内容。

Released under the MIT License.