aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel/channel_id.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-09-09 10:53:44 +0200
committeracdenisSK <[email protected]>2017-09-09 10:56:29 +0200
commit4be6b9d5008ff8bb3d1fdddff5647a6bb307513c (patch)
tree516b811875ae4cb2b98c308aabb69bc6e7a94fd2 /src/model/channel/channel_id.rs
parentChange order to avoid subtraction overflow error (#160) (diff)
downloadserenity-4be6b9d5008ff8bb3d1fdddff5647a6bb307513c.tar.xz
serenity-4be6b9d5008ff8bb3d1fdddff5647a6bb307513c.zip
Implement categories
Diffstat (limited to 'src/model/channel/channel_id.rs')
-rw-r--r--src/model/channel/channel_id.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/model/channel/channel_id.rs b/src/model/channel/channel_id.rs
index 122b5bc..aec6cf0 100644
--- a/src/model/channel/channel_id.rs
+++ b/src/model/channel/channel_id.rs
@@ -302,6 +302,7 @@ impl ChannelId {
pub fn name(&self) -> Option<String> {
use self::Channel::*;
+ // TODO: Replace this second match with `?`.
Some(match match self.find() {
Some(c) => c,
None => return None,
@@ -313,6 +314,7 @@ impl ChannelId {
Cow::Owned(name) => name,
}
},
+ Category(category) => category.read().unwrap().name().to_string(),
Private(channel) => channel.read().unwrap().name(),
})
}
@@ -516,6 +518,7 @@ impl From<Channel> for ChannelId {
Channel::Group(group) => group.with(|g| g.channel_id),
Channel::Guild(ch) => ch.with(|c| c.id),
Channel::Private(ch) => ch.with(|c| c.id),
+ Channel::Category(ch) => ch.with(|c| c.id),
}
}
}
@@ -527,6 +530,7 @@ impl<'a> From<&'a Channel> for ChannelId {
Channel::Group(ref group) => group.with(|g| g.channel_id),
Channel::Guild(ref ch) => ch.with(|c| c.id),
Channel::Private(ref ch) => ch.with(|c| c.id),
+ Channel::Category(ref ch) => ch.with(|c| c.id),
}
}
}