mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-26 11:23:46 +03:00
Support InputNotifyPeer autocast
This commit is contained in:
parent
dfda61a1b5
commit
bd878acbde
|
@ -337,4 +337,18 @@ class UserMethods(TelegramBaseClient):
|
||||||
'Cannot find any entity corresponding to "{}"'.format(string)
|
'Cannot find any entity corresponding to "{}"'.format(string)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def _get_input_notify(self, notify):
|
||||||
|
"""
|
||||||
|
Returns a :tl:`InputNotifyPeer`. This is a bit tricky because
|
||||||
|
it may or not need access to the client to convert what's given
|
||||||
|
into an input entity.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
if notify.SUBCLASS_OF_ID == 0x58981615:
|
||||||
|
if isinstance(notify, types.InputNotifyPeer):
|
||||||
|
notify.peer = await self.get_input_entity(notify.peer)
|
||||||
|
return notify
|
||||||
|
except AttributeError:
|
||||||
|
return types.InputNotifyPeer(await self.get_input_entity(notify))
|
||||||
|
|
||||||
# endregion
|
# endregion
|
||||||
|
|
|
@ -23,6 +23,7 @@ AUTO_CASTS = {
|
||||||
'InputDialogPeer':
|
'InputDialogPeer':
|
||||||
'utils.get_input_dialog(await client.get_input_entity({}))',
|
'utils.get_input_dialog(await client.get_input_entity({}))',
|
||||||
|
|
||||||
|
'InputNotifyPeer': 'await client._get_input_notify({})',
|
||||||
'InputMedia': 'utils.get_input_media({})',
|
'InputMedia': 'utils.get_input_media({})',
|
||||||
'InputPhoto': 'utils.get_input_photo({})',
|
'InputPhoto': 'utils.get_input_photo({})',
|
||||||
'InputMessage': 'utils.get_input_message({})'
|
'InputMessage': 'utils.get_input_message({})'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user