mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-03 21:24:35 +03:00
Stop using await with properties
This commit is contained in:
parent
0d09f9d8c1
commit
410518aa65
|
@ -171,7 +171,7 @@ class ChatAction(EventBuilder):
|
||||||
``entity`` already set.
|
``entity`` already set.
|
||||||
"""
|
"""
|
||||||
return await self._client.send_message(
|
return await self._client.send_message(
|
||||||
await self.input_chat, *args, **kwargs)
|
await self.get_input_chat(), *args, **kwargs)
|
||||||
|
|
||||||
async def reply(self, *args, **kwargs):
|
async def reply(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
@ -186,7 +186,7 @@ class ChatAction(EventBuilder):
|
||||||
|
|
||||||
kwargs['reply_to'] = self.action_message.id
|
kwargs['reply_to'] = self.action_message.id
|
||||||
return await self._client.send_message(
|
return await self._client.send_message(
|
||||||
await self.input_chat, *args, **kwargs)
|
await self.get_input_chat(), *args, **kwargs)
|
||||||
|
|
||||||
async def delete(self, *args, **kwargs):
|
async def delete(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
@ -202,7 +202,9 @@ class ChatAction(EventBuilder):
|
||||||
return
|
return
|
||||||
|
|
||||||
return await self._client.delete_messages(
|
return await self._client.delete_messages(
|
||||||
await self.input_chat, [self.action_message], *args, **kwargs)
|
await self.get_input_chat(), [self.action_message],
|
||||||
|
*args, **kwargs
|
||||||
|
)
|
||||||
|
|
||||||
async def get_pinned_message(self):
|
async def get_pinned_message(self):
|
||||||
"""
|
"""
|
||||||
|
@ -212,7 +214,8 @@ class ChatAction(EventBuilder):
|
||||||
if self._pinned_message == 0:
|
if self._pinned_message == 0:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if isinstance(self._pinned_message, int) and await self.input_chat:
|
if isinstance(self._pinned_message, int)\
|
||||||
|
and await self.get_input_chat():
|
||||||
r = await self._client(functions.channels.GetMessagesRequest(
|
r = await self._client(functions.channels.GetMessagesRequest(
|
||||||
self._input_chat, [self._pinned_message]
|
self._input_chat, [self._pinned_message]
|
||||||
))
|
))
|
||||||
|
|
|
@ -97,7 +97,7 @@ class MessageRead(EventBuilder):
|
||||||
was read instead checking if it's in here.
|
was read instead checking if it's in here.
|
||||||
"""
|
"""
|
||||||
if self._messages is None:
|
if self._messages is None:
|
||||||
chat = await self.input_chat
|
chat = await self.get_input_chat()
|
||||||
if not chat:
|
if not chat:
|
||||||
self._messages = []
|
self._messages = []
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -675,7 +675,7 @@ class Message:
|
||||||
if sum(int(x is not None) for x in (i, text, filter)) >= 2:
|
if sum(int(x is not None) for x in (i, text, filter)) >= 2:
|
||||||
raise ValueError('You can only set either of i, text or filter')
|
raise ValueError('You can only set either of i, text or filter')
|
||||||
|
|
||||||
if not await self.buttons:
|
if not await self.get_buttons():
|
||||||
return # Accessing the property sets self._buttons[_flat]
|
return # Accessing the property sets self._buttons[_flat]
|
||||||
|
|
||||||
if text is not None:
|
if text is not None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user