- Notifications
You must be signed in to change notification settings - Fork5.7k
Description
What kind of feature are you missing? Where do you notice a shortcoming of PTB?
The discussion with TG intdlib/telegram-bot-api#515 has made it clear that we should encourage users to work more with MessageEntities rather than with ourtext_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 intdlib/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
internally
Describe alternatives you've considered
ME.concatenate
could be skipped in a first step as it can be implemented usingshift_entities
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels