mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-18 23:15:48 +00:00
Allow pinning a thread using Thread.edit
This commit is contained in:
parent
92eb9d7d8e
commit
a8b26b9257
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user