You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What kind of feature are you missing? Where do you notice a shortcoming of PTB?
The discussion with TG in tdlib/telegram-bot-api#515 has made it clear that we should encourage users to work more with MessageEntities rather than with our text_html/markdown helpers. Since this is sometimes cumbersome, convenience functionality for working with ME is surely advisable and we've made a step into that direction with #4323 .
What I'd like to see in addition is convenience functionality for catenating text with entities as initially touched in tdlib/telegram-bot-api#515 (comment)
Describe the solution you'd like
new class methods
ME.shift_entities(entities: Sequence[ME], by: str | int) -> Sequence[ME]: shifts the entities by the specified length or the utf-16 length of the string of by is a string. This would be useful for adding a prefix to a message with entities
ME.concatetane(first: tuple[str, Sequence[ME]], second: tuple[str, Sequence[ME]]) -> tuple[str, Sequence[ME]]: Concatenates text and entities. Uses ME.shift_entities internally
Describe alternatives you've considered
ME.concatenate could be skipped in a first step as it can be implemented using shift_entities
Additional context
No response
The text was updated successfully, but these errors were encountered:
What kind of feature are you missing? Where do you notice a shortcoming of PTB?
The discussion with TG in tdlib/telegram-bot-api#515 has made it clear that we should encourage users to work more with MessageEntities rather than with our
text_html/markdown
helpers. Since this is sometimes cumbersome, convenience functionality for working with ME is surely advisable and we've made a step into that direction with #4323 .What I'd like to see in addition is convenience functionality for catenating text with entities as initially touched in tdlib/telegram-bot-api#515 (comment)
Describe the solution you'd like
new class methods
ME.shift_entities(entities: Sequence[ME], by: str | int) -> Sequence[ME]
: shifts the entities by the specified length or the utf-16 length of the string ofby
is a string. This would be useful for adding a prefix to a message with entitiesME.concatetane(first: tuple[str, Sequence[ME]], second: tuple[str, Sequence[ME]]) -> tuple[str, Sequence[ME]]
: Concatenates text and entities. UsesME.shift_entities
internallyDescribe alternatives you've considered
ME.concatenate
could be skipped in a first step as it can be implemented usingshift_entities
Additional context
No response
The text was updated successfully, but these errors were encountered: