mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 21:10:29 +00:00
Fixed revert by hand (I hope)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import platform
|
||||
from datetime import datetime
|
||||
from hashlib import md5
|
||||
from os import path
|
||||
from os import path, listdir
|
||||
from mimetypes import guess_extension, guess_type
|
||||
|
||||
# For sending and receiving requests
|
||||
@@ -35,7 +35,7 @@ from telethon.tl.all_tlobjects import layer
|
||||
class TelegramClient:
|
||||
|
||||
# Current TelegramClient version
|
||||
__version__ = '0.5'
|
||||
__version__ = '0.6'
|
||||
|
||||
# region Initialization
|
||||
|
||||
@@ -182,8 +182,7 @@ class TelegramClient:
|
||||
def log_out(self):
|
||||
"""Logs out and deletes the current session. Returns True if everything went OK"""
|
||||
try:
|
||||
# This request is a bit special. Nothing is received after
|
||||
self.sender.send(LogOutRequest())
|
||||
self.invoke(LogOutRequest())
|
||||
if not self.session.delete():
|
||||
return False
|
||||
|
||||
@@ -191,6 +190,13 @@ class TelegramClient:
|
||||
except:
|
||||
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 [path.splitext(path.basename(f))[0] # splitext = split ext (not spli text!)
|
||||
for f in listdir('.') if f.endswith('.session')]
|
||||
|
||||
# endregion
|
||||
|
||||
# region Dialogs ("chats") requests
|
||||
|
Reference in New Issue
Block a user