aboutsummaryrefslogtreecommitdiff
path: root/src/builder
diff options
context:
space:
mode:
authorKyle Clemens <[email protected]>2018-01-08 13:18:13 -0500
committeralex <[email protected]>2018-01-08 19:18:13 +0100
commit6587655bf90d662191538b11884311e5aff4b120 (patch)
treec27db8c664503cc9d18c49ce601ed66c06ce2fd7 /src/builder
parentSet a travis caching timeout of 900 seconds (diff)
downloadserenity-6587655bf90d662191538b11884311e5aff4b120.tar.xz
serenity-6587655bf90d662191538b11884311e5aff4b120.zip
Allow channels to be moved in and out of a category (#248)
Diffstat (limited to 'src/builder')
-rw-r--r--src/builder/edit_channel.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/builder/edit_channel.rs b/src/builder/edit_channel.rs
index 17df18d..2ea5707 100644
--- a/src/builder/edit_channel.rs
+++ b/src/builder/edit_channel.rs
@@ -1,5 +1,6 @@
use internal::prelude::*;
use utils::VecMap;
+use model::id::ChannelId;
/// A builder to edit a [`GuildChannel`] for use via [`GuildChannel::edit`]
///
@@ -72,4 +73,21 @@ impl EditChannel {
self
}
+
+ /// The parent category of the channel.
+ ///
+ /// This is for [text] and [voice] channels only.
+ ///
+ /// [text]: ../model/enum.ChannelType.html#variant.Text
+ /// [voice]: ../model/enum.ChannelType.html#variant.Voice
+ pub fn category<C>(mut self, category: C) -> Self
+ where C: Into<Option<ChannelId>> {
+ let parent_id = match category.into() {
+ Some(c) => Value::Number(Number::from(c.0)),
+ None => Value::Null
+ };
+ self.0.insert("parent_id", parent_id);
+
+ self
+ }
}