mirror of
https://github.com/MelisaDev/melisa.git
synced 2024-11-11 19:07:28 +03:00
thread join, leave method
This commit is contained in:
parent
c5baf6b9bf
commit
91d3ed6882
1 changed files with 32 additions and 1 deletions
|
@ -676,11 +676,42 @@ class Thread(MessageableChannel):
|
||||||
HTTPException
|
HTTPException
|
||||||
The request to perform the action failed with other http exception.
|
The request to perform the action failed with other http exception.
|
||||||
ForbiddenError
|
ForbiddenError
|
||||||
You do not have permissions to add the user to the thread.
|
You do not have permissions to remove the user to the thread.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
await self._http.delete(f"channels/{self.id}/thread-members/{user_id}")
|
await self._http.delete(f"channels/{self.id}/thread-members/{user_id}")
|
||||||
|
|
||||||
|
async def join(self) -> None:
|
||||||
|
"""|coro|
|
||||||
|
|
||||||
|
Joins this thread.
|
||||||
|
|
||||||
|
You must have ``SEND_MESSAGES_IN_THREADS`` to join a thread.
|
||||||
|
If the thread is private, ``MANAGE_THREADS`` is also needed.
|
||||||
|
|
||||||
|
Raises
|
||||||
|
-------
|
||||||
|
HTTPException
|
||||||
|
The request to perform the action failed with other http exception.
|
||||||
|
ForbiddenError
|
||||||
|
You do not have permissions to join the thread.
|
||||||
|
"""
|
||||||
|
|
||||||
|
await self._http.put(f"/channels/{self.id}/thread-members/@me")
|
||||||
|
|
||||||
|
async def leave(self) -> None:
|
||||||
|
"""|coro|
|
||||||
|
|
||||||
|
Leaves this thread.
|
||||||
|
|
||||||
|
Raises
|
||||||
|
-------
|
||||||
|
HTTPException
|
||||||
|
The request to perform the action failed with other http exception.
|
||||||
|
"""
|
||||||
|
|
||||||
|
await self._http.delete(f"/channels/{self.id}/thread-members/@me")
|
||||||
|
|
||||||
|
|
||||||
@dataclass(repr=False)
|
@dataclass(repr=False)
|
||||||
class ThreadsList(APIModelBase):
|
class ThreadsList(APIModelBase):
|
||||||
|
|
Loading…
Reference in a new issue