Update telegram_client.py

Revert layout changes
This commit is contained in:
Joscha Götzer 2018-02-20 15:20:23 +01:00 committed by GitHub
parent 12838bc711
commit 9e5128547a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -324,7 +324,7 @@ class TelegramClient(TelegramBareClient):
else: else:
raise RuntimeError( raise RuntimeError(
'{} consecutive sign-in attempts failed. Aborting' '{} consecutive sign-in attempts failed. Aborting'
.format(max_attempts) .format(max_attempts)
) )
if two_step_detected: if two_step_detected:
@ -591,13 +591,13 @@ class TelegramClient(TelegramBareClient):
return update.message return update.message
elif (isinstance(update, UpdateEditMessage) and elif (isinstance(update, UpdateEditMessage) and
not isinstance(request.peer, InputPeerChannel)): not isinstance(request.peer, InputPeerChannel)):
if request.id == update.message.id: if request.id == update.message.id:
return update.message return update.message
elif (isinstance(update, UpdateEditChannelMessage) and elif (isinstance(update, UpdateEditChannelMessage) and
utils.get_peer_id(request.peer) == utils.get_peer_id(request.peer) ==
utils.get_peer_id(update.message.to_id)): utils.get_peer_id(update.message.to_id)):
if request.id == update.message.id: if request.id == update.message.id:
return update.message return update.message
@ -767,7 +767,7 @@ class TelegramClient(TelegramBareClient):
return self(messages.DeleteMessagesRequest(message_ids, revoke=revoke)) return self(messages.DeleteMessagesRequest(message_ids, revoke=revoke))
def get_message_history(self, entity, limit=20, offset_date=None, def get_message_history(self, entity, limit=20, offset_date=None,
offset_id=0, max_id=0, min_id=0, add_offset=0, offset_id=0, max_id=0, min_id=0, add_offset=0,
batch_size=100, wait_time=None): batch_size=100, wait_time=None):
""" """
Gets the message history for the specified entity Gets the message history for the specified entity
@ -886,7 +886,7 @@ class TelegramClient(TelegramBareClient):
m.message = getattr(m, 'message', None) m.message = getattr(m, 'message', None)
m.action = getattr(m, 'action', None) m.action = getattr(m, 'action', None)
m.sender = (None if not m.from_id else m.sender = (None if not m.from_id else
entities[utils.get_peer_id(m.from_id)]) entities[utils.get_peer_id(m.from_id)])
if getattr(m, 'fwd_from', None): if getattr(m, 'fwd_from', None):
m.fwd_from.sender = ( m.fwd_from.sender = (
@ -1768,7 +1768,6 @@ class TelegramClient(TelegramBareClient):
The event builder class or instance to be used, The event builder class or instance to be used,
for instance ``events.NewMessage``. for instance ``events.NewMessage``.
""" """
def decorator(f): def decorator(f):
self.add_event_handler(f, event) self.add_event_handler(f, event)
return f return f