Telethon Updates
1.45K subscribers
29 photos
21 files
1.34K links
Official channel for updates about Telethon.
Official English group: @TelethonChat

Other channels:
• Russian: @TelethonRussian
• Persian: @TelethonGap
• Snippets: @TelethonSnippets2
Download Telegram
I'm steadily making progress towards version 2.0 of the library (after several years of waiting), so you might see a few polls pop up here over the next few weeks, where I see arguments in favour of a specific change, but the community may disagree for some reason (if you do, please argument why in @TelethonChat). So here it goes.

Note that version 2.0's primary goal is removing oddities (and necessarily breaking old code for the better). You can see progress in the v2 branch of GitHub, and the current list of breaking changes in v2-migration-guide.rst. Please do raise your voice if there is something you largely disagree with (and "ugh you're making me change my code!!1!" is not a good argument).
On raw API types, should __str__ output the same as the current stringify (multiline, pretty printed), and __repr__ output the same as the current __str__ (singleline, pretty printed)?
Anonymous Poll
16%
Yes
84%
No
Poll #1. How should the output of __str__ and __repr__ change? (Sorry, but it needs to be public or bots would ruin it again.)

The current output of obj.stringify() is as follows:

InputPeerUser(
user_id=123,
access_hash=456
)

The current output of __str__ is as follows:

InputPeerUser(user_id=123, access_hash=456)

And the current output of __repr__ is as follows:

<telethon._tl.InputPeerUser object at 0x7f9f870d5fd0>



The idea would be for __str__ to be:

InputPeerUser(
user_id=123,
access_hash=456
)

And __repr__ to be:

InputPeerUser(user_id=123, access_hash=456)

The old __repr__ output isn't really useful. The only argument for keeping it is to not spam the REPL when using interactive mode. The old __str__ is hard to read, because objects get really big. Please vote on the options that apply.
Telethon Updates
On raw API types, should __str__ output the same as the current stringify (multiline, pretty printed), and __repr__ output the same as the current __str__ (singleline, pretty printed)?
(To whoever is using bots to vote on this without even looking at the message, thanks for ruining the way I gauge interest in a change, and I hope you get banned.)
Telethon Updates pinned «Poll #1. How should the output of __str__ and __repr__ change? (Sorry, but it needs to be public or bots would ruin it again.) The current output of obj.stringify() is as follows: InputPeerUser( user_id=123, access_hash=456 ) The current output of __str__…»
Forwarded from KeralaGram [Official]®
Third-party developers using the Telegam API are required to support and properly display official sponsored messages in their apps by December 15, 2021.

https://corefork.telegram.org/api/sponsored-messages

ℹ️ @KeralaGramChannel
What does this mean for Telethon users? My interpretation is, if you're developing an application which can access the message history from channels and bot accounts, you are required to show these messages. If your application is published to some store, the risk of consequences for not complying is probably higher.

I am not a lawyer, but personal use or "userbots" (which simply enhance your experience with "commands") are probably safe. Still, you should read the official statement at https://core.telegram.org/api/sponsored-messages (the date seems to be now January 1, 2022).

As usual, using a library to interact with Telegram's library does not exempt you from complying with Telegram's Terms and Conditions yourself. The library is only a means to use the API, but you, the developer, have to make sure your application complies. Failing to comply risks getting your API access revoked.
Forwarded from lonami
Telegram has started enforcing the use of 64-bit identifiers for users and chats, and the current stable version of the library does not support them yet. If you try to login, you may see UPDATE_APP_TO_LOGIN error.

I will try to find time to update the library as soon as possible. Although the first version supporting this new layer may not be as well-tested as I would've liked (because I haven't had much time to devote to open source lately). Thank you for your patience.

If you want to stay updated, so you can subscribe to the GitHub thread https://github.com/LonamiWebs/Telethon/issues/3215.

If someone desperatily needs this fix, please uninstall telethon and install https://t.me/TelethonChat/400936 as a temporary workaround (or spechide's,
pip3 install git+git://github.com/SpEcHiDe/Telethon@72afe59#egg=telethon
) (or use a virtual environment).
Telethon Updates pinned «Telegram has started enforcing the use of 64-bit identifiers for users and chats, and the current stable version of the library does not support them yet. If you try to login, you may see UPDATE_APP_TO_LOGIN error. I will try to find time to update the library…»
Fix typo, add errors, and update to 133 again (#3157) (9c796e8 by SpEcHiDe)
Fix peer ID check to work with higher IDs (c9ecd61 by Lonami)
I have pushed v1.24 to PyPi, which fixes login (thus avoiding UPDATE_APP_TO_LOGIN), but I have not had the time to test this version thoroughly, so please make sure to report any issues you find on GitHub.

It contains the above two fixes (and the "latest" 133 layer, to prevent receiving broken constructors), but not the latest layer, currently 135, to avoid breaking more things than necessary). Note that if you uninstalled telethon to install the workarounds, you will now need to uninstall the workarounds and install telethon again.

Thank you for your patience and understanding.
Telethon Updates pinned «I have pushed v1.24 to PyPi, which fixes login (thus avoiding UPDATE_APP_TO_LOGIN), but I have not had the time to test this version thoroughly, so please make sure to report any issues you find on GitHub. It contains the above two fixes (and the "latest"…»
Bump to v1.24 (bda4259 by Lonami)
Add missing async when downloading from URL (#3222) (f9643bf by Nenirey)
Improve readability for readthedocs/concepts/entities.rst (#3259) (805898c by vladdoster)
Slight rewording of error message (#3256) (530284a by SpEcHiDe)
Add support for new invite link format (#3213) (674b7d6 by kdrag0n)
Proper usage of messagebox in update handling loop (0129192 by Lonami)
Fix messagebox porting errors (259fcca by Lonami)
Remove GitHub workflow (0d597d1 by Lonami)
Fix constructing PtsInfo for channels (de2cd1f by Lonami)
Fix update handling for channels (1f40372 by Lonami)
Process self-produced updates like any other (f1a517d by Lonami)
Handle TypeNotFoundError during gzip packed msgs (015acf2 by Lonami)
Persist session state and usage fixes (f547a00 by Lonami)
Reimplement catch_up (4b85ced by Lonami)
Add missing catch_up param to client init (3aa53dd by Lonami)
Don't store empty pts in messagebox (4b61ce1 by Lonami)
Fix reset_deadline check in messagebox (f7ccf8d by Lonami)
Properly load and save channel state (f775484 by Lonami)
Reintroduce keepalive pings in the sender (b0b1f30 by Lonami)
Review, unify and simplify retry_range usage (a25f019 by Lonami)
Add new features from new layer (#3676) (539e3cb by New-dev0)
Merge branch 'v2' (ed70991 by Lonami)
Avoid usage of __builtins__ in the generator (#3161) (d9e2a8a by penn5)
Fix flood_sleep_threshold was not being forwarded (4aa23cf by Lonami)
Use threads for factorization (3c7bb53 by Lonami)
Document more RPC errors (0eadca6 by Lonami)
Allow restricting channels (#3679) (7778e54 by New-dev0)