mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 21:10:29 +00:00
Move TelegramClient.list_sessions to *Session.list_session
This commit is contained in:
@@ -145,6 +145,14 @@ class JsonSession:
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def list_sessions():
|
||||
"""Lists all the sessions of the users who have ever connected
|
||||
using this client and never logged out
|
||||
"""
|
||||
return [os.path.splitext(os.path.basename(f))[0]
|
||||
for f in os.listdir('.') if f.endswith('.session')]
|
||||
|
||||
@staticmethod
|
||||
def try_load_or_create_new(session_user_id):
|
||||
"""Loads a saved session_user_id.session or creates a new one.
|
||||
|
Reference in New Issue
Block a user