With recent Telegram changes,
Telethon has the possibility of keeping that field as
Telethon has offered
Therefore the options are:
• Proceed as normal with layer upgrades and change the raw fields. People wanting the integer ID can use (and should have been using)
• Special case the field and give it a new name, preserving the old one to be an integer.
In any case, developers need to now expect that the sender can be something other than a User, despite the decision made.
Message.from_id
is now a Peer
and not a int
because it has to represent that the message may come from a Chat now, and not a User.Telethon has the possibility of keeping that field as
int
to remain being the marked sender ID, and save the new field under a different name like from_peer
. However, even "raw API" would be affected and the field names would no longer match with what Telegram calls them, which could be confusing and adds yet another special case to the code.Telethon has offered
Message.sender_id
for a long time, and it has been and will remain being the marked integer ID of the sender. After all, Message.from_id
was a field coming from raw API, and raw API is prone to breaking in minor releases as it's known when layers change.Therefore the options are:
• Proceed as normal with layer upgrades and change the raw fields. People wanting the integer ID can use (and should have been using)
.sender_id
. • Special case the field and give it a new name, preserving the old one to be an integer.
In any case, developers need to now expect that the sender can be something other than a User, despite the decision made.
Migrate to from_id being a Peer
Anonymous Poll
70%
Yes, from_id will become a Peer and sender_id an integer
30%
No, favour inconsistency in raw API to avoid breaking code (still need to handle non-user IDs)
Telethon Updates pinned «With recent Telegram changes, Message.from_id is now a Peer and not a int because it has to represent that the message may come from a Chat now, and not a User. Telethon has the possibility of keeping that field as int to remain being the marked sender ID…»
Fix internal get_me() was not expecting network errors (#1594) (d0faaa2 by vegeta1k95)