aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-09-09 08:23:21 -0700
committerZeyla Hellyer <[email protected]>2017-09-09 08:23:21 -0700
commit1c138a357b37e3bd8002109cfb9a8da94a53810e (patch)
tree3256df54f6b31e0422848ea6bcc1d35e58b27eee /src/model/channel
parent`parent_id` -> `category_id` (diff)
downloadserenity-1c138a357b37e3bd8002109cfb9a8da94a53810e.tar.xz
serenity-1c138a357b37e3bd8002109cfb9a8da94a53810e.zip
Apply rustfmt + fix tests
Diffstat (limited to 'src/model/channel')
-rw-r--r--src/model/channel/channel_category.rs23
-rw-r--r--src/model/channel/guild_channel.rs6
-rw-r--r--src/model/channel/message.rs1
3 files changed, 24 insertions, 6 deletions
diff --git a/src/model/channel/channel_category.rs b/src/model/channel/channel_category.rs
index a0673fd..29f6b36 100644
--- a/src/model/channel/channel_category.rs
+++ b/src/model/channel/channel_category.rs
@@ -104,9 +104,26 @@ impl ChannelCategory {
let edited = f(EditChannel(map)).0;
http::edit_channel(self.id.0, &edited).map(|channel| {
- let GuildChannel { id, category_id, permission_overwrites, nsfw, name, position, kind, .. } = channel;
+ let GuildChannel {
+ id,
+ category_id,
+ permission_overwrites,
+ nsfw,
+ name,
+ position,
+ kind,
+ ..
+ } = channel;
- *self = ChannelCategory { id, category_id, permission_overwrites, nsfw, name, position, kind };
+ *self = ChannelCategory {
+ id,
+ category_id,
+ permission_overwrites,
+ nsfw,
+ name,
+ position,
+ kind,
+ };
()
})
}
@@ -119,4 +136,4 @@ impl ChannelCategory {
/// Returns the name of the category.
pub fn name(&self) -> &str { &self.name }
-} \ No newline at end of file
+}
diff --git a/src/model/channel/guild_channel.rs b/src/model/channel/guild_channel.rs
index 8ae50a6..3e33102 100644
--- a/src/model/channel/guild_channel.rs
+++ b/src/model/channel/guild_channel.rs
@@ -24,13 +24,13 @@ pub struct GuildChannel {
///
/// The default channel Id shares the Id of the guild and the default role.
pub id: ChannelId,
- /// Whether this guild channel belongs in a category.
- #[serde(rename = "parent_id")]
- pub category_id: Option<ChannelId>,
/// The bitrate of the channel.
///
/// **Note**: This is only available for voice channels.
pub bitrate: Option<u64>,
+ /// Whether this guild channel belongs in a category.
+ #[serde(rename = "parent_id")]
+ pub category_id: Option<ChannelId>,
/// The Id of the guild the channel is located in.
///
/// If this matches with the [`id`], then this is the default text channel.
diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs
index 27f4e31..03aea16 100644
--- a/src/model/channel/message.rs
+++ b/src/model/channel/message.rs
@@ -97,6 +97,7 @@ impl Message {
///
/// command!(channel_name(_ctx, msg) {
/// let _ = match msg.channel() {
+ /// Some(Channel::Category(c)) => msg.reply(&c.read().unwrap().name),
/// Some(Channel::Group(c)) => msg.reply(&c.read().unwrap().name()),
/// Some(Channel::Guild(c)) => msg.reply(&c.read().unwrap().name),
/// Some(Channel::Private(c)) => {