Skip to content

Newbie friendly update

Pre-release
Pre-release
Compare
Choose a tag to compare
@Lonami Lonami released this 22 Aug 23:59
Scheme layer used: 70

This update is overall an attempt to make Telethon a bit more user friendly, along with some other stability enhancements, although it brings quite a few changes.

Things that will probably break your code

  • The TelegramClient methods .send_photo_file(), .send_document_file() and .send_media_file() are now a single method called .send_file(). It's also important to note that the order of the parameters has been swapped: first to who you want to send it, then the file itself.

  • The same applies to .download_msg_media(), which has been renamed to .download_media(). The method now supports a Message itself too, rather than only Message.media. The specialized .download_photo(), .download_document() and .download_contact() still exist, but are private.

More new stuff

  • Updated to layer 70!
  • Both downloading and uploading now support stream-like objects.
  • A lot faster initial connection if sympy is installed (can be installed through pip).
  • libssl will also be used if available on your system (likely on Linux based systems). This speed boost should also apply to uploading and downloading files.
  • You can use a phone number or an username for methods like .send_message(), .send_file(), and all the other quick-access methods provided by the TelegramClient.

Bug fixes

  • Crashing when migrating to a new layer and receiving old updates should not happen now.
  • InputPeerChannel is now casted to InputChannel automtically too.
  • .get_new_msg_id() should now be thread-safe. No promises.
  • Logging out on macOS caused a crash, which should be gone now.
  • More checks to ensure that the connection is flagged correctly as either connected or not.

Bug additions

  • Downloading files from CDN's will not work yet (something new that comes with layer 70).

That's it, any new idea or suggestion about how to make the project even more friendly is highly appreciated.

P.S.: Did you know that you can pretty print any result Telegram returns (called TLObject's) by using their .stringify() function? Great for debugging!