mirror of
https://github.com/MelisaDev/melisa.git
synced 2024-09-22 19:22:01 +03:00
unpin message method
This commit is contained in:
parent
179b2f8a7c
commit
6f0058b7a4
1 changed files with 30 additions and 0 deletions
|
@ -229,3 +229,33 @@ class Message(APIModelBase):
|
|||
f"channels/{self.channel_id}/pins/{self.id}",
|
||||
headers={"X-Audit-Log-Reason": reason},
|
||||
)
|
||||
|
||||
async def unpin(
|
||||
self, *, reason: Optional[str] = None
|
||||
) -> None:
|
||||
"""|coro|
|
||||
|
||||
Unpins the message.
|
||||
|
||||
You must have the ``MANAGE_MESSAGES` permission to do this in a non-private channel context.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
reason: Optional[:class:`str`]
|
||||
The reason for unpinning the message. Shows up on the audit log.
|
||||
|
||||
Raises
|
||||
-------
|
||||
HTTPException
|
||||
Pinning the message failed, probably due to the channel having more than 50 pinned messages.
|
||||
ForbiddenError
|
||||
You do not have permissions to unpin the message.
|
||||
NotFound
|
||||
The message or channel was not found or deleted.
|
||||
"""
|
||||
|
||||
await self._http.delete(
|
||||
f"channels/{self.channel_id}/pins/{self.id}",
|
||||
headers={"X-Audit-Log-Reason": reason},
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue