mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Move TelegramClient.list_sessions to *Session.list_session
This commit is contained in:
parent
56bf5f7c87
commit
96d8ca94cf
|
@ -1,7 +1,5 @@
|
|||
import platform
|
||||
from datetime import timedelta
|
||||
from mimetypes import guess_type
|
||||
from os import listdir, path
|
||||
from threading import Event, RLock, Thread
|
||||
from time import sleep
|
||||
|
||||
|
@ -364,13 +362,6 @@ class TelegramClient(TelegramBareClient):
|
|||
except UnauthorizedError:
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def list_sessions():
|
||||
"""Lists all the sessions of the users who have ever connected
|
||||
using this client and never logged out"""
|
||||
return [path.splitext(path.basename(f))[0]
|
||||
for f in listdir('.') if f.endswith('.session')]
|
||||
|
||||
# endregion
|
||||
|
||||
# region Dialogs ("chats") requests
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user