telegramium.bots.high.messageentities.MessageEntities
See theMessageEntities companion object
final class MessageEntities(val underlying: Vector[MessageEntityFormat]) extends AnyVal
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
- Graph
-
- Supertypes
-
class AnyValtrait Matchableclass Any
Members list
In this article