Telethon icon indicating copy to clipboard operation
Telethon copied to clipboard

Add expandable blockquotes HTML tag

Open MrSnowball-dev opened this issue 8 months ago • 3 comments

Add support for an expandable blockquote tag, at least in HTML format.

Maybe it can be done in a more complete way and without introducing a new tag, but I wasn't able to hack my way around it.

MrSnowball-dev avatar Apr 24 '25 21:04 MrSnowball-dev

This is stretching "no new features" in v1 a bit too much.

Perhaps the code can instead be refactored, so that it's easier for users to add what they need "from the outside".

Lonami avatar Apr 25 '25 05:04 Lonami

I've previously submitted a similar pr, but it was rejected as a new feature. ah...But since it's a feature that exists in the official Bots API, adding it should be considered a bug fix, right?So I'm currently using a monkey patch.

from dowhen import when
from telethon.extensions.html import HTMLToTelegramParser

def html_callback(attrs, args):
  if 'expandable' in attrs.keys():
    args['collapsed'] = True
    return {'args': args}

when(HTMLToTelegramParser.handle_starttag, 'EntityType = MessageEntityBlockquote').do(
  html_callback
)

HBcao233 avatar Nov 12 '25 01:11 HBcao233

But since it's a feature that exists in the official Bots API

Telethon's formatting is not 100% compatible with Bot API's and that was on purpose. Aligning with them would be a breaking change.

TBH I just wish v2 was in a ready state so we could actually use that as an opportunity to align.

Lonami avatar Nov 13 '25 16:11 Lonami