MessageEntity constructor

const MessageEntity({
  1. @JsonKey(name: 'type') required MessageEntityType type,
  2. @JsonKey(name: 'offset') required int offset,
  3. @JsonKey(name: 'length') required int length,
  4. @JsonKey(name: 'url') String? url,
  5. @JsonKey(name: 'user') User? user,
  6. @JsonKey(name: 'language') String? language,
  7. @JsonKey(name: 'custom_emoji_id') String? customEmojiId,
})

Constructs the MessageEntity object

Implementation

const factory MessageEntity({
  /// Type of the entity. Currently, can be:
  /// - mention - (@username)
  /// - hashtag - (#hashtag),
  /// - cashtag - ($USD),
  /// - botCommand - (/start@jobs_bot),
  /// - url - (https://telegram.org),
  /// - email - (do-not-reply@telegram.org),
  /// - phoneNumber - (+1-212-555-0123),
  /// - bold - (bold text),
  /// - italic - (italic text),
  /// - underline - (underlined text),
  /// - strikethrough - (strikethrough text),
  /// - spoiler - (spoiler message),
  /// - code - (monowidth string),
  /// - pre - (monowidth block),
  /// - textLink - (for clickable text URLs),
  /// - textMention - (for users without usernames),
  /// - customEmoji - (for inline custom emoji stickers)
  @JsonKey(name: 'type') required MessageEntityType type,

  /// Offset in UTF-16 code units to the start of the entity
  @JsonKey(name: 'offset') required int offset,

  /// Length of the entity in UTF-16 code units
  @JsonKey(name: 'length') required int length,

  /// Optional. For "text_link" only, URL that will be opened after user taps
  /// on the text
  @JsonKey(name: 'url') String? url,

  /// Optional. For "text_mention" only, the mentioned user
  @JsonKey(name: 'user') User? user,

  /// Optional. For "pre" only, the programming language of the entity text
  @JsonKey(name: 'language') String? language,

  /// Optional. For "custom_emoji" only, unique identifier of the custom
  /// emoji. Use getCustomEmojiStickers to get full information about the
  /// sticker
  @JsonKey(name: 'custom_emoji_id') String? customEmojiId,
}) = _MessageEntity;