diff options
| author | Austin Hellyer <[email protected]> | 2016-11-24 11:26:15 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-24 11:26:15 -0800 |
| commit | 290111a02f59f278374a482a8c8df12147ba4ea9 (patch) | |
| tree | a27137c29deb678557122119c882c84963d89604 /src | |
| parent | Ignore WebSocketError::NoDataAvailable (diff) | |
| download | serenity-290111a02f59f278374a482a8c8df12147ba4ea9.tar.xz serenity-290111a02f59f278374a482a8c8df12147ba4ea9.zip | |
Rename guild structs to Guild and PartialGuild
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/context.rs | 31 | ||||
| -rw-r--r-- | src/client/error.rs | 4 | ||||
| -rw-r--r-- | src/client/event_store.rs | 10 | ||||
| -rw-r--r-- | src/client/http/mod.rs | 27 | ||||
| -rw-r--r-- | src/client/mod.rs | 10 | ||||
| -rw-r--r-- | src/ext/cache/mod.rs | 12 | ||||
| -rw-r--r-- | src/model/channel.rs | 2 | ||||
| -rw-r--r-- | src/model/gateway.rs | 12 | ||||
| -rw-r--r-- | src/model/guild.rs | 24 | ||||
| -rw-r--r-- | src/model/id.rs | 12 | ||||
| -rw-r--r-- | src/model/mod.rs | 2 | ||||
| -rw-r--r-- | src/model/permissions.rs | 2 | ||||
| -rw-r--r-- | src/utils/builder/edit_role.rs | 4 |
13 files changed, 83 insertions, 69 deletions
diff --git a/src/client/context.rs b/src/client/context.rs index 594de23..7a0dc74 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][`LiveGuild`], then you can +/// [channel][`PublicChannel`] 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 @@ -65,7 +65,7 @@ use super::CACHE; /// /// [`Channel`]: ../model/enum.Channel.html /// [`Client::on_message`]: struct.Client.html#method.on_message -/// [`LiveGuild`]: ../model/struct.LiveGuild.html +/// [`Guild`]: ../model/struct.Guild.html /// [`Message`]: ../model/struct.Message.html /// [`PublicChannel`]: ../model/struct.PublicChannel.html /// [`Shard`]: gateway/struct.Shard.html @@ -263,7 +263,10 @@ impl Context { http::create_emoji(guild_id.into().0, map) } - /// Creates a [`Guild`] with the data provided. + /// Creates a guild with the data provided. + /// + /// Only a [`PartialGuild`] will be immediately returned, and a full + /// [`Guild`] will be received over a [`Shard`]. /// /// **Note**: This endpoint is usually only available for user accounts. /// Refer to Discord's information for the endpoint [here][whitelist] for @@ -281,10 +284,12 @@ impl Context { /// ``` /// /// [`Guild`]: ../model/struct.Guild.html + /// [`PartialGuild`]: ../model/struct.PartialGuild.html + /// [`Shard`]: ../gateway/struct.Shard.html /// [US West region]: ../model/enum.Region.html#variant.UsWest /// [whitelist]: https://discordapp.com/developers/docs/resources/guild#create-guild pub fn create_guild(&self, name: &str, region: Region, icon: Option<&str>) - -> Result<Guild> { + -> Result<PartialGuild> { let map = ObjectBuilder::new() .insert("icon", icon) .insert("name", name) @@ -493,11 +498,13 @@ impl Context { http::delete_emoji(guild_id.into().0, emoji_id.into().0) } - /// Deletes a [`Guild`]. You must be the guild owner to be able to delete - /// the guild. + /// Deletes a guild. You must be the guild owner to be able to delete it. /// - /// [`Guild`]: ../model/struct.Guild.html - pub fn delete_guild<G: Into<GuildId>>(&self, guild_id: G) -> Result<Guild> { + /// Only a [`PartialGuild`] will be immediately returned. + /// + /// [`PartialGuild`]: ../model/struct.PartialGuild.html + pub fn delete_guild<G: Into<GuildId>>(&self, guild_id: G) + -> Result<PartialGuild> { http::delete_guild(guild_id.into().0) } @@ -707,7 +714,7 @@ impl Context { http::edit_emoji(guild_id.into().0, emoji_id.into().0, map) } - pub fn edit_guild<F, G>(&self, guild_id: G, f: F) -> Result<Guild> + pub fn edit_guild<F, G>(&self, guild_id: G, f: F) -> Result<PartialGuild> where F: FnOnce(EditGuild) -> EditGuild, G: Into<GuildId> { let map = f(EditGuild::default()).0.build(); @@ -864,7 +871,8 @@ impl Context { http::get_emojis(guild_id.into().0) } - pub fn get_guild<G: Into<GuildId>>(&self, guild_id: G) -> Result<Guild> { + pub fn get_guild<G: Into<GuildId>>(&self, guild_id: G) + -> Result<PartialGuild> { http::get_guild(guild_id.into().0) } @@ -1016,7 +1024,8 @@ impl Context { http::kick_member(guild_id.into().0, user_id.into().0) } - pub fn leave_guild<G: Into<GuildId>>(&self, guild_id: G) -> Result<Guild> { + pub fn leave_guild<G: Into<GuildId>>(&self, guild_id: G) + -> Result<PartialGuild> { http::leave_guild(guild_id.into().0) } diff --git a/src/client/error.rs b/src/client/error.rs index a016e92..76e0d2c 100644 --- a/src/client/error.rs +++ b/src/client/error.rs @@ -59,11 +59,11 @@ pub enum Error { DeleteMessageDaysAmount(u8), /// When there was an error retrieving the gateway URI from the REST API. Gateway, - /// An indication that a [guild][`LiveGuild`] could not be found by + /// An indication that a [guild][`Guild`] could not be found by /// [Id][`GuildId`] in the [`Cache`]. /// + /// [`Guild`]: ../model/struct.Guild.html /// [`GuildId`]: ../model/struct.GuildId.html - /// [`LiveGuild`]: ../model/struct.LiveGuild.html /// [`Cache`]: ../ext/cache/struct.Cache.html GuildNotFound, InvalidOpCode, diff --git a/src/client/event_store.rs b/src/client/event_store.rs index 0deaa94..42d4305 100644 --- a/src/client/event_store.rs +++ b/src/client/event_store.rs @@ -48,11 +48,11 @@ pub struct EventStore { pub on_friend_suggestion_delete: Option<Arc<Fn(Context, UserId) + Send + Sync + 'static>>, pub on_guild_ban_addition: Option<Arc<Fn(Context, GuildId, User) + Send + Sync + 'static>>, pub on_guild_ban_removal: Option<Arc<Fn(Context, GuildId, User) + Send + Sync + 'static>>, - pub on_guild_create: Option<Arc<Fn(Context, LiveGuild) + Send + Sync + 'static>>, + pub on_guild_create: Option<Arc<Fn(Context, Guild) + Send + Sync + 'static>>, #[cfg(feature = "cache")] - pub on_guild_delete: Option<Arc<Fn(Context, Guild, Option<LiveGuild>) + Send + Sync + 'static>>, + pub on_guild_delete: Option<Arc<Fn(Context, PartialGuild, Option<Guild>) + Send + Sync + 'static>>, #[cfg(not(feature = "cache"))] - pub on_guild_delete: Option<Arc<Fn(Context, Guild) + Send + Sync + 'static>>, + pub on_guild_delete: Option<Arc<Fn(Context, PartialGuild) + Send + Sync + 'static>>, pub on_guild_emojis_update: Option<Arc<Fn(Context, GuildId, HashMap<EmojiId, Emoji>) + Send + Sync + 'static>>, pub on_guild_integrations_update: Option<Arc<Fn(Context, GuildId) + Send + Sync + 'static>>, pub on_guild_member_addition: Option<Arc<Fn(Context, GuildId, Member) + Send + Sync + 'static>>, @@ -77,9 +77,9 @@ pub struct EventStore { pub on_guild_sync: Option<Arc<Fn(Context, GuildSyncEvent) + Send + Sync + 'static>>, pub on_guild_unavailable: Option<Arc<Fn(Context, GuildId) + Send + Sync + 'static>>, #[cfg(feature = "cache")] - pub on_guild_update: Option<Arc<Fn(Context, Option<LiveGuild>, Guild) + Send + Sync + 'static>>, + pub on_guild_update: Option<Arc<Fn(Context, Option<Guild>, PartialGuild) + Send + Sync + 'static>>, #[cfg(not(feature = "cache"))] - pub on_guild_update: Option<Arc<Fn(Context, Guild) + Send + Sync + 'static>>, + pub on_guild_update: Option<Arc<Fn(Context, PartialGuild) + Send + Sync + 'static>>, pub on_message: Option<Arc<Fn(Context, Message) + Send + Sync + 'static>>, pub on_message_ack: Option<Arc<Fn(Context, ChannelId, Option<MessageId>) + Send + Sync + 'static>>, pub on_message_delete: Option<Arc<Fn(Context, ChannelId, MessageId) + Send + Sync + 'static>>, diff --git a/src/client/http/mod.rs b/src/client/http/mod.rs index ea15230..682b69c 100644 --- a/src/client/http/mod.rs +++ b/src/client/http/mod.rs @@ -233,7 +233,10 @@ pub fn create_emoji(guild_id: u64, map: Value) Emoji::decode(try!(serde_json::from_reader(response))) } -/// Creates a [`Guild`] with the data provided. +/// Creates a guild with the data provided. +/// +/// Only a [`PartialGuild`] will be immediately returned, and a full [`Guild`] +/// will be received over a [`Shard`], if at least one is running. /// /// **Note**: This endpoint is usually only available for user accounts. Refer /// to Discord's documentation for the endpoint [here][whitelist] for more @@ -260,13 +263,15 @@ pub fn create_emoji(guild_id: u64, map: Value) /// ``` /// /// [`Guild`]: ../../model/struct.Guild.html +/// [`PartialGuild`]: ../../model/struct.PartialGuild.html +/// [`Shard`]: ../gateway/struct.Shard.html /// [US West Region]: ../../model/enum.Region.html#variant.UsWest /// [whitelist]: https://discordapp.com/developers/docs/resources/guild#create-guild -pub fn create_guild(map: Value) -> Result<Guild> { +pub fn create_guild(map: Value) -> Result<PartialGuild> { let body = try!(serde_json::to_string(&map)); let response = request!(Route::Guilds, post(body), "/guilds"); - Guild::decode(try!(serde_json::from_reader(response))) + PartialGuild::decode(try!(serde_json::from_reader(response))) } /// Creates an [`Integration`] for a [`Guild`]. @@ -413,13 +418,13 @@ pub fn delete_emoji(guild_id: u64, emoji_id: u64) -> Result<()> { emoji_id)) } -pub fn delete_guild(guild_id: u64) -> Result<Guild> { +pub fn delete_guild(guild_id: u64) -> Result<PartialGuild> { let response = request!(Route::GuildsId(guild_id), delete, "/guilds/{}", guild_id); - Guild::decode(try!(serde_json::from_reader(response))) + PartialGuild::decode(try!(serde_json::from_reader(response))) } pub fn delete_guild_integration(guild_id: u64, integration_id: u64) @@ -589,14 +594,14 @@ pub fn edit_emoji(guild_id: u64, emoji_id: u64, map: Value) Emoji::decode(try!(serde_json::from_reader(response))) } -pub fn edit_guild(guild_id: u64, map: Value) -> Result<Guild> { +pub fn edit_guild(guild_id: u64, map: Value) -> Result<PartialGuild> { let body = try!(serde_json::to_string(&map)); let response = request!(Route::GuildsId(guild_id), patch(body), "/guilds/{}", guild_id); - Guild::decode(try!(serde_json::from_reader(response))) + PartialGuild::decode(try!(serde_json::from_reader(response))) } pub fn edit_member(guild_id: u64, user_id: u64, map: Value) @@ -934,13 +939,13 @@ pub fn get_emojis(guild_id: u64) -> Result<Vec<Emoji>> { decode_array(try!(serde_json::from_reader(response)), Emoji::decode) } -pub fn get_guild(guild_id: u64) -> Result<Guild> { +pub fn get_guild(guild_id: u64) -> Result<PartialGuild> { let response = request!(Route::GuildsId(guild_id), get, "/guilds/{}", guild_id); - Guild::decode(try!(serde_json::from_reader(response))) + PartialGuild::decode(try!(serde_json::from_reader(response))) } pub fn get_guild_embed(guild_id: u64) -> Result<GuildEmbed> { @@ -1194,13 +1199,13 @@ pub fn leave_group(guild_id: u64) -> Result<Group> { Group::decode(try!(serde_json::from_reader(response))) } -pub fn leave_guild(guild_id: u64) -> Result<Guild> { +pub fn leave_guild(guild_id: u64) -> Result<PartialGuild> { let response = request!(Route::UsersMeGuildsId, delete, "/users/@me/guilds/{}", guild_id); - Guild::decode(try!(serde_json::from_reader(response))) + PartialGuild::decode(try!(serde_json::from_reader(response))) } pub fn logout(map: Value) -> Result<()> { diff --git a/src/client/mod.rs b/src/client/mod.rs index a8b44dd..cc7164f 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -379,7 +379,7 @@ impl Client { /// /// [`GuildCreate`]: ../model/enum.Event.html#variant.GuildCreate pub fn on_guild_create<F>(&mut self, handler: F) - where F: Fn(Context, LiveGuild) + Send + Sync + 'static { + where F: Fn(Context, Guild) + Send + Sync + 'static { self.event_store.lock() .unwrap() .on_guild_create = Some(Arc::new(handler)); @@ -852,7 +852,7 @@ impl Client { /// [`Role`]: ../model/struct.Role.html /// [`Cache`]: ../ext/cache/struct.Cache.html pub fn on_guild_delete<F>(&mut self, handler: F) - where F: Fn(Context, Guild, Option<LiveGuild>) + Send + Sync + 'static { + where F: Fn(Context, PartialGuild, Option<Guild>) + Send + Sync + 'static { self.event_store.lock() .unwrap() .on_guild_delete = Some(Arc::new(handler)); @@ -919,7 +919,7 @@ impl Client { /// /// [`GuildUpdate`]: ../model/enum.Event.html#variant.GuildUpdate pub fn on_guild_update<F>(&mut self, handler: F) - where F: Fn(Context, Option<LiveGuild>, Guild) + Send + Sync + 'static { + where F: Fn(Context, Option<Guild>, PartialGuild) + Send + Sync + 'static { self.event_store.lock() .unwrap() .on_guild_update = Some(Arc::new(handler)); @@ -1001,7 +1001,7 @@ impl Client { /// [`Role`]: ../model/struct.Role.html /// [`Cache`]: ../ext/cache/struct.Cache.html pub fn on_guild_delete<F>(&mut self, handler: F) - where F: Fn(Context, Guild) + Send + Sync + 'static { + where F: Fn(Context, PartialGuild) + Send + Sync + 'static { self.event_store.lock() .unwrap() .on_guild_delete = Some(Arc::new(handler)); @@ -1065,7 +1065,7 @@ impl Client { /// /// [`GuildUpdate`]: ../model/enum.Event.html#variant.GuildUpdate pub fn on_guild_update<F>(&mut self, handler: F) - where F: Fn(Context, Guild) + Send + Sync + 'static { + where F: Fn(Context, PartialGuild) + Send + Sync + 'static { self.event_store.lock() .unwrap() .on_guild_update = Some(Arc::new(handler)); diff --git a/src/ext/cache/mod.rs b/src/ext/cache/mod.rs index 484de1f..4e46188 100644 --- a/src/ext/cache/mod.rs +++ b/src/ext/cache/mod.rs @@ -27,12 +27,12 @@ use ::model::*; /// /// Additionally, note that some information received through events can _not_ /// be retrieved through the REST API. This is information such as [`Role`]s in -/// [`LiveGuild`]s. +/// [`Guild`]s. /// /// [`Connection`]: ../../client/struct.Connection.html /// [`Context`]: ../../client/struct.Context.html /// [`Context::get_channel`]: ../../client/struct.Context.html#method.get_channel -/// [`LiveGuild`]: ../../model/struct.LiveGuild.html +/// [`Guild`]: ../../model/struct.Guild.html /// [`Role`]: ../../model/struct.Role.html /// [`http`]: ../../client/http/index.html #[derive(Debug, Clone)] @@ -51,7 +51,7 @@ pub struct Cache { /// /// This will always be empty for bot accounts. pub guild_settings: HashMap<Option<GuildId>, UserGuildSettings>, - pub guilds: HashMap<GuildId, LiveGuild>, + pub guilds: HashMap<GuildId, Guild>, /// A list of notes that a user has made for individual users. /// /// This will always be empty for bot accounts. @@ -127,7 +127,7 @@ impl Cache { None } - pub fn get_guild<G: Into<GuildId>>(&self, id: G) -> Option<&LiveGuild> { + pub fn get_guild<G: Into<GuildId>>(&self, id: G) -> Option<&Guild> { self.guilds.get(&id.into()) } @@ -449,7 +449,7 @@ impl Cache { } pub fn update_with_guild_delete(&mut self, event: &GuildDeleteEvent) - -> Option<LiveGuild> { + -> Option<Guild> { self.guilds.remove(&event.guild.id) } @@ -843,7 +843,7 @@ pub enum ChannelRef<'a> { /// A group channel Group(&'a Group), /// A public channel and its guild - Public(&'a LiveGuild, &'a PublicChannel), + Public(&'a Guild, &'a PublicChannel), } fn opt_modify<T: Clone>(dest: &mut T, src: &Option<T>) { diff --git a/src/model/channel.rs b/src/model/channel.rs index d00bec5..f34eea0 100644 --- a/src/model/channel.rs +++ b/src/model/channel.rs @@ -888,7 +888,7 @@ impl PublicChannel { /// **Note**: Right now this performs a clone of the guild. This will be /// optimized in the future. #[cfg(all(feature = "cache", feature = "methods"))] - pub fn guild(&self) -> Option<LiveGuild> { + pub fn guild(&self) -> Option<Guild> { CACHE.read().unwrap().get_guild(self.guild_id).cloned() } diff --git a/src/model/gateway.rs b/src/model/gateway.rs index 113bb2f..d12205b 100644 --- a/src/model/gateway.rs +++ b/src/model/gateway.rs @@ -87,12 +87,12 @@ pub struct GuildBanRemoveEvent { #[derive(Clone, Debug)] pub struct GuildCreateEvent { - pub guild: LiveGuild, + pub guild: Guild, } #[derive(Clone, Debug)] pub struct GuildDeleteEvent { - pub guild: Guild, + pub guild: PartialGuild, } #[derive(Clone, Debug)] @@ -165,7 +165,7 @@ pub struct GuildUnavailableEvent { #[derive(Clone, Debug)] pub struct GuildUpdateEvent { - pub guild: Guild, + pub guild: PartialGuild, } #[derive(Clone, Copy, Debug)] @@ -555,7 +555,7 @@ impl Event { })) } else { Ok(Event::GuildCreate(GuildCreateEvent { - guild: try!(LiveGuild::decode(Value::Object(value))), + guild: try!(Guild::decode(Value::Object(value))), })) } } else if kind == "GUILD_DELETE" { @@ -565,7 +565,7 @@ impl Event { })) } else { Ok(Event::GuildDelete(GuildDeleteEvent { - guild: try!(Guild::decode(Value::Object(value))), + guild: try!(PartialGuild::decode(Value::Object(value))), })) } } else if kind == "GUILD_EMOJIS_UPDATE" { @@ -623,7 +623,7 @@ impl Event { })) } else if kind == "GUILD_UPDATE" { Ok(Event::GuildUpdate(GuildUpdateEvent { - guild: try!(Guild::decode(Value::Object(value))), + guild: try!(PartialGuild::decode(Value::Object(value))), })) } else if kind == "MESSAGE_ACK" { missing!(value, Event::MessageAck(MessageAckEvent { diff --git a/src/model/guild.rs b/src/model/guild.rs index bfe29d2..121521c 100644 --- a/src/model/guild.rs +++ b/src/model/guild.rs @@ -28,8 +28,8 @@ use ::client::http; #[cfg(feature = "cache")] use ::client::CACHE; -impl From<Guild> for GuildContainer { - fn from(guild: Guild) -> GuildContainer { +impl From<PartialGuild> for GuildContainer { + fn from(guild: PartialGuild) -> GuildContainer { GuildContainer::Guild(guild) } } @@ -126,7 +126,7 @@ impl GuildInfo { } } -impl Guild { +impl PartialGuild { /// Finds a role by Id within the guild. #[cfg(feature = "methods")] pub fn find_role<R: Into<RoleId>>(&self, role_id: R) -> Option<&Role> { @@ -164,7 +164,7 @@ impl Guild { } } -impl LiveGuild { +impl Guild { #[cfg(feature = "cache")] fn has_perms(&self, mut permissions: Permissions) -> Result<bool> { let member = match self.get_member(CACHE.read().unwrap().user.id) { @@ -322,7 +322,7 @@ impl LiveGuild { } #[doc(hidden)] - pub fn decode(value: Value) -> Result<LiveGuild> { + pub fn decode(value: Value) -> Result<Guild> { let mut map = try!(into_map(value)); let id = try!(remove(&mut map, "id").and_then(GuildId::decode)); @@ -340,7 +340,7 @@ impl LiveGuild { public_channels }; - missing!(map, LiveGuild { + missing!(map, Guild { afk_channel_id: try!(opt(&mut map, "afk_channel_id", ChannelId::decode)), afk_timeout: req!(try!(remove(&mut map, "afk_timeout")).as_u64()), channels: public_channels, @@ -378,7 +378,7 @@ impl LiveGuild { /// /// [`ClientError::InvalidUser`]: ../client/enum.ClientError.html#variant.InvalidUser #[cfg(feature = "methods")] - pub fn delete(&self) -> Result<Guild> { + pub fn delete(&self) -> Result<PartialGuild> { if self.owner_id != CACHE.read().unwrap().user.id { let req = permissions::MANAGE_GUILD; @@ -551,7 +551,7 @@ impl LiveGuild { /// Leaves the guild. #[cfg(feature = "methods")] - pub fn leave(&self) -> Result<Guild> { + pub fn leave(&self) -> Result<PartialGuild> { http::leave_guild(self.id.0) } @@ -961,14 +961,14 @@ impl fmt::Display for Member { } } -impl PossibleGuild<LiveGuild> { +impl PossibleGuild<Guild> { #[doc(hidden)] pub fn decode(value: Value) -> Result<Self> { let mut value = try!(into_map(value)); if remove(&mut value, "unavailable").ok().and_then(|v| v.as_bool()).unwrap_or(false) { remove(&mut value, "id").and_then(GuildId::decode).map(PossibleGuild::Offline) } else { - LiveGuild::decode(Value::Object(value)).map(PossibleGuild::Online) + Guild::decode(Value::Object(value)).map(PossibleGuild::Online) } } @@ -983,14 +983,14 @@ impl PossibleGuild<LiveGuild> { } } -impl PossibleGuild<Guild> { +impl PossibleGuild<PartialGuild> { #[doc(hidden)] pub fn decode(value: Value) -> Result<Self> { let mut value = try!(into_map(value)); if remove(&mut value, "unavailable").ok().and_then(|v| v.as_bool()).unwrap_or(false) { remove(&mut value, "id").and_then(GuildId::decode).map(PossibleGuild::Offline) } else { - Guild::decode(Value::Object(value)).map(PossibleGuild::Online) + PartialGuild::decode(Value::Object(value)).map(PossibleGuild::Online) } } diff --git a/src/model/id.rs b/src/model/id.rs index d9c131e..9c9cb4d 100644 --- a/src/model/id.rs +++ b/src/model/id.rs @@ -76,7 +76,7 @@ impl From<Emoji> for EmojiId { impl GuildId { /// Search the cache for the guild. #[cfg(feature="methods")] - pub fn find(&self) -> Option<LiveGuild> { + pub fn find(&self) -> Option<Guild> { CACHE.read().unwrap().get_guild(*self).cloned() } @@ -85,7 +85,7 @@ impl GuildId { /// Note that this will not be a complete guild, as REST does not send /// all data with a guild retrieval. #[cfg(feature="methods")] - pub fn get(&self) -> Result<Guild> { + pub fn get(&self) -> Result<PartialGuild> { http::get_guild(self.0) } @@ -117,8 +117,8 @@ impl GuildId { } } -impl From<Guild> for GuildId { - fn from(guild: Guild) -> GuildId { +impl From<PartialGuild> for GuildId { + fn from(guild: PartialGuild) -> GuildId { guild.id } } @@ -135,8 +135,8 @@ impl From<InviteGuild> for GuildId { } } -impl From<LiveGuild> for GuildId { - fn from(live_guild: LiveGuild) -> GuildId { +impl From<Guild> for GuildId { + fn from(live_guild: Guild) -> GuildId { live_guild.id } } diff --git a/src/model/mod.rs b/src/model/mod.rs index 7f8a6ea..880be42 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -141,7 +141,7 @@ pub enum Channel { /// a guild needs to be retrieved from the cache. pub enum GuildContainer { /// A guild which can have its contents directly searched. - Guild(Guild), + Guild(PartialGuild), /// A guild's id, which can be used to search the cache for a guild. Id(GuildId), } diff --git a/src/model/permissions.rs b/src/model/permissions.rs index c21e441..cb9a061 100644 --- a/src/model/permissions.rs +++ b/src/model/permissions.rs @@ -173,7 +173,7 @@ bitflags! { const MANAGE_CHANNELS = 1 << 4, /// Allows management and editing of the [guild]. /// - /// [guild]: ../struct.LiveGuild.html + /// [guild]: ../struct.Guild.html const MANAGE_GUILD = 1 << 5, /// [`Member`]s with this permission can add new [`Reaction`]s to a /// [`Message`]. Members can still react using reactions already added diff --git a/src/utils/builder/edit_role.rs b/src/utils/builder/edit_role.rs index f87d22e..14f1af0 100644 --- a/src/utils/builder/edit_role.rs +++ b/src/utils/builder/edit_role.rs @@ -9,7 +9,7 @@ use ::model::{Permissions, Role, permissions}; /// /// - [`Context::create_role`] /// - [`Context::edit_role`] -/// - [`LiveGuild::create_role`] +/// - [`Guild::create_role`] /// - [`Role::edit`] /// /// Defaults are provided for each parameter on role creation. @@ -28,7 +28,7 @@ use ::model::{Permissions, Role, permissions}; /// /// [`Context::create_role`]: ../client/struct.Context.html#method.create_role /// [`Context::edit_role`]: ../client/struct.Context.html#method.edit_role -/// [`LiveGuild::create_role`]: ../model/struct.LiveGuild.html#method.create_role +/// [`Guild::create_role`]: ../model/struct.Guild.html#method.create_role /// [`Role`]: ../model/struct.Role.html /// [`Role::edit`]: ../model/struct.Role.html#method.edit pub struct EditRole(pub ObjectBuilder); |