diff options
| author | Austin Hellyer <[email protected]> | 2016-11-25 20:06:47 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-25 20:06:47 -0800 |
| commit | adde653dc4797faf8094816da46f8e4430b33c98 (patch) | |
| tree | 229acc0e3d130bb44d53f09fef0716f2c16915af /src/client | |
| parent | Fix permission check on Message::delete (diff) | |
| download | serenity-adde653dc4797faf8094816da46f8e4430b33c98.tar.xz serenity-adde653dc4797faf8094816da46f8e4430b33c98.zip | |
Rename PublicChannel to GuildChannel
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/context.rs | 20 | ||||
| -rw-r--r-- | src/client/rest/mod.rs | 24 |
2 files changed, 22 insertions, 22 deletions
diff --git a/src/client/context.rs b/src/client/context.rs index a4d893e..943741b 100644 --- a/src/client/context.rs +++ b/src/client/context.rs @@ -52,7 +52,7 @@ use super::CACHE; /// one. /// /// For example, if you are needing information about a -/// [channel][`PublicChannel`] within a [guild][`Guild`], then you can +/// [channel][`GuildChannel`] within a [guild][`Guild`], then you can /// use [`get_channel`] to retrieve it. Under most circumstances, the guild and /// its channels will be cached within the cache, and `get_channel` will just /// pull from the cache. If it does not exist, it will make a request to the @@ -67,7 +67,7 @@ use super::CACHE; /// [`Client::on_message`]: struct.Client.html#method.on_message /// [`Guild`]: ../model/struct.Guild.html /// [`Message`]: ../model/struct.Message.html -/// [`PublicChannel`]: ../model/struct.PublicChannel.html +/// [`GuildChannel`]: ../model/struct.GuildChannel.html /// [`Shard`]: gateway/struct.Shard.html /// [`Cache`]: ../ext/cache/struct.Cache.html /// [`get_channel`]: #method.get_channel @@ -207,7 +207,7 @@ impl Context { rest::broadcast_typing(channel_id.into().0) } - /// Creates a [`PublicChannel`] in the given [`Guild`]. + /// Creates a [`GuildChannel`] in the given [`Guild`]. /// /// Refer to [`rest::create_channel`] for more information. /// @@ -224,7 +224,7 @@ impl Context { /// ``` /// /// [`Guild`]: ../model/struct.Guild.html - /// [`PublicChannel`]: ../model/struct.PublicChannel.html + /// [`GuildChannel`]: ../model/struct.GuildChannel.html /// [`rest::create_channel`]: rest/fn.create_channel.html /// [Manage Channels]: ../model/permissions/constant.MANAGE_CHANNELS.html pub fn create_channel<G>(&self, guild_id: G, name: &str, kind: ChannelType) @@ -475,12 +475,12 @@ impl Context { /// Deletes a [`Channel`] based on the Id given. /// - /// If the channel being deleted is a [`PublicChannel`] (a [`Guild`]'s + /// If the channel being deleted is a [`GuildChannel`] (a [`Guild`]'s /// channel), then the [Manage Channels] permission is required. /// /// [`Channel`]: ../model/enum.Channel.html /// [`Guild`]: ../model/struct.Guild.html - /// [`PublicChannel`]: ../model/struct.PublicChannel.html + /// [`GuildChannel`]: ../model/struct.GuildChannel.html /// [Manage Messages]: ../model/permissions/constant.MANAGE_CHANNELS.html pub fn delete_channel<C>(&self, channel_id: C) -> Result<Channel> where C: Into<ChannelId> { @@ -673,12 +673,12 @@ impl Context { } pub fn edit_channel<C, F>(&self, channel_id: C, f: F) - -> Result<PublicChannel> where C: Into<ChannelId>, + -> Result<GuildChannel> where C: Into<ChannelId>, F: FnOnce(EditChannel) -> EditChannel { let channel_id = channel_id.into(); let map = match try!(self.get_channel(channel_id)) { - Channel::Public(channel) => { + Channel::Guild(channel) => { let map = ObjectBuilder::new() .insert("name", channel.name) .insert("position", channel.position); @@ -841,7 +841,7 @@ impl Context { } pub fn get_channels<G>(&self, guild_id: G) - -> Result<HashMap<ChannelId, PublicChannel>> where G: Into<GuildId> { + -> Result<HashMap<ChannelId, GuildChannel>> where G: Into<GuildId> { let guild_id = guild_id.into(); feature_cache_enabled! {{ @@ -1161,7 +1161,7 @@ impl Context { /// let cache = CACHE.read().unwrap(); /// let ch = cache.get_channel(message.channel_id); /// let name = match ch { - /// Some(Channel::Public(ch)) => ch.name.clone(), + /// Some(Channel::Guild(ch)) => ch.name.clone(), /// _ => "Unknown".to_owned(), /// }; /// diff --git a/src/client/rest/mod.rs b/src/client/rest/mod.rs index 0558df8..5624ab7 100644 --- a/src/client/rest/mod.rs +++ b/src/client/rest/mod.rs @@ -192,14 +192,14 @@ pub fn broadcast_typing(channel_id: u64) -> Result<()> { channel_id)) } -/// Creates a [`PublicChannel`] in the [`Guild`] given its Id. +/// Creates a [`GuildChannel`] in the [`Guild`] given its Id. /// /// Refer to the Discord's [docs] for information on what fields this requires. /// /// **Note**: Requires the [Manage Channels] permission. /// /// [`Guild`]: ../../model/struct.Guild.html -/// [`PublicChannel`]: ../../model/struct.PublicChannel.html +/// [`GuildChannel`]: ../../model/struct.GuildChannel.html /// [docs]: https://discordapp.com/developers/docs/resources/guild#create-guild-channel /// [Manage Channels]: ../../model/permissions/constant.MANAGE_CHANNELS.html pub fn create_channel(guild_id: u64, map: Value) -> Result<Channel> { @@ -295,7 +295,7 @@ pub fn create_guild_integration(guild_id: u64, integration_id: u64, map: Value) integration_id)) } -/// Creates a [`RichInvite`] for the given [channel][`PublicChannel`]. +/// Creates a [`RichInvite`] for the given [channel][`GuildChannel`]. /// /// Refer to Discord's [docs] for field information. /// @@ -303,7 +303,7 @@ pub fn create_guild_integration(guild_id: u64, integration_id: u64, map: Value) /// /// **Note**: Requires the [Create Invite] permission. /// -/// [`PublicChannel`]: ../../model/struct.PublicChannel.html +/// [`GuildChannel`]: ../../model/struct.GuildChannel.html /// [`RichInvite`]: ../../model/struct.RichInvite.html /// [Create Invite]: ../../model/permissions/constant.CREATE_INVITE.html /// [docs]: https://discordapp.com/developers/docs/resources/channel#create-channel-invite @@ -361,7 +361,7 @@ pub fn create_role(guild_id: u64) -> Result<Role> { Role::decode(try!(serde_json::from_reader(response))) } -/// Creates a webhook for the given [channel][`PublicChannel`]'s Id, passing in +/// Creates a webhook for the given [channel][`GuildChannel`]'s Id, passing in /// the given data. /// /// This method requires authentication. @@ -390,7 +390,7 @@ pub fn create_role(guild_id: u64) -> Result<Role> { /// let webhook = rest::create_webhook(channel_id, map).expect("err creating"); /// ``` /// -/// [`PublicChannel`]: ../../model/struct.PublicChannel.html +/// [`GuildChannel`]: ../../model/struct.GuildChannel.html pub fn create_webhook(channel_id: u64, map: Value) -> Result<Webhook> { let body = try!(serde_json::to_string(&map)); let response = request!(Route::ChannelsIdWebhooks(channel_id), @@ -572,14 +572,14 @@ pub fn delete_webhook_with_token(webhook_id: u64, token: &str) -> Result<()> { } pub fn edit_channel(channel_id: u64, map: Value) - -> Result<PublicChannel> { + -> Result<GuildChannel> { let body = try!(serde_json::to_string(&map)); let response = request!(Route::ChannelsId(channel_id), patch(body), "/channels/{}", channel_id); - PublicChannel::decode(try!(serde_json::from_reader(response))) + GuildChannel::decode(try!(serde_json::from_reader(response))) } pub fn edit_emoji(guild_id: u64, emoji_id: u64, map: Value) @@ -862,7 +862,7 @@ pub fn get_channel_invites(channel_id: u64) RichInvite::decode) } -/// Retrieves the webhooks for the given [channel][`PublicChannel`]'s Id. +/// Retrieves the webhooks for the given [channel][`GuildChannel`]'s Id. /// /// This method requires authentication. /// @@ -879,7 +879,7 @@ pub fn get_channel_invites(channel_id: u64) /// .expect("err getting channel webhooks"); /// ``` /// -/// [`PublicChannel`]: ../../model/struct.PublicChannel.html +/// [`GuildChannel`]: ../../model/struct.GuildChannel.html pub fn get_channel_webhooks(channel_id: u64) -> Result<Vec<Webhook>> { let response = request!(Route::ChannelsIdWebhooks(channel_id), get, @@ -898,14 +898,14 @@ pub fn get_channel(channel_id: u64) -> Result<Channel> { Channel::decode(try!(serde_json::from_reader(response))) } -pub fn get_channels(guild_id: u64) -> Result<Vec<PublicChannel>> { +pub fn get_channels(guild_id: u64) -> Result<Vec<GuildChannel>> { let response = request!(Route::ChannelsId(guild_id), get, "/guilds/{}/channels", guild_id); decode_array(try!(serde_json::from_reader(response)), - PublicChannel::decode) + GuildChannel::decode) } pub fn get_current_user() -> Result<CurrentUser> { |