Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html_text getting entities wrong #2450

Open
GabrielRF opened this issue Jan 31, 2025 · 1 comment
Open

html_text getting entities wrong #2450

GabrielRF opened this issue Jan 31, 2025 · 1 comment
Assignees
Labels

Comments

@GabrielRF
Copy link
Contributor

GabrielRF commented Jan 31, 2025

Steps to reproduce

1: Create a bot with:

@bot.message_handler(func=lambda message: True)
def echo_message(message):
    bot.reply_to(
        message,
        f'{message.html_text}',
        parse_mode='HTML'
    )

2: Send to the bot:

<blockquote>
<b>bold</b> <i>italic</i> <b><i>bold and italic</b></i>
</blockquote>

3: It will reply:

<b><i><blockquote>
bold italic bold and italic
</blockquote></b></i>

Image

@GabrielRF
Copy link
Contributor Author

GabrielRF commented Jan 31, 2025

Original message:

"text": "bold italic bold and italic",
  "entities": [
   {
    "offset": 0,
    "length": 27,
    "type": "blockquote"
   },
   {
    "offset": 0,
    "length": 4,
    "type": "bold"
   },
   {
    "offset": 5,
    "length": 6,
    "type": "italic"
   },
   {
    "offset": 12,
    "length": 15,
    "type": "bold"
   },
   {
    "offset": 12,
    "length": 15,
    "type": "italic"
   }
  ]

Bot's answer:

"text": "bold italic bold and italic",
  "entities": [
   {
    "offset": 0,
    "length": 27,
    "type": "blockquote"
   },
   {
    "offset": 0,
    "length": 27,
    "type": "bold"
   },
   {
    "offset": 0,
    "length": 27,
    "type": "italic"
   }
  ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants