Add reactions to export chat history
This should allow to export reactions in both JSON and HTML exports. Fixes #27971
Tested in a local environment.
Current limitations in HTML output:
- Not rendering userpics. Only initials. As far as I understand, chat messages also don't render userpics.
- Not rendering custom emojis. It looks like there is no existing way to render them in HTML output and in messages they are not rendered as well. But instead, simple emoji alternative is rendered. Unfortunately, for reactions there is no simplified emoji provided. Thus, it is not possible to render custom emojis. As a placeholder I added "(custom emoji)".
Example JSON message with reactions:
{
"id": 112233,
"type": "message",
...
"reactions": [
{
"type": "emoji",
"count": 1,
"emoji": "😁",
"recent": [
{
"from": "Jane Smith",
"from_id": "user54321",
"date": "2023-11-08T10:10:30"
}
]
},
{
"type": "emoji",
"count": 1,
"emoji": "😢",
"recent": [
{
"from": "John Doe",
"from_id": "user12345",
"date": "2023-11-08T10:20:30"
}
]
}
]
},
Example generated HTML:

As you can see, custom emojis embedded into text_entries were properly serialized as a path to an image. I tried to follow the same code for serializing custom emojis in reactions, but somehow it is still different. I am definitely missing something, but cannot yet figure out exactly what.
Nice! I'll try to look into that after the current release (that I'm building now).
@BohdanTkachenko Please update to the latest code that should take care of paid reactions (star reactions),
I have exported a couple channels for a test and I see reactions as a vertical list.
Screenshot
I have exported a couple channels for a test and I see reactions as a vertical list.
Screenshot
Hmm... I don't see such issue. For me it shows them horizontally.
I checked in Chrome and Firefox and in both it renders properly. I mean it still a bit ugly because I don't know what to do with custom emojis, but it renders them horizontally.
Would you mind sharing a bit more info about the issue? Like what OS and browser. Also, can you please try to reproduce it in some public channel, so I can reproduce it later on my machine. Also maybe you can share a snippet of generated HTML so I can take a look?
I just fixed the rendering for paid reactions and also I decided to put waving hand emoji (👋) instead of (custom emoji) placeholder. This makes it look nice overall, however not really accurate. Please let me know if you have a better idea how to do this.
Here is what I have right now (tested on https://t.me/durov channel):
Would you mind sharing a bit more info about the issue? Like what OS and browser. Also, can you please try to reproduce it in some public channel, so I can reproduce it later on my machine. Also maybe you can share a snippet of generated HTML so I can take a look?
I have tested the latest code and the issue seems to had gone away.
Don’t forget to rebase.
Don’t forget to rebase.
you an merge rebasing. :)
Thanks for the hard work!
