RichMessageButton class abstract
This object represents a button in a RichMessage. Exactly one of the
fields other than text and style must be used to specify the type of
the button.
- Available extensions
- Annotations
-
- @freezed
Constructors
- RichMessageButton({@JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'style') StyleType? style, @JsonKey.new(name: 'url') String? url, @JsonKey.new(name: 'callback_data') String? callbackData, @JsonKey.new(name: 'web_app') WebAppInfo? webApp, @JsonKey.new(name: 'login_url') LoginURL? loginUrl, @JsonKey.new(name: 'switch_inline_query') String? switchInlineQuery, @JsonKey.new(name: 'switch_inline_query_current_chat') String? switchInlineQueryCurrentChat, @JsonKey.new(name: 'switch_inline_query_chosen_chat') SwitchInlineQueryChosenChat? switchInlineQueryChosenChat, @JsonKey.new(name: 'copy_text') CopyTextButton? copyText, @JsonKey.new(name: 'disabled') DisabledButton? disabled})
-
This object represents a button in a rich message.
constfactory
-
RichMessageButton.fromJson(Map<
String, dynamic> json) -
Creates a RichMessageButton object from JSON.
factory
Properties
- callbackData → String?
-
Optional. Data to be sent in a callback query to the bot when the
button is pressed, 1-64 bytes
no setterinherited
- copyText → CopyTextButton?
-
Optional. A button that copies the specified text to the clipboard
no setterinherited
-
copyWith
→ $RichMessageButtonCopyWith<
RichMessageButton> -
Create a copy of RichMessageButton
with the given fields replaced by the non-null parameter values.
no setterinherited
- disabled → DisabledButton?
-
Optional. If set, then the button is disabled and does nothing
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- loginUrl → LoginURL?
-
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.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → StyleType?
-
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.
no setterinherited
- switchInlineQuery → String?
-
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.
no setterinherited
- switchInlineQueryChosenChat → SwitchInlineQueryChosenChat?
-
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.
no setterinherited
- switchInlineQueryCurrentChat → String?
-
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.
no setterinherited
- text → RichText
-
Text of the button. May contain only plain text, RichTextCustomEmoji
and RichTextDateTime entities.
no setterinherited
- url → String?
-
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.
no setterinherited
- webApp → WebAppInfo?
-
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.
no setterinherited
Methods
-
map<
TResult extends Object?> (TResult $default(_RichMessageButton value)) → TResult -
Available on RichMessageButton, provided by the RichMessageButtonPatterns extension
Aswitch-like method, using callbacks. -
mapOrNull<
TResult extends Object?> (TResult? $default(_RichMessageButton value)?) → TResult? -
Available on RichMessageButton, provided by the RichMessageButtonPatterns extension
A variant ofmapthat fallback to returningnull. -
maybeMap<
TResult extends Object?> (TResult $default(_RichMessageButton value)?, {required TResult orElse()}) → TResult -
Available on RichMessageButton, provided by the RichMessageButtonPatterns extension
A variant ofmapthat fallback to returningorElse. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Serializes this RichMessageButton to a JSON map.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited