RichMessageButton constructor

const RichMessageButton({
  1. @JsonKey.new(name: 'text') @RichTextConverter() required RichText text,
  2. @JsonKey.new(name: 'style') StyleType? style,
  3. @JsonKey.new(name: 'url') String? url,
  4. @JsonKey.new(name: 'callback_data') String? callbackData,
  5. @JsonKey.new(name: 'web_app') WebAppInfo? webApp,
  6. @JsonKey.new(name: 'login_url') LoginURL? loginUrl,
  7. @JsonKey.new(name: 'switch_inline_query') String? switchInlineQuery,
  8. @JsonKey.new(name: 'switch_inline_query_current_chat') String? switchInlineQueryCurrentChat,
  9. @JsonKey.new(name: 'switch_inline_query_chosen_chat') SwitchInlineQueryChosenChat? switchInlineQueryChosenChat,
  10. @JsonKey.new(name: 'copy_text') CopyTextButton? copyText,
  11. @JsonKey.new(name: 'disabled') DisabledButton? disabled,
})

This object represents a button in a rich message.

Implementation

const factory RichMessageButton({
  /// Text of the button. May contain only plain text, RichTextCustomEmoji
  /// and RichTextDateTime entities.
  @JsonKey(name: 'text') @RichTextConverter() required RichText text,

  /// Optional. Style of the button. Must be one of “danger”, “success”,
  /// “primary”, or “link” (the button is shown as a regular link without
  /// borders). Apps may use theme-specific colors for the button background
  /// and text based on the style. The style “link” is allowed only for
  /// callback buttons.
  @JsonKey(name: 'style') StyleType? style,

  /// Optional. HTTP or tg:// URL to be opened when the button is pressed.
  /// Links tg://user?id=<user_id> can be used to mention a user by their
  /// identifier without using a username, if this is allowed by their
  /// privacy settings.
  @JsonKey(name: 'url') String? url,

  /// Optional. Data to be sent in a callback query to the bot when the
  /// button is pressed, 1-64 bytes
  @JsonKey(name: 'callback_data') String? callbackData,

  /// Optional. Description of the Web App that will be launched when the
  /// user presses the button. The Web App will be able to send an arbitrary
  /// message on behalf of the user using the method answerWebAppQuery.
  /// Available only in private chats between a user and the bot. Not
  /// supported for messages sent on behalf of a business account.
  @JsonKey(name: 'web_app') WebAppInfo? webApp,

  /// Optional. An HTTPS URL used to automatically authorize the user. Can be
  /// used as a replacement for the Telegram Login Widget. Not supported for
  /// ephemeral messages.
  @JsonKey(name: 'login_url') LoginURL? loginUrl,

  /// Optional. If set, pressing the button will prompt the user to select one
  /// of their chats, open that chat and insert the bot's username and the
  /// specified inline query in the input field. May be empty, in which case
  /// just the bot's username will be inserted. Not supported for messages
  /// sent in channel direct messages chats and on behalf of a business
  /// account.
  @JsonKey(name: 'switch_inline_query') String? switchInlineQuery,

  /// Optional. If set, pressing the button will insert the bot's username
  /// and the specified inline query in the current chat's input field. May
  /// be empty, in which case only the bot's username will be inserted. Not
  /// supported in channels and for messages sent in channel direct messages
  /// chats and on behalf of a business account.
  @JsonKey(name: 'switch_inline_query_current_chat')
  String? switchInlineQueryCurrentChat,

  /// Optional. If set, pressing the button will prompt the user to select one
  /// of their chats of the specified type, open that chat and insert the
  /// bot's username and the specified inline query in the input field. Not
  /// supported for messages sent in channel direct messages chats and on
  /// behalf of a business account.
  @JsonKey(name: 'switch_inline_query_chosen_chat')
  SwitchInlineQueryChosenChat? switchInlineQueryChosenChat,

  /// Optional. A button that copies the specified text to the clipboard
  @JsonKey(name: 'copy_text') CopyTextButton? copyText,

  /// Optional. If set, then the button is disabled and does nothing
  @JsonKey(name: 'disabled') DisabledButton? disabled,
}) = _RichMessageButton;