Skip to content

alicebot.adapter.telegram.event.message

Telegram 适配器事件。

class MessageEvent

Bases: alicebot.adapter.telegram.event.base.TelegramEvent, alicebot.event.MessageEvent[TelegramAdapter]

New incoming message of any kind - text, photo, sticker, etc.

method get_message(self)

获取 TelegramMessage 对象。

  • Returns

    Type: alicebot.adapter.telegram.message.TelegramMessage

    TelegramMessage 对象。

method get_plain_text(self)

获取消息的纯文本内容。

  • Returns

    Type: str

    消息的纯文本内容。

method get_sender_id(self)

获取消息的发送者的唯一标识符。

  • Returns

    Type: None | int | str

    消息的发送者的唯一标识符。

readonly property message

Type: alicebot.adapter.telegram.model.Message

The message object.

async method reply(self, message, disable_notification = None, protect_content = None, message_effect_id = None, reply_parameters = None, reply_markup = None, **kwargs)

回复消息。

  • Arguments

    • message (str | alicebot.adapter.telegram.message.TelegramMessage | alicebot.adapter.telegram.media.TelegramMedia) - 回复消息的内容。

    • disable_notification (bool | None)

    • protect_content (bool | None)

    • message_effect_id (str | None)

    • reply_parameters (alicebot.adapter.telegram.model.ReplyParameters | None)

    • reply_markup (alicebot.adapter.telegram.model.InlineKeyboardMarkup | alicebot.adapter.telegram.model.ReplyKeyboardMarkup | alicebot.adapter.telegram.model.ReplyKeyboardRemove | alicebot.adapter.telegram.model.ForceReply | None)

    • kwargs (Any)

  • Returns

    Type: Any

    回复消息动作的响应。

Released under the MIT License.