mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 19:03:46 +03:00
Fix some methods in Message were not checking for client
This commit is contained in:
parent
a7a7c4add2
commit
e8327da189
|
@ -862,8 +862,9 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
|
||||||
<telethon.client.messages.MessageMethods.send_read_acknowledge>`
|
<telethon.client.messages.MessageMethods.send_read_acknowledge>`
|
||||||
with both ``entity`` and ``message`` already set.
|
with both ``entity`` and ``message`` already set.
|
||||||
"""
|
"""
|
||||||
await self._client.send_read_acknowledge(
|
if self._client:
|
||||||
await self.get_input_chat(), max_id=self.id)
|
await self._client.send_read_acknowledge(
|
||||||
|
await self.get_input_chat(), max_id=self.id)
|
||||||
|
|
||||||
async def pin(self, *, notify=False):
|
async def pin(self, *, notify=False):
|
||||||
"""
|
"""
|
||||||
|
@ -871,8 +872,12 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
|
||||||
`telethon.client.messages.MessageMethods.pin_message`
|
`telethon.client.messages.MessageMethods.pin_message`
|
||||||
with both ``entity`` and ``message`` already set.
|
with both ``entity`` and ``message`` already set.
|
||||||
"""
|
"""
|
||||||
await self._client.pin_message(
|
# TODO Constantly checking if client is a bit annoying,
|
||||||
await self.get_input_chat(), self.id, notify=notify)
|
# maybe just make it illegal to call messages from raw API?
|
||||||
|
# That or figure out a way to always set it directly.
|
||||||
|
if self._client:
|
||||||
|
await self._client.pin_message(
|
||||||
|
await self.get_input_chat(), self.id, notify=notify)
|
||||||
|
|
||||||
# endregion Public Methods
|
# endregion Public Methods
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user