Merge branch 'master' of github.com:LonamiWebs/Telethon

This commit is contained in:
Lonami Exo
2017-12-28 01:17:30 +01:00
10 changed files with 34 additions and 37 deletions

View File

@@ -13,9 +13,8 @@ except ImportError:
from . import TelegramBareClient
from . import helpers, utils
from .errors import (
RPCError, UnauthorizedError, InvalidParameterError, PhoneCodeEmptyError,
PhoneCodeExpiredError, PhoneCodeHashEmptyError, PhoneCodeInvalidError,
LocationInvalidError
RPCError, UnauthorizedError, PhoneCodeEmptyError, PhoneCodeExpiredError,
PhoneCodeHashEmptyError, PhoneCodeInvalidError, LocationInvalidError
)
from .network import ConnectionMode
from .tl import TLObject
@@ -380,7 +379,7 @@ class TelegramClient(TelegramBareClient):
if parse_mode in {'md', 'markdown'}:
message, msg_entities = markdown.parse(message)
else:
raise ValueError('Unknown parsing mode', parse_mode)
raise ValueError('Unknown parsing mode: {}'.format(parse_mode))
else:
msg_entities = []
@@ -571,7 +570,7 @@ class TelegramClient(TelegramBareClient):
"""
if max_id is None:
if not messages:
raise InvalidParameterError(
raise ValueError(
'Either a message list or a max_id must be provided.')
if hasattr(message, '__iter__'):
@@ -599,7 +598,7 @@ class TelegramClient(TelegramBareClient):
# hex(crc32(b'Message')) = 0x790009e3
return reply_to.id
raise ValueError('Invalid reply_to type: ', type(reply_to))
raise TypeError('Invalid reply_to type: {}'.format(type(reply_to)))
# endregion
@@ -1070,9 +1069,15 @@ class TelegramClient(TelegramBareClient):
an username, and processes all the found entities on the session.
The string may also be a user link, or a channel/chat invite link.
<<<<<<< HEAD
This method has the side effect of adding the found users to the
session database, so it can be queried later without API calls,
if this option is enabled on the session.
=======
raise TypeError(
'Cannot turn "{}" into any entity (user or chat)'.format(entity)
)
>>>>>>> 6ec6967ff9a2e09aae70b500273075bdfbae975c
Returns the found entity.
"""
@@ -1141,7 +1146,7 @@ class TelegramClient(TelegramBareClient):
pass
if not is_peer:
raise ValueError(
raise TypeError(
'Cannot turn "{}" into an input entity.'.format(peer)
)