mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-30 17:59:55 +03:00
add pm_oneside parameter
This commit is contained in:
parent
249670827c
commit
14378898cd
|
@ -1322,7 +1322,8 @@ class MessageMethods:
|
||||||
entity: 'hints.EntityLike',
|
entity: 'hints.EntityLike',
|
||||||
message: 'typing.Optional[hints.MessageIDLike]',
|
message: 'typing.Optional[hints.MessageIDLike]',
|
||||||
*,
|
*,
|
||||||
notify: bool = False
|
notify: bool = False,
|
||||||
|
pm_oneside: bool = False
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Pins a message in a chat.
|
Pins a message in a chat.
|
||||||
|
@ -1342,6 +1343,11 @@ class MessageMethods:
|
||||||
|
|
||||||
notify (`bool`, optional):
|
notify (`bool`, optional):
|
||||||
Whether the pin should notify people or not.
|
Whether the pin should notify people or not.
|
||||||
|
|
||||||
|
pm_oneside (`bool`, optional):
|
||||||
|
Whether the message should be deleted for everyone or not.
|
||||||
|
By default it has the opposite behaviour of official clients,
|
||||||
|
and it will pin the message for both sides, in private chats.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
@ -1350,7 +1356,7 @@ class MessageMethods:
|
||||||
message = await client.send_message(chat, 'Pinotifying is fun!')
|
message = await client.send_message(chat, 'Pinotifying is fun!')
|
||||||
await client.pin_message(chat, message, notify=True)
|
await client.pin_message(chat, message, notify=True)
|
||||||
"""
|
"""
|
||||||
return await self._pin(entity, message, unpin=False, notify=notify)
|
return await self._pin(entity, message, unpin=False, notify=notify, pm_oneside=pm_oneside)
|
||||||
|
|
||||||
async def unpin_message(
|
async def unpin_message(
|
||||||
self: 'TelegramClient',
|
self: 'TelegramClient',
|
||||||
|
@ -1382,7 +1388,7 @@ class MessageMethods:
|
||||||
"""
|
"""
|
||||||
return await self._pin(entity, message, unpin=True, notify=notify)
|
return await self._pin(entity, message, unpin=True, notify=notify)
|
||||||
|
|
||||||
async def _pin(self, entity, message, *, unpin, notify=False):
|
async def _pin(self, entity, message, *, unpin, notify=False, pm_oneside=False):
|
||||||
message = utils.get_message_id(message) or 0
|
message = utils.get_message_id(message) or 0
|
||||||
entity = await self.get_input_entity(entity)
|
entity = await self.get_input_entity(entity)
|
||||||
if message <= 0: # old behaviour accepted negative IDs to unpin
|
if message <= 0: # old behaviour accepted negative IDs to unpin
|
||||||
|
@ -1394,6 +1400,7 @@ class MessageMethods:
|
||||||
id=message,
|
id=message,
|
||||||
silent=not notify,
|
silent=not notify,
|
||||||
unpin=unpin,
|
unpin=unpin,
|
||||||
|
pm_oneside=pm_oneside
|
||||||
)
|
)
|
||||||
result = await self(request)
|
result = await self(request)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user