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

@@ -74,13 +74,13 @@ def get_extension(media):
def _raise_cast_fail(entity, target):
raise ValueError('Cannot cast {} to any kind of {}.'
.format(type(entity).__name__, target))
raise TypeError('Cannot cast {} to any kind of {}.'.format(
type(entity).__name__, target))
def get_input_peer(entity, allow_self=True):
"""Gets the input peer for the given "entity" (user, chat or channel).
A ValueError is raised if the given entity isn't a supported type."""
A TypeError is raised if the given entity isn't a supported type."""
if not isinstance(entity, TLObject):
_raise_cast_fail(entity, 'InputPeer')