Skip to content

LoginFlag


class LoginFlag

class LoginFlag(int)

Login flag for converting sessions between TDesktop and TelegramClient.

Attributes:

Name Type Description
UseCurrentSession LoginFlag Use the current session.
CreateNewSession LoginFlag Create a new session.

Related:


class UseCurrentSession

class UseCurrentSession(LoginFlag)

Use the current session.

  • Convert an already-logged in session of Telegram Desktop to Telethon and vice versa.

  • The "session" is just an 256-bytes AuthKey that get stored in tdata folder or Telethon session files (under sqlite3 format).

  • UseCurrentSession's only job is to read this key and convert it to one another.

Use at your own risk!

You should only use the same consistant API through out the session.
Don't use a same session with multiple different APIs, you might be banned.


class CreateNewSession

class CreateNewSession(LoginFlag)

Create a new session.

  • Use the current session to authorize the new session by Login via QR code.

  • This works just like when you signing into Telegram using QR Login on mobile devices.

  • Although Telegram Desktop doesn't let you authorize other sessions via QR Code (or it doesn't have that feature), it is still available across all platforms (APIs).

Safe to use

You can always use CreateNewSessions with any APIs, it can be different from the API that originally created the session.