diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/context.rs | 19 | ||||
| -rw-r--r-- | src/client/error.rs | 9 | ||||
| -rw-r--r-- | src/client/gateway/mod.rs | 3 | ||||
| -rw-r--r-- | src/client/gateway/shard.rs | 2 | ||||
| -rw-r--r-- | src/client/mod.rs | 4 | ||||
| -rw-r--r-- | src/client/rest/mod.rs | 12 | ||||
| -rw-r--r-- | src/error.rs | 2 | ||||
| -rw-r--r-- | src/ext/cache/mod.rs | 5 | ||||
| -rw-r--r-- | src/ext/framework/configuration.rs | 14 | ||||
| -rw-r--r-- | src/ext/framework/create_command.rs | 4 | ||||
| -rw-r--r-- | src/ext/framework/mod.rs | 5 | ||||
| -rw-r--r-- | src/ext/mod.rs | 7 | ||||
| -rw-r--r-- | src/lib.rs | 4 | ||||
| -rw-r--r-- | src/model/channel.rs | 52 | ||||
| -rw-r--r-- | src/model/guild.rs | 31 | ||||
| -rw-r--r-- | src/model/invite.rs | 1 | ||||
| -rw-r--r-- | src/model/mod.rs | 2 | ||||
| -rw-r--r-- | src/utils/builder/create_invite.rs | 4 | ||||
| -rw-r--r-- | src/utils/builder/create_message.rs | 4 | ||||
| -rw-r--r-- | src/utils/builder/edit_channel.rs | 6 | ||||
| -rw-r--r-- | src/utils/builder/edit_profile.rs | 2 | ||||
| -rw-r--r-- | src/utils/builder/edit_role.rs | 14 | ||||
| -rw-r--r-- | src/utils/builder/execute_webhook.rs | 4 | ||||
| -rw-r--r-- | src/utils/builder/search.rs | 4 |
24 files changed, 115 insertions, 99 deletions
diff --git a/src/client/context.rs b/src/client/context.rs index aa33e5f..e2371a0 100644 --- a/src/client/context.rs +++ b/src/client/context.rs @@ -202,9 +202,9 @@ impl Context { /// related to a channel. /// /// [`ClientError::NoChannelId`]: enum.ClientError.html#variant.NoChannelId - /// [`GuildChannel::create_permission`]: struct.GuildChannel.html#method.create_permission + /// [`GuildChannel::create_permission`]: ../model/struct.GuildChannel.html#method.create_permission /// [`Member`]: ../model/struct.Member.html - /// [`PermissionOverwrite`]: ../model/struct.PermissionOverWrite.html + /// [`PermissionOverwrite`]: ../model/struct.PermissionOverwrite.html /// [`Role`]: ../model/struct.Role.html /// [Manage Channels]: ../model/permissions/constant.MANAGE_CHANNELS.html pub fn create_permission(&self, target: PermissionOverwrite) @@ -243,8 +243,8 @@ impl Context { /// Deletes the contextual channel. /// - /// If the channel being deleted is a [`GuildChannel`] (a [`Guild`]'s - /// channel), then the [Manage Channels] permission is required. + /// If the channel being deleted is a [`GuildChannel`], then the + /// [Manage Channels] permission is required. /// /// # Errors /// @@ -396,6 +396,7 @@ impl Context { /// /// [`Channel`]: ../model/enum.Channel.html /// [`ClientError::NoChannelId`]: enum.ClientError.html#variant.NoChannelId + /// [Manage Channel]: ../model/permissions/constant.MANAGE_CHANNEL.html pub fn edit_channel<F>(&self, f: F) -> Result<GuildChannel> where F: FnOnce(EditChannel) -> EditChannel { let channel_id = match self.channel_id { @@ -585,10 +586,10 @@ impl Context { /// related to a channel. /// /// [`ClientError::NoChannelId`]: enum.ClientError.html#variant.NoChannelId - /// [`Emoji`]: struct.Emoji.html - /// [`Message`]: struct.Message.html - /// [`User`]: struct.User.html - /// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html + /// [`Emoji`]: ../model/struct.Emoji.html + /// [`Message`]: ../model/struct.Message.html + /// [`User`]: ../model/struct.User.html + /// [Read Message History]: ../model/permissions/constant.READ_MESSAGE_HISTORY.html pub fn get_reaction_users<M, R, U>(&self, message_id: M, reaction_type: R, @@ -665,7 +666,7 @@ impl Context { /// directly available; i.e. when not under the context of one of the above /// events. /// - /// [`ChannelId`]: ../../model/struct.ChannelId.html + /// [`ChannelId`]: ../model/struct.ChannelId.html /// [`ClientError::MessageTooLong`]: enum.ClientError.html#variant.MessageTooLong /// [`ClientError::NoChannelId`]: enum.ClientError.html#NoChannelId /// [`Event::ChannelCreate`]: ../model/event/enum.Event.html#variant.ChannelCreate diff --git a/src/client/error.rs b/src/client/error.rs index 3975576..8a92cdd 100644 --- a/src/client/error.rs +++ b/src/client/error.rs @@ -9,8 +9,8 @@ use ::model::{ChannelType, Permissions}; /// /// # Examples /// -/// Matching an [`Error`] with this variant may look something like the -/// following for the [`Client::ban`] method, which in this example is used to +/// Matching an [`Error`] with this variant would look something like the +/// following for the [`GuildId::ban`] method, which in this example is used to /// re-ban all members with an odd discriminator: /// /// ```rust,no_run @@ -29,7 +29,7 @@ use ::model::{ChannelType, Permissions}; /// return; /// } /// -/// match context.ban(guild_id, user, 8) { +/// match guild_id.ban(user, 8) { /// Ok(()) => { /// // Ban successful. /// }, @@ -45,8 +45,9 @@ use ::model::{ChannelType, Permissions}; /// /// [`Client`]: struct.Client.html /// [`Context`]: struct.Context.html -/// [`Context::ban`]: struct.Context.html#method.ban +/// [`Error`]: ../enum.Error.html /// [`Error::Client`]: ../enum.Error.html#variant.Client +/// [`GuildId::ban`]: ../model/struct.GuildId.html#method.ban #[allow(enum_variant_names)] #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub enum Error { diff --git a/src/client/gateway/mod.rs b/src/client/gateway/mod.rs index aa9722e..38cdaa1 100644 --- a/src/client/gateway/mod.rs +++ b/src/client/gateway/mod.rs @@ -1,4 +1,4 @@ -//! The gateway module contains the pieces - primarily the [`Shard`] - +//! The gateway module contains the pieces - primarily the `Shard` - //! responsible for maintaing a WebSocket connection with Discord. //! //! A shard is an interface for the lower-level receiver and sender. It provides @@ -47,7 +47,6 @@ //! [`Client::start_shard`]: ../struct.Client.html#method.start_shard //! [`Client::start_shard_range`]: ../struct.Client.html#method.start_shard_range //! [`Client::start_shards`]: ../struct.Client.html#method.start_shards -//! [`Shard`]: struct.Shard.html //! [docs]: https://discordapp.com/developers/docs/topics/gateway#sharding mod error; diff --git a/src/client/gateway/shard.rs b/src/client/gateway/shard.rs index 49dbe14..6f0a22d 100644 --- a/src/client/gateway/shard.rs +++ b/src/client/gateway/shard.rs @@ -57,7 +57,7 @@ type CurrentPresence = (Option<Game>, OnlineStatus, bool); /// /// See the documentation for [`new`] on how to use this. /// -/// [`Client`]: struct.Client.html +/// [`Client`]: ../struct.Client.html /// [`new`]: #method.new /// [`receive`]: #method.receive /// [docs]: https://discordapp.com/developers/docs/topics/gateway#sharding diff --git a/src/client/mod.rs b/src/client/mod.rs index 04e8e08..21046de 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -1,7 +1,7 @@ //! The Client contains information about a single bot or user's token, as well //! as event handlers. Dispatching events to configured handlers and starting //! the shards' connections are handled directly via the client. In addition, -//! the [`rest`] module and [`Cache`] are also automatically handled by the +//! the `rest` module and `Cache` are also automatically handled by the //! Client module for you. //! //! A [`Context`] is provided for every handler. The context is an ergonomic @@ -17,8 +17,6 @@ //! //! [`Client`]: struct.Client.html#examples //! [`Context`]: struct.Context.html -//! [`Cache`]: ../ext/cache/index.html -//! [`rest`]: rest/index.html //! [Client examples]: struct.Client.html#examples pub mod gateway; diff --git a/src/client/rest/mod.rs b/src/client/rest/mod.rs index ff49809..66ba043 100644 --- a/src/client/rest/mod.rs +++ b/src/client/rest/mod.rs @@ -96,7 +96,9 @@ pub fn set_token(token: &str) { /// let _result = rest::accept_invite(code); /// ``` /// +/// [`Client::on_guild_create`]: ../struct.Client.html#method.on_guild_create /// [`Context::accept_invite`]: ../struct.Context.html#method.accept_invite +/// [`Guild`]: ../../model/struct.Guild.html /// [`Invite`]: ../../model/struct.Invite.html /// [`utils::parse_invite`]: ../../utils/fn.parse_invite.html pub fn accept_invite(code: &str) -> Result<Invite> { @@ -400,7 +402,7 @@ pub fn create_webhook(channel_id: u64, map: Value) -> Result<Webhook> { Webhook::decode(serde_json::from_reader(response)?) } -/// Deketes a private channel or a channel in a guild. +/// Deletes a private channel or a channel in a guild. pub fn delete_channel(channel_id: u64) -> Result<Channel> { let response = request!(Route::ChannelsId(channel_id), delete, @@ -634,7 +636,9 @@ pub fn edit_member(guild_id: u64, user_id: u64, map: Value) -> Result<()> { user_id)) } -/// Changes message content, only if owned by us. +/// Edits a message by Id. +/// +/// **Note**: Only the author of a message can modify it. pub fn edit_message(channel_id: u64, message_id: u64, map: Value) -> Result<Message> { let body = serde_json::to_string(&map)?; let response = request!(Route::ChannelsIdMessagesId(channel_id), @@ -848,6 +852,10 @@ pub fn edit_webhook_with_token(webhook_id: u64, token: &str, map: Value) -> Resu /// return; /// }, /// }; +/// +/// [`Channel`]: ../../model/enum.Channel.html +/// [`Message`]: ../../model/struct.Message.html +/// [Discord docs]: https://discordapp.com/developers/docs/resources/webhook#querystring-params pub fn execute_webhook(webhook_id: u64, token: &str, map: Value) -> Result<Message> { let body = serde_json::to_string(&map)?; let client = HyperClient::new(); diff --git a/src/error.rs b/src/error.rs index 6e9f4f1..d6fbd63 100644 --- a/src/error.rs +++ b/src/error.rs @@ -33,7 +33,7 @@ pub type Result<T> = ::std::result::Result<T, Error>; /// [`Client`]: #variant.Client /// [`ClientError`]: client/enum.ClientError.html /// [`Gateway`]: #variant.Gateway -/// [`GatewayError`]: client/enum.GatewayError.html +/// [`GatewayError`]: client/gateway/enum.GatewayError.html /// [`Result`]: type.Result.html #[derive(Debug)] pub enum Error { diff --git a/src/ext/cache/mod.rs b/src/ext/cache/mod.rs index 6d68bf9..b6a32cd 100644 --- a/src/ext/cache/mod.rs +++ b/src/ext/cache/mod.rs @@ -1,7 +1,7 @@ -//! A cache of events received over a [`Shard`], where storing at least some +//! A cache of events received over a `Shard`, where storing at least some //! data from the event is possible. //! -//! This acts as a hot cache, to avoid making requests over the REST API through +//! This acts as a cache, to avoid making requests over the REST API through //! the [`rest`] module where possible. All fields are public, and do not have //! getters, to allow you more flexibility with the stored data. However, this //! allows data to be "corrupted", and _may or may not_ cause misfunctions @@ -72,7 +72,6 @@ //! [`Message`]: ../../model/struct.Message.html //! [`PublicChannel`]: ../../model/struct.PublicChannel.html //! [`Role`]: ../../model/struct.Role.html -//! [`Shard`]: ../../client/gateway/struct.Shard.html //! [`client::CACHE`]: ../../client/struct.CACHE.html //! [`rest`]: ../../client/rest/index.html diff --git a/src/ext/framework/configuration.rs b/src/ext/framework/configuration.rs index 611775a..5448a25 100644 --- a/src/ext/framework/configuration.rs +++ b/src/ext/framework/configuration.rs @@ -192,7 +192,7 @@ impl Configuration { /// Message that's sent if a command is disabled. /// - /// %command% will be replaced with command name. + /// `%command%` will be replaced with command name. pub fn command_disabled_message(mut self, content: &str) -> Self { self.command_disabled_message = Some(content.to_owned()); @@ -224,7 +224,7 @@ impl Configuration { /// Message that's sent when a command is on cooldown. /// See framework documentation to see where is this utilized. /// - /// %time% will be replaced with waiting time in seconds. + /// `%time%` will be replaced with waiting time in seconds. pub fn rate_limit_message(mut self, content: &str) -> Self { self.rate_limit_message = Some(content.to_owned()); @@ -247,9 +247,9 @@ impl Configuration { /// Message that's sent when user sends too few arguments to a command. /// - /// %min% will be replaced with minimum allowed amount of arguments. + /// `%min%` will be replaced with minimum allowed amount of arguments. /// - /// %given% will be replced with the given amount of arguments. + /// `%given%` will be replced with the given amount of arguments. pub fn not_enough_args_message(mut self, content: &str) -> Self { self.not_enough_args_message = Some(content.to_owned()); @@ -292,7 +292,7 @@ impl Configuration { self } - /// HashSet of user Ids checks won't apply to. + /// A `HashSet` of user Ids checks won't apply to. pub fn owners(mut self, user_ids: HashSet<UserId>) -> Self { self.owners = user_ids; @@ -317,9 +317,9 @@ impl Configuration { /// Message that's sent when user sends too many arguments to a command. /// - /// %max% will be replaced with maximum allowed amount of arguments. + /// `%max%` will be replaced with maximum allowed amount of arguments. /// - /// %given% will be replced with the given amount of arguments. + /// `%given%` will be replced with the given amount of arguments. pub fn too_many_args_message(mut self, content: &str) -> Self { self.too_many_args_message = Some(content.to_owned()); diff --git a/src/ext/framework/create_command.rs b/src/ext/framework/create_command.rs index 52a0793..357a597 100644 --- a/src/ext/framework/create_command.rs +++ b/src/ext/framework/create_command.rs @@ -94,7 +94,7 @@ impl CreateCommand { } /// A function that can be called when a command is received. - /// You can return Err(string) if there's an error. + /// You can return `Err(string)` if there's an error. /// /// See [`exec_str`] if you _only_ need to return a string on command use. /// @@ -110,7 +110,7 @@ impl CreateCommand { /// the internal HashMap of commands, used specifically for creating a help /// command. /// - /// You can return Err(string) if there's an error. + /// You can return `Err(string)` if there's an error. pub fn exec_help<F>(mut self, f: F) -> Self where F: Fn(&mut Context, &Message, HashMap<String, Arc<CommandGroup>>, Vec<String>) -> Result<(), String> + Send + Sync + 'static { self.0.exec = CommandType::WithCommands(Box::new(f)); diff --git a/src/ext/framework/mod.rs b/src/ext/framework/mod.rs index 988d3a3..e2a4479 100644 --- a/src/ext/framework/mod.rs +++ b/src/ext/framework/mod.rs @@ -1,5 +1,6 @@ -//! The framework is a customizable method of separating commands, used in -//! combination with [`Client::with_framework`]. +//! The framework is a customizable method of separating commands. +//! +//! This is used in combination with [`Client::with_framework`]. //! //! The framework has a number of configurations, and can have any number of //! commands bound to it. The primary purpose of it is to offer the utility of diff --git a/src/ext/mod.rs b/src/ext/mod.rs index ba46daf..6254539 100644 --- a/src/ext/mod.rs +++ b/src/ext/mod.rs @@ -1,5 +1,5 @@ -//! A set of extended functionality that is not required for a [`Client`] and/or -//! [`Shard`] to properly function. +//! A set of extended functionality that is not required for a `Client` and/or +//! `Shard` to properly function. //! //! These are flagged behind feature-gates and can be enabled and disabled. //! @@ -9,9 +9,6 @@ //! enabled (enabled by default), the cache requires the `cache` feature to be //! enabled (enabled by default), and voice support requires the `voice` feature //! to be enabled (disabled by default). -//! -//! [`Client`]: ../client/struct.Client.html -//! [`Shard`]: ../client/gateway/struct.Shard.html #[cfg(feature="cache")] pub mod cache; @@ -79,8 +79,8 @@ //! [`Context`]: client/struct.Context.html //! [`Event`]: model/event/enum.Event.html //! [`Event::MessageCreate`]: model/event/enum.Event.html#variant.MessageCreate -//! [`Shard`]: client/struct.Shard.html -//! [`examples`]: https://github.com/zeyla/serenity.git/blob/master/examples +//! [`Shard`]: client/gateway/struct.Shard.html +//! [`examples`]: https://github.com/zeyla/serenity/blob/master/examples //! [cache docs]: ext/cache/index.html //! [client's module-level documentation]: client/index.html //! [docs]: https://discordapp.com/developers/docs/intro diff --git a/src/model/channel.rs b/src/model/channel.rs index 42d5d08..753b42f 100644 --- a/src/model/channel.rs +++ b/src/model/channel.rs @@ -135,7 +135,7 @@ impl Channel { /// [`Channel`]: enum.Channel.html /// [`ClientError::InvalidOperationAsBot`]: ../client/enum.ClientError.html#variant.InvalidOperationAsUser /// [`Message`]: struct.Message.html - /// [`rest::ack_message`]: rest/fn.ack_message.html + /// [`rest::ack_message`]: ../client/rest/fn.ack_message.html pub fn ack<M: Into<MessageId>>(&self, message_id: M) -> Result<()> { #[cfg(feature="cache")] { @@ -265,7 +265,7 @@ impl Channel { /// /// Requires the [Read Message History] permission. /// - /// [Read Message History]: permission/constant.READ_MESSAGE_HISTORY.html + /// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html #[inline] pub fn get_message<M: Into<MessageId>>(&self, message_id: M) -> Result<Message> { self.id().get_message(message_id) @@ -285,7 +285,7 @@ impl Channel { /// .after(100)); // Maximum is 100. /// ``` /// - /// [Read Message History]: permission/constant.READ_MESSAGE_HISTORY.html + /// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html #[inline] pub fn get_messages<F>(&self, f: F) -> Result<Vec<Message>> where F: FnOnce(GetMessages) -> GetMessages { @@ -446,7 +446,7 @@ impl ChannelId { /// /// [`GuildChannel::create_permission`]: struct.GuildChannel.html#method.create_permission /// [`Member`]: struct.Member.html - /// [`PermissionOverwrite`]: struct.PermissionOverWrite.html + /// [`PermissionOverwrite`]: struct.PermissionOverwrite.html /// [`Role`]: struct.Role.html /// [Manage Channels]: permissions/constant.MANAGE_CHANNELS.html pub fn create_permission(&self, target: PermissionOverwrite) @@ -497,8 +497,6 @@ impl ChannelId { /// Requires the [Manage Messages] permission, if the current user is not /// the author of the message. /// - /// (in practice, please do not do this) - /// /// [`Message`]: struct.Message.html /// [`Message::delete`]: struct.Message.html#method.delete /// [Manage Messages]: permissions/constant.MANAGE_MESSAGES.html @@ -582,6 +580,7 @@ impl ChannelId { /// /// [`Channel`]: enum.Channel.html /// [`ClientError::NoChannelId`]: ../client/enum.ClientError.html#variant.NoChannelId + /// [Manage Channel]: permissions/constant.MANAGE_CHANNELS.html #[inline] pub fn edit<F: FnOnce(EditChannel) -> EditChannel>(&self, f: F) -> Result<GuildChannel> { rest::edit_channel(self.0, f(EditChannel::default()).0.build()) @@ -646,7 +645,7 @@ impl ChannelId { /// /// Requires the [Read Message History] permission. /// - /// [Read Message History]: permission/constant.READ_MESSAGE_HISTORY.html + /// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html #[inline] pub fn get_message<M: Into<MessageId>>(&self, message_id: M) -> Result<Message> { rest::get_message(self.0, message_id.into().0) @@ -659,7 +658,7 @@ impl ChannelId { /// Requires the [Read Message History] permission. /// /// [`Channel::get_messages`]: enum.Channel.html#method.get_messages - /// [Read Message History]: permission/constant.READ_MESSAGE_HISTORY.html + /// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html pub fn get_messages<F>(&self, f: F) -> Result<Vec<Message>> where F: FnOnce(GetMessages) -> GetMessages { let mut map = f(GetMessages::default()).0; @@ -714,12 +713,16 @@ impl ChannelId { } /// Pins a [`Message`] to the channel. + /// + /// [`Message`]: struct.Message.html #[inline] pub fn pin<M: Into<MessageId>>(&self, message_id: M) -> Result<()> { rest::pin_message(self.0, message_id.into().0) } /// Gets the list of [`Message`]s which are pinned to the channel. + /// + /// [`Message`]: struct.Message.html #[inline] pub fn pins(&self) -> Result<Vec<Message>> { rest::get_pins(self.0) @@ -888,7 +891,7 @@ impl Group { /// /// [`ClientError::InvalidOperationAsBot`]: ../client/enum.ClientError.html#variant.InvalidOperationAsUser /// [`Message`]: struct.Message.html - /// [`rest::ack_message`]: rest/fn.ack_message.html + /// [`rest::ack_message`]: ../client/rest/fn.ack_message.html pub fn ack<M: Into<MessageId>>(&self, message_id: M) -> Result<()> { #[cfg(feature="cache")] { @@ -991,7 +994,7 @@ impl Group { /// /// Requires the [Read Message History] permission. /// - /// [Read Message History]: permission/constant.READ_MESSAGE_HISTORY.html + /// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html #[inline] pub fn get_message<M: Into<MessageId>>(&self, message_id: M) -> Result<Message> { self.channel_id.get_message(message_id) @@ -1001,7 +1004,7 @@ impl Group { /// /// Requires the [Read Message History] permission. /// - /// [Read Message History]: permission/constant.READ_MESSAGE_HISTORY.html + /// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html #[inline] pub fn get_messages<F>(&self, f: F) -> Result<Vec<Message>> where F: FnOnce(GetMessages) -> GetMessages { @@ -1110,7 +1113,7 @@ impl Group { /// Sends a message to the group with the given content. /// - /// Note that an @everyone mention will not be applied. + /// Note that an `@everyone` mention will not be applied. /// /// **Note**: Requires the [Send Messages] permission. /// @@ -1147,7 +1150,7 @@ impl Message { /// [`Channel`]: enum.Channel.html /// [`ClientError::InvalidOperationAsBot`]: ../client/enum.ClientError.html#variant.InvalidOperationAsUser /// [`Message`]: struct.Message.html - /// [`rest::ack_message`]: rest/fn.ack_message.html + /// [`rest::ack_message`]: ../client/rest/fn.ack_message.html pub fn ack<M: Into<MessageId>>(&self) -> Result<()> { #[cfg(feature="cache")] { @@ -1562,7 +1565,7 @@ impl PrivateChannel { /// /// [`ClientError::InvalidOperationAsBot`]: ../client/enum.ClientError.html#variant.InvalidOperationAsUser /// [`Message`]: struct.Message.html - /// [`rest::ack_message`]: rest/fn.ack_message.html + /// [`rest::ack_message`]: ../client/rest/fn.ack_message.html pub fn ack<M: Into<MessageId>>(&self, message_id: M) -> Result<()> { #[cfg(feature="cache")] { @@ -1666,7 +1669,7 @@ impl PrivateChannel { /// /// Requires the [Read Message History] permission. /// - /// [Read Message History]: permission/constant.READ_MESSAGE_HISTORY.html + /// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html #[inline] pub fn get_message<M: Into<MessageId>>(&self, message_id: M) -> Result<Message> { self.id.get_message(message_id) @@ -1679,7 +1682,7 @@ impl PrivateChannel { /// Requires the [Read Message History] permission. /// /// [`Channel::get_messages`]: enum.Channel.html#method.get_messages - /// [Read Message History]: permission/constant.READ_MESSAGE_HISTORY.html + /// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html #[inline] pub fn get_messages<F>(&self, f: F) -> Result<Vec<Message>> where F: FnOnce(GetMessages) -> GetMessages { @@ -1709,6 +1712,8 @@ impl PrivateChannel { } /// Pins a [`Message`] to the channel. + /// + /// [`Message`]: struct.Message.html #[inline] pub fn pin<M: Into<MessageId>>(&self, message_id: M) -> Result<()> { self.id.pin(message_id) @@ -1800,7 +1805,7 @@ impl GuildChannel { /// /// [`ClientError::InvalidOperationAsBot`]: ../client/enum.ClientError.html#variant.InvalidOperationAsUser /// [`Message`]: struct.Message.html - /// [`rest::ack_message`]: rest/fn.ack_message.html + /// [`rest::ack_message`]: ../client/rest/fn.ack_message.html pub fn ack<M: Into<MessageId>>(&self, message_id: M) -> Result<()> { #[cfg(feature="cache")] { @@ -1820,12 +1825,11 @@ impl GuildChannel { /// /// # Errors /// - /// Returns a - /// [`ClientError::InvalidPermissions`] if the current user does not have the - /// required permissions. + /// Returns a [`ClientError::InvalidPermissions`] if the current user does + /// not have the required permissions. /// /// [`ClientError::InvalidPermissions`]: ../client/enum.ClientError.html#variant.InvalidPermissions - /// [Send Messages]: permissions/constants.SEND_MESSAGES.html + /// [Send Messages]: permissions/constant.SEND_MESSAGES.html pub fn broadcast_typing(&self) -> Result<()> { self.id.broadcast_typing() } @@ -1916,7 +1920,7 @@ impl GuildChannel { /// /// [`Channel`]: enum.Channel.html /// [`Member`]: struct.Member.html - /// [`PermissionOverwrite`]: struct.PermissionOverWrite.html + /// [`PermissionOverwrite`]: struct.PermissionOverwrite.html /// [`PermissionOverwrite::Member`]: struct.PermissionOverwrite.html#variant.Member /// [`Role`]: struct.Role.html /// [Attach Files]: permissions/constant.ATTACH_FILES.html @@ -2068,7 +2072,7 @@ impl GuildChannel { /// /// Requires the [Read Message History] permission. /// - /// [Read Message History]: permission/constant.READ_MESSAGE_HISTORY.html + /// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html #[inline] pub fn get_message<M: Into<MessageId>>(&self, message_id: M) -> Result<Message> { self.id.get_message(message_id) @@ -2081,7 +2085,7 @@ impl GuildChannel { /// Requires the [Read Message History] permission. /// /// [`Channel::get_messages`]: enum.Channel.html#method.get_messages - /// [Read Message History]: permission/constant.READ_MESSAGE_HISTORY.html + /// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html #[inline] pub fn get_messages<F>(&self, f: F) -> Result<Vec<Message>> where F: FnOnce(GetMessages) -> GetMessages { diff --git a/src/model/guild.rs b/src/model/guild.rs index 0955ce6..5d3d0fd 100644 --- a/src/model/guild.rs +++ b/src/model/guild.rs @@ -261,7 +261,7 @@ impl Guild { /// /// [`Guild`]: struct.Guild.html /// [`PartialGuild`]: struct.PartialGuild.html - /// [`Shard`]: ../gateway/struct.Shard.html + /// [`Shard`]: ../client/gateway/struct.Shard.html /// [US West region]: enum.Region.html#variant.UsWest /// [whitelist]: https://discordapp.com/developers/docs/resources/guild#create-guild pub fn create(name: &str, region: Region, icon: Option<&str>) -> Result<PartialGuild> { @@ -295,7 +295,7 @@ impl Guild { /// /// [`Channel`]: struct.Channel.html /// [`ClientError::InvalidPermissions`]: ../client/enum.ClientError.html#variant.InvalidPermissions - /// [Manage Channels]: permissions/constants.MANAGE_CHANNELS.html + /// [Manage Channels]: permissions/constant.MANAGE_CHANNELS.html pub fn create_channel(&mut self, name: &str, kind: ChannelType) -> Result<Channel> { #[cfg(feature="cache")] { @@ -366,7 +366,7 @@ impl Guild { /// [`ClientError::InvalidPermissions`]: ../client/enum.ClientError.html#variant.InvalidPermissions /// [`Context::create_role`]: ../client/struct.Context.html#method.create_role /// [`Role`]: struct.Role.html - /// [Manage Roles]: permissions/constants.MANAGE_ROLES.html + /// [Manage Roles]: permissions/constant.MANAGE_ROLES.html pub fn create_role<F>(&self, f: F) -> Result<Role> where F: FnOnce(EditRole) -> EditRole { #[cfg(feature="cache")] @@ -489,8 +489,6 @@ impl Guild { /// /// Refer to `EditGuild`'s documentation for a full list of methods. /// - /// Also see [`Guild::edit`] if you have the `methods` feature enabled. - /// /// **Note**: Requires the current user to have the [Manage Guild] /// permission. /// @@ -515,7 +513,7 @@ impl Guild { /// /// [`ClientError::InvalidPermissions`]: ../client/enum.ClientError.html#variant.InvalidPermissions /// [`Context::edit_guild`]: ../client/struct.Context.html#method.edit_guild - /// [Manage Guild]: permissions/constants.MANAGE_GUILD.html + /// [Manage Guild]: permissions/constant.MANAGE_GUILD.html pub fn edit<F>(&mut self, f: F) -> Result<()> where F: FnOnce(EditGuild) -> EditGuild { #[cfg(feature="cache")] @@ -1170,7 +1168,7 @@ impl GuildId { /// ``` /// /// [`GuildChannel`]: struct.GuildChannel.html - /// [`rest::create_channel`]: rest/fn.create_channel.html + /// [`rest::create_channel`]: ../client/rest/fn.create_channel.html /// [Manage Channels]: permissions/constant.MANAGE_CHANNELS.html pub fn create_channel(&self, name: &str, kind: ChannelType) -> Result<Channel> { let map = ObjectBuilder::new() @@ -1230,7 +1228,7 @@ impl GuildId { /// **Note**: Requires the [Manage Roles] permission. /// /// [`Guild::create_role`]: struct.Guild.html#method.create_role - /// [Manage Roles]: permissions/constants.MANAGE_ROLES.html + /// [Manage Roles]: permissions/constant.MANAGE_ROLES.html #[inline] pub fn create_role<F: FnOnce(EditRole) -> EditRole>(&self, f: F) -> Result<Role> { rest::create_role(self.0, f(EditRole::default()).0.build()) @@ -1293,7 +1291,7 @@ impl GuildId { /// permission. /// /// [`Guild::edit`]: struct.Guild.html#method.edit - /// [Manage Guild]: permissions/constants.MANAGE_GUILD.html + /// [Manage Guild]: permissions/constant.MANAGE_GUILD.html #[inline] pub fn edit<F: FnOnce(EditGuild) -> EditGuild>(&mut self, f: F) -> Result<PartialGuild> { rest::edit_guild(self.0, f(EditGuild::default()).0.build()) @@ -1388,6 +1386,8 @@ impl GuildId { /// Gets a list of the guild's bans. /// /// Requires the [Ban Members] permission. + /// + /// [Ban Members]: permissions/constant.BAN_MEMBERS.html #[inline] pub fn get_bans(&self) -> Result<Vec<Ban>> { rest::get_bans(self.0) @@ -1551,6 +1551,7 @@ impl GuildId { /// /// [`Guild::search_channels`]: struct.Guild.html#method.search_channels /// [`Message`]: struct.Message.html + /// [`Search`]: ../utils/builder/struct.Search.html pub fn search_channels<F>(&self, channel_ids: &[ChannelId], f: F) -> Result<SearchResult> where F: FnOnce(Search) -> Search { let ids = channel_ids.iter().map(|x| x.0).collect::<Vec<u64>>(); @@ -1942,7 +1943,7 @@ impl PartialGuild { /// ``` /// /// [`GuildChannel`]: struct.GuildChannel.html - /// [`rest::create_channel`]: rest/fn.create_channel.html + /// [`rest::create_channel`]: ../client/rest/fn.create_channel.html /// [Manage Channels]: permissions/constant.MANAGE_CHANNELS.html #[inline] pub fn create_channel(&self, name: &str, kind: ChannelType) -> Result<Channel> { @@ -1995,7 +1996,7 @@ impl PartialGuild { /// /// [`ClientError::InvalidPermissions`]: ../client/enum.ClientError.html#variant.InvalidPermissions /// [`Guild::create_role`]: struct.Guild.html#method.create_role - /// [Manage Roles]: permissions/constants.MANAGE_ROLES.html + /// [Manage Roles]: permissions/constant.MANAGE_ROLES.html #[inline] pub fn create_role<F: FnOnce(EditRole) -> EditRole>(&self, f: F) -> Result<Role> { self.id.create_role(f) @@ -2048,13 +2049,11 @@ impl PartialGuild { /// Edits the current guild with new data where specified. /// - /// Refer to [`Guild::edit`] for more information. - /// /// **Note**: Requires the current user to have the [Manage Guild] /// permission. /// /// [`Context::edit_guild`]: ../client/struct.Context.html#method.edit_guild - /// [Manage Guild]: permissions/constants.MANAGE_GUILD.html + /// [Manage Guild]: permissions/constant.MANAGE_GUILD.html pub fn edit<F>(&mut self, f: F) -> Result<()> where F: FnOnce(EditGuild) -> EditGuild { match self.id.edit(f) { @@ -2147,6 +2146,8 @@ impl PartialGuild { /// Gets a list of the guild's bans. /// /// Requires the [Ban Members] permission. + /// + /// [Ban Members]: permissions/constant.BAN_MEMBERS.html #[inline] pub fn get_bans(&self) -> Result<Vec<Ban>> { self.id.get_bans() @@ -2192,7 +2193,7 @@ impl PartialGuild { /// /// Requires the [Manage Guild] permission. /// - /// [Manage Guild]: permissions/struct.MANAGE_GUILD.html + /// [Manage Guild]: permissions/constant.MANAGE_GUILD.html #[inline] pub fn get_invites(&self) -> Result<Vec<RichInvite>> { self.id.get_invites() diff --git a/src/model/invite.rs b/src/model/invite.rs index 47ae28a..10227bc 100644 --- a/src/model/invite.rs +++ b/src/model/invite.rs @@ -57,6 +57,7 @@ impl Invite { /// If the `cache` is enabled, returns a [`ClientError::InvalidPermissions`] /// if the current user does not have the required [permission]. /// + /// [`ClientError::InvalidPermissions`]: ../client/enum.ClientError.html#variant.InvalidPermissions /// [`CreateInvite`]: ../utils/builder/struct.CreateInvite.html /// [`GuildChannel`]: struct.GuildChannel.html /// [Create Invite]: permissions/constant.CREATE_INVITE.html diff --git a/src/model/mod.rs b/src/model/mod.rs index c2883ce..2a4f97d 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -132,6 +132,8 @@ pub enum Channel { Guild(GuildChannel), /// A private channel to another [`User`]. No other users may access the /// channel. For multi-user "private channels", use a group. + /// + /// [`User`]: struct.User.html Private(PrivateChannel), } diff --git a/src/utils/builder/create_invite.rs b/src/utils/builder/create_invite.rs index c8e175a..0f16b27 100644 --- a/src/utils/builder/create_invite.rs +++ b/src/utils/builder/create_invite.rs @@ -26,8 +26,8 @@ use std::default::Default; /// }); /// ``` /// -/// [`Context::create_invite`]: ../client/struct.Context.html#method.create_invite -/// [`RichInvite`]: ../model/struct.Invite.html +/// [`Context::create_invite`]: ../../client/struct.Context.html#method.create_invite +/// [`RichInvite`]: ../../model/struct.Invite.html pub struct CreateInvite(pub ObjectBuilder); impl CreateInvite { diff --git a/src/utils/builder/create_message.rs b/src/utils/builder/create_message.rs index 8522130..5386c78 100644 --- a/src/utils/builder/create_message.rs +++ b/src/utils/builder/create_message.rs @@ -3,7 +3,7 @@ use std::collections::BTreeMap; use std::default::Default; use super::CreateEmbed; -/// A builder to specify the contents of an [`rest::create_message`] request, +/// A builder to specify the contents of an [`rest::send_message`] request, /// primarily meant for use through [`Context::send_message`]. /// /// There are two situations where different field requirements are present: @@ -31,7 +31,7 @@ use super::CreateEmbed; /// [`Context::send_message`]: ../../client/struct.Context.html#method.send_message /// [`content`]: #method.content /// [`embed`]: #method.embed -/// [`rest::create_message`]: ../../client/rest/fn.create_message.html +/// [`rest::send_message`]: ../../client/rest/fn.send_message.html pub struct CreateMessage(pub BTreeMap<String, Value>); impl CreateMessage { diff --git a/src/utils/builder/edit_channel.rs b/src/utils/builder/edit_channel.rs index 1fd1b5c..e136cbf 100644 --- a/src/utils/builder/edit_channel.rs +++ b/src/utils/builder/edit_channel.rs @@ -31,7 +31,7 @@ impl EditChannel { /// /// This is for [voice] channels only. /// - /// [voice]: ../model/enum.ChannelType.html#variant.Voice + /// [voice]: ../../model/enum.ChannelType.html#variant.Voice pub fn bitrate(self, bitrate: u64) -> Self { EditChannel(self.0.insert("bitrate", bitrate)) } @@ -54,7 +54,7 @@ impl EditChannel { /// /// This is for [text] channels only. /// - /// [text]: ../model/enum.ChannelType.html#variant.Text + /// [text]: ../../model/enum.ChannelType.html#variant.Text pub fn topic(self, topic: &str) -> Self { EditChannel(self.0.insert("topic", topic)) } @@ -63,7 +63,7 @@ impl EditChannel { /// /// This is for [voice] channels only. /// - /// [voice]: ../model/enum.ChannelType.html#variant.Voice + /// [voice]: ../../model/enum.ChannelType.html#variant.Voice pub fn user_limit(self, user_limit: u64) -> Self { EditChannel(self.0.insert("user_limit", user_limit)) } diff --git a/src/utils/builder/edit_profile.rs b/src/utils/builder/edit_profile.rs index 46dad20..4d25f00 100644 --- a/src/utils/builder/edit_profile.rs +++ b/src/utils/builder/edit_profile.rs @@ -32,7 +32,7 @@ impl EditProfile { /// }); /// ``` /// - /// [`utils::read_image`]: ../utils/fn.read_image.html + /// [`utils::read_image`]: ../fn.read_image.html pub fn avatar(self, icon: Option<&str>) -> Self { EditProfile(self.0 .insert("avatar", diff --git a/src/utils/builder/edit_role.rs b/src/utils/builder/edit_role.rs index cea0c75..3410417 100644 --- a/src/utils/builder/edit_role.rs +++ b/src/utils/builder/edit_role.rs @@ -26,15 +26,17 @@ use ::model::{Permissions, Role, permissions}; /// .name("a test role")); /// ``` /// -/// [`Context::create_role`]: ../client/struct.Context.html#method.create_role -/// [`Context::edit_role`]: ../client/struct.Context.html#method.edit_role -/// [`Guild::create_role`]: ../model/struct.Guild.html#method.create_role -/// [`Role`]: ../model/struct.Role.html -/// [`Role::edit`]: ../model/struct.Role.html#method.edit +/// [`Context::create_role`]: ../../client/struct.Context.html#method.create_role +/// [`Context::edit_role`]: ../../client/struct.Context.html#method.edit_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); impl EditRole { /// Creates a new builder with the values of the given [`Role`]. + /// + /// [`Role`]: ../../model/struct.Role.html pub fn new(role: &Role) -> Self { EditRole(ObjectBuilder::new() .insert("color", role.colour.0) @@ -91,7 +93,7 @@ impl Default for EditRole { /// - **permissions**: the [general permissions set] /// - **position**: 1 /// - /// [general permissions set]: ../model/permissions/fn.general.html + /// [general permissions set]: ../../model/permissions/fn.general.html fn default() -> EditRole { EditRole(ObjectBuilder::new() .insert("color", 10070709) diff --git a/src/utils/builder/execute_webhook.rs b/src/utils/builder/execute_webhook.rs index 9da701f..073dcb3 100644 --- a/src/utils/builder/execute_webhook.rs +++ b/src/utils/builder/execute_webhook.rs @@ -49,9 +49,9 @@ use std::default::Default; /// .embeds(vec![website, resources])); /// ``` /// -/// [`Webhook`]: ../model/struct.Webhook.html +/// [`Webhook`]: ../../model/struct.Webhook.html /// [`Webhook::execute`]: ../../model/struct.Webhook.html#method.execute -/// [`execute_webhook`]: ../client/rest/fn.execute_webhook.html +/// [`execute_webhook`]: ../../client/rest/fn.execute_webhook.html pub struct ExecuteWebhook(pub ObjectBuilder); impl ExecuteWebhook { diff --git a/src/utils/builder/search.rs b/src/utils/builder/search.rs index c0a7499..f6256d8 100644 --- a/src/utils/builder/search.rs +++ b/src/utils/builder/search.rs @@ -240,6 +240,8 @@ impl<'a> Search<'a> { /// /// The default value is `2`. The minimum value is `0`. The maximum value is /// `2`. + /// + /// [`Message`]: ../../model/struct.Message.html pub fn context_size(mut self, context_size: u8) -> Self { self.0.insert("context_size", context_size.to_string()); @@ -327,7 +329,7 @@ impl<'a> Search<'a> { /// The minimum value is `0`. The maximum value is `5000`. /// /// [`Message`]: ../../model/struct.Message.html - /// [`limit`]: fn.limit.html + /// [`limit`]: #method.limit pub fn offset(mut self, offset: u16) -> Self { self.0.insert("offset", offset.to_string()); |