rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.68k stars 1.18k forks source link

How to receive formatted text in bot #847

Closed Artgit closed 3 years ago

Artgit commented 3 years ago

I'm tryint to read the input text message in my bot via org.telegram.telegrambots.meta.api.objects.Message.getText()method but provided text doesn't contain formatting.. only plain text. How to get formatting created by user?

Chase22 commented 3 years ago

The Formatting is passed via MessageEntities. The text field will always be the raw text. Take a look at the entities field of Message: https://core.telegram.org/bots/api#messageentity