mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-09 05:19:41 +00:00
Allow passing entities instead input_peers and more*
Some fixes to the interactive client (not handling invalid options, errors when uploading files)
This commit is contained in:
@@ -44,6 +44,11 @@ def get_extension(media):
|
||||
def get_input_peer(entity):
|
||||
"""Gets the input peer for the given "entity" (user, chat or channel).
|
||||
Returns None if it was not found"""
|
||||
if (isinstance(entity, InputPeerUser) or
|
||||
isinstance(entity, InputPeerChat) or
|
||||
isinstance(entity, InputPeerChannel)):
|
||||
return entity
|
||||
|
||||
if isinstance(entity, User):
|
||||
return InputPeerUser(entity.id, entity.access_hash)
|
||||
if isinstance(entity, Chat):
|
||||
|
Reference in New Issue
Block a user