Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion twilight-http/src/request/channel/thread/update_thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
use serde::Serialize;
use std::future::IntoFuture;
use twilight_model::{
channel::{Channel, thread::AutoArchiveDuration},
channel::{Channel, ChannelFlags, thread::AutoArchiveDuration},
id::{
Id,
marker::{ChannelMarker, TagMarker},
Expand All @@ -31,6 +31,8 @@ struct UpdateThreadFields<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
auto_archive_duration: Option<AutoArchiveDuration>,
#[serde(skip_serializing_if = "Option::is_none")]
flags: Option<Nullable<ChannelFlags>>,
#[serde(skip_serializing_if = "Option::is_none")]
invitable: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
locked: Option<bool>,
Expand Down Expand Up @@ -60,6 +62,7 @@ impl<'a> UpdateThread<'a> {
applied_tags: None,
archived: None,
auto_archive_duration: None,
flags: None,
invitable: None,
locked: None,
name: None,
Expand Down Expand Up @@ -109,6 +112,15 @@ impl<'a> UpdateThread<'a> {
self
}

/// Sets the thread's flags.
pub const fn flags(mut self, flags: Option<ChannelFlags>) -> Self {
if let Ok(fields) = self.fields.as_mut() {
fields.flags = Some(Nullable(flags));
}

self
}

/// Whether non-moderators can add other non-moderators to a thread.
pub const fn invitable(mut self, invitable: bool) -> Self {
if let Ok(fields) = self.fields.as_mut() {
Expand Down Expand Up @@ -243,6 +255,7 @@ mod tests {
applied_tags: None,
archived: None,
auto_archive_duration: None,
flags: None,
invitable: None,
locked: None,
name: None,
Expand Down
2 changes: 2 additions & 0 deletions twilight-model/src/channel/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ bitflags! {
const PINNED = 1 << 1;
/// New threads in a forum channel require a tag.
const REQUIRE_TAG = 1 << 4;
/// Hide the download options for this post in a media channel.
const HIDE_MEDIA_DOWNLOAD_OPTIONS = 1 << 15;
}
}

Expand Down