diff options
| author | Kyle Clemens <[email protected]> | 2018-01-08 13:18:13 -0500 |
|---|---|---|
| committer | alex <[email protected]> | 2018-01-08 19:18:13 +0100 |
| commit | 6587655bf90d662191538b11884311e5aff4b120 (patch) | |
| tree | c27db8c664503cc9d18c49ce601ed66c06ce2fd7 /src/model/guild/guild_id.rs | |
| parent | Set a travis caching timeout of 900 seconds (diff) | |
| download | serenity-6587655bf90d662191538b11884311e5aff4b120.tar.xz serenity-6587655bf90d662191538b11884311e5aff4b120.zip | |
Allow channels to be moved in and out of a category (#248)
Diffstat (limited to 'src/model/guild/guild_id.rs')
| -rw-r--r-- | src/model/guild/guild_id.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/model/guild/guild_id.rs b/src/model/guild/guild_id.rs index 48ad55b..a86b6a9 100644 --- a/src/model/guild/guild_id.rs +++ b/src/model/guild/guild_id.rs @@ -107,16 +107,18 @@ impl GuildId { /// ```rust,ignore /// use serenity::model::{ChannelType, GuildId}; /// - /// let _channel = GuildId(7).create_channel("test", ChannelType::Voice); + /// let _channel = GuildId(7).create_channel("test", ChannelType::Voice, None); /// ``` /// /// [`GuildChannel`]: struct.GuildChannel.html /// [`http::create_channel`]: ../http/fn.create_channel.html /// [Manage Channels]: permissions/constant.MANAGE_CHANNELS.html - pub fn create_channel(&self, name: &str, kind: ChannelType) -> Result<GuildChannel> { + pub fn create_channel<C>(&self, name: &str, kind: ChannelType, category: C) -> Result<GuildChannel> + where C: Into<Option<ChannelId>> { let map = json!({ "name": name, "type": kind as u8, + "parent_id": category.into().map(|c| c.0) }); http::create_channel(self.0, &map) |