vendelieu/telegram-bot

How to use custom entities via EntitiesContextBuilder

yevhenii-rechun opened this issue · 1 comments

I am trying to send message in next way:

        val id = "some_id"
        message {
            "Your id:" - code { id }
        }.options {
            parseMode = ParseMode.MarkdownV2
        }.markup {
            inlineKeyboardMarkup {
                "Yes" callback "a"
                "No" callback "b"
            }
        }.send(user, bot)

I want my message look like:

Your id: some_id
[Yes][No]

And I can achieve that by manually wrapping strings in proper symbols, but I want to know how to use EntitiesContextBuilder functions and are they supposed to be used for that purpose?

Thanks in advance :)

Hello @yevhenii-rechun,
I'm glad you decided to try this feature, I wanted to hear feedback about its usability a long time.

About the question, when using entities (including through contextual builder), you don't need to specify parsing mode in the parameters, because parsing mode is the definition of the method of turning text labeling into an entity.
So I'm not sure if this will work with the parsing parameter, but it's not required anyway.

Simply saying, you can use just text and contextual functions and thereby mark text.

Otherwise, everything is correct and the EntitiesContextBuilder should work this way, if something will not work please let me know, I'll try to fix it :)