telegramium.bots.high.messageentities
Members list
Type members
Classlikes
Utility class to work with styled messages using message entities (see https://core.telegram.org/bots/api#messageentity).
Utility class to work with styled messages using message entities (see https://core.telegram.org/bots/api#messageentity).
Compose your message's text using different formatting options like plain text, bold, italics, links, mentions, hashtags and more. This class automatically takes care of calculating text offsets and lengths required by the Telegram API.
Value parameters
- underlying
-
This class is basically a thin wrapper over the
Vector
collection. It supports some of theVector
operations directly, such as++
,:+
, and+:
. For additional collection methods not directly available through this class, you can access the underlyingVector
instance.
Attributes
- Example
-
val msgEntities = MessageEntities() .bold("Hello, ") .mention("@user") .plain("! Welcome to our ") .textLink("website", "https://example.com") .lineBreak() .plain("Enjoy your stay.") Methods.sendMessage( chatId, // Hello, @user! Welcome to our website\nEnjoy your stay. text = msgEntities.toPlainText(), // List(BoldMessageEntity(0, 7), MentionMessageEntity(7, 5), TextLinkMessageEntity(29, 7, "https://example.com")) entities = msgEntities.toTelegramEntities() )
- Companion
- object
- Supertypes
-
class AnyValtrait Matchableclass Any
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
MessageEntities.type
Base class for different types of message entity formats that mirror the ones used by Telegram. Each format corresponds to a specific type of content in a message, such as mentions, hashtags, URLs, and more.
Base class for different types of message entity formats that mirror the ones used by Telegram. Each format corresponds to a specific type of content in a message, such as mentions, hashtags, URLs, and more.
These formats can be used to wrap different parts of a message, which can then be composed to create a complete message. The benefits of this approach:
- It automatically calculates the text offsets and lengths that are required by the Telegram Bot API.
- It allows for generating the plain text of a message from the same source, simplifying the future message and formatting changes.
Note: This lower-level API is not typically used directly. Instead, most users should work with the MessageEntities
API, which provides a higher-level, more user-friendly interface to the same functionality.
Attributes
- See also
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class Blockquoteclass Boldclass BotCommandclass Cashtagclass Codeclass CustomEmojiclass Emailclass Hashtagclass Italicclass Mentionclass PhoneNumberclass Plainclass Preclass Spoilerclass Strikethroughclass TextLinkclass TextMentionclass Underlineclass UrlShow all
Attributes
- Companion
- class
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
MessageEntityFormat.type