diff --git a/discord/http.py b/discord/http.py index 0efd55005..455f872a6 100644 --- a/discord/http.py +++ b/discord/http.py @@ -883,6 +883,7 @@ class HTTPClient: 'locked', 'invitable', 'default_auto_archive_duration', + 'flags', ) payload = {k: v for k, v in options.items() if k in valid_keys} return self.request(r, reason=reason, json=payload) diff --git a/discord/threads.py b/discord/threads.py index 6123dbbb6..10e91a571 100644 --- a/discord/threads.py +++ b/discord/threads.py @@ -514,6 +514,7 @@ class Thread(Messageable, Hashable): archived: bool = MISSING, locked: bool = MISSING, invitable: bool = MISSING, + pinned: bool = MISSING, slowmode_delay: int = MISSING, auto_archive_duration: ThreadArchiveDuration = MISSING, ) -> Thread: @@ -536,6 +537,8 @@ class Thread(Messageable, Hashable): Whether to archive the thread or not. locked: :class:`bool` Whether to lock the thread or not. + pinned: :class:`bool` + Whether to pin the thread or not. This only works if the thread is part of a forum. invitable: :class:`bool` Whether non-moderators can add other non-moderators to this thread. Only available for private threads. @@ -571,6 +574,10 @@ class Thread(Messageable, Hashable): payload['invitable'] = invitable if slowmode_delay is not MISSING: payload['rate_limit_per_user'] = slowmode_delay + if pinned is not MISSING: + flags = self.flags + flags.pinned = pinned + payload['flags'] = flags.value data = await self._state.http.edit_channel(self.id, **payload) # The data payload will always be a Thread payload