aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2017-01-24 12:07:41 -0800
committerAustin Hellyer <[email protected]>2017-01-24 12:07:41 -0800
commit94131908f00a8cbb714f3a93066e2a83dfc1c5b3 (patch)
tree86cb349c3093ab9722ae47a649deebe8da9d6c13 /src/client
parentProperly drop on binds (diff)
downloadserenity-94131908f00a8cbb714f3a93066e2a83dfc1c5b3.tar.xz
serenity-94131908f00a8cbb714f3a93066e2a83dfc1c5b3.zip
Fix docs links
Diffstat (limited to 'src/client')
-rw-r--r--src/client/context.rs19
-rw-r--r--src/client/error.rs9
-rw-r--r--src/client/gateway/mod.rs3
-rw-r--r--src/client/gateway/shard.rs2
-rw-r--r--src/client/mod.rs4
-rw-r--r--src/client/rest/mod.rs12
6 files changed, 28 insertions, 21 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();