UserMention class

A class representing a mention.

This class can be very helpful when you want to mention a user in a message.

Example: When you want to mention a user in a message, you can use this class to represent the mention instead of manually creating the mention URL.

// Create a new UserMention object.
final mention = UserMention(123456789, "Jake");

// And just send the message.
// Make sure to set the parseMode to ParseMode.html or ParseMode.markdown.
bot.api.sendMessage(
  chatId,
  "Hello $mention!",
  parseMode: ParseMode.html,
);

// There we go! The user will be mentioned in the message. :)

Constructors

UserMention(int id, String text, {ParseMode parseMode = ParseMode.html})
Constructs a new UserMention instance.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
id int
The user id.
final
parseMode ParseMode
Parse Mode
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
text String
The text of the mention.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Returns a string representation of the mention.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited