tg-archive icon indicating copy to clipboard operation
tg-archive copied to clipboard

Fix sync.py (_make_poll) TypeError: Object of type TextWithEntities i…

Open GoraPeak opened this issue 7 months ago • 2 comments

…s not JSON serializable

GoraPeak avatar Jun 09 '25 13:06 GoraPeak

Thanks for the PR @GoraPeak.

Did this change from .text to .text.text in the Telethon API recently? Polls were working earlier.

knadh avatar Jun 09 '25 14:06 knadh

Hello!

A synchronization error occurred while synchronizing the channel's telegrams. I followed the debugging steps for the _make_poll function, for this function code

options = [{“label”: a.text, “count”: 0, “correct”: False} for a in msg.media.poll.answers]

The type of the msg.media.poll.answers object corresponds to the PollAnswer structure (https://tl.telethon.dev/constructors/poll_answer.html), the type of the text field corresponds to the TextWithEntities type (https://tl.telethon.dev/constructors/text_with_entities.html), which has the text:string attribute. I don't know when the API was changed.

GoraPeak avatar Jun 09 '25 15:06 GoraPeak