telega/models/reply

Types

Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername) Pass True if the message should be sent even if the specified message to be replied to is not found; can be used only for replies in the same chat and forum topic. Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities. The message will fail to send if the quote isn’t found in the original message. Mode for parsing entities in the quote. See formatting options for more details. A JSON-serialized list of special entities that appear in the quote. It can be specified instead of quote_parse_mode. Position of the quote in the original message in UTF-16 code units

pub type ReplyMarkup {
  InlineKeyboardMarkup(
    inline_keyboard: List(List(InlineKeyboardButton)),
  )
  ReplyKeyboardMarkup(
    keyboard: List(List(Keyboard)),
    is_persistent: Option(Bool),
    resize_keyboard: Option(Bool),
    one_time_keyboard: Option(Bool),
    input_field_placeholder: Option(String),
    selective: Option(Bool),
  )
  ReplyKeyboardRemove(
    remove_keyboard: Bool,
    selective: Option(Bool),
  )
}

Constructors

  • InlineKeyboardMarkup(
      inline_keyboard: List(List(InlineKeyboardButton)),
    )

    This object represents an inline keyboard that appears right next to the message it belongs to. Official reference: https://core.telegram.org/bots/api#inlinekeyboardmarkup

    Arguments

  • ReplyKeyboardMarkup(
      keyboard: List(List(Keyboard)),
      is_persistent: Option(Bool),
      resize_keyboard: Option(Bool),
      one_time_keyboard: Option(Bool),
      input_field_placeholder: Option(String),
      selective: Option(Bool),
    )

    This object represents a custom keyboard with reply options (see Introduction to bots for details and examples).

    Arguments

    • keyboard

      Array of button rows, each represented by an Array of KeyboardButton objects

    • is_persistent

      Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon.

    • resize_keyboard

      Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app’s standard keyboard.

    • one_time_keyboard

      Requests clients to hide the keyboard as soon as it’s been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again. Defaults to false.

    • input_field_placeholder

      The placeholder to be shown in the input field when the keyboard is active; 1-64 characters

    • selective

      Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot’s message is a reply to a message in the same chat and forum topic, sender of the original message.

      Example: A user requests to change the bot’s language, bot replies to the request with a keyboard to select the new language. Other users in the group don’t see the keyboard.

  • ReplyKeyboardRemove(
      remove_keyboard: Bool,
      selective: Option(Bool),
    )

    Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).

    Arguments

    • remove_keyboard

      Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup)

    • selective

      Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot’s message is a reply to a message in the same chat and forum topic, sender of the original message.

      Example: A user requests to change the bot’s language, bot replies to the request with a keyboard to select the new language. Other users in the group don’t see the keyboard.

pub type ReplyParameters {
  ReplyParameters(
    message_id: Int,
    chat_id: Option(IntOrString),
    allow_sending_without_reply: Option(Bool),
    quote: Option(String),
    quote_parse_mode: Option(String),
    quote_entities: Option(List(MessageEntity)),
    quote_position: Option(Int),
  )
}

Constructors

  • ReplyParameters(
      message_id: Int,
      chat_id: Option(IntOrString),
      allow_sending_without_reply: Option(Bool),
      quote: Option(String),
      quote_parse_mode: Option(String),
      quote_entities: Option(List(MessageEntity)),
      quote_position: Option(Int),
    )

    Describes reply parameters for the message that is being sent. Official reference: https://core.telegram.org/bots/api#replyparameters

    Arguments

    • message_id

      Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified

    • chat_id

      If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername)

    • allow_sending_without_reply

      Pass True if the message should be sent even if the specified message to be replied to is not found; can be used only for replies in the same chat and forum topic.

    • quote

      Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities. The message will fail to send if the quote isn’t found in the original message.

    • quote_parse_mode

      Mode for parsing entities in the quote. See formatting options for more details.

    • quote_entities

      A JSON-serialized list of special entities that appear in the quote. It can be specified instead of quote_parse_mode.

    • quote_position

      Position of the quote in the original message in UTF-16 code units

Functions

pub fn encode_reply_parameters(
  reply_parameters: ReplyParameters,
) -> Json

Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup) Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot’s message is a reply to a message in the same chat and forum topic, sender of the original message.

Example: A user requests to change the bot’s language, bot replies to the request with a keyboard to select the new language. Other users in the group don’t see the keyboard.

Search Document