aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-03-25 15:35:50 -0700
committerZeyla Hellyer <[email protected]>2017-03-25 15:35:50 -0700
commit356c9c0d42f4b0583a2c7b5333196c4f4e6a73cc (patch)
treefe4296b5c07b32be2c3a7d1f2169fe3f00c1a415 /src
parentFix Member methods due to variant joined_at values (diff)
downloadserenity-356c9c0d42f4b0583a2c7b5333196c4f4e6a73cc.tar.xz
serenity-356c9c0d42f4b0583a2c7b5333196c4f4e6a73cc.zip
Add slightly more documentation
Diffstat (limited to 'src')
-rw-r--r--src/client/error.rs8
-rw-r--r--src/client/gateway/shard.rs2
-rw-r--r--src/client/rest/ratelimiting.rs199
-rw-r--r--src/ext/framework/help_commands.rs22
-rw-r--r--src/lib.rs1
-rw-r--r--src/model/event.rs159
-rw-r--r--src/model/misc.rs2
-rw-r--r--src/model/mod.rs15
-rw-r--r--src/model/permissions.rs10
-rw-r--r--src/utils/macros.rs2
10 files changed, 412 insertions, 8 deletions
diff --git a/src/client/error.rs b/src/client/error.rs
index 1eaa2c6..30d3c27 100644
--- a/src/client/error.rs
+++ b/src/client/error.rs
@@ -57,6 +57,11 @@ pub enum Error {
/// When attempting to delete a number of days' worth of messages that is
/// not allowed.
DeleteMessageDaysAmount(u8),
+ /// When there is an error from Discord for a specific action, such as
+ /// [`ErrorCode::EditByOtherAuthor`]. This is a friendlier representation of
+ /// the numerical error codes Discord provides.
+ ///
+ /// [`ErrorCode::EditByOtherAuthor`]: rest/enum.ErrorCode.html#variant.EditByOtherAuthor
ErrorCode(ErrorCode),
/// When there was an error retrieving the gateway URI from the REST API.
Gateway,
@@ -67,6 +72,7 @@ pub enum Error {
/// [`GuildId`]: ../model/struct.GuildId.html
/// [`Cache`]: ../ext/cache/struct.Cache.html
GuildNotFound,
+ /// An indicator that an unknown opcode was received from the gateway.
InvalidOpCode,
/// When attempting to perform an action which is only available to user
/// accounts.
@@ -123,6 +129,8 @@ pub enum Error {
///
/// [`Context::edit_role`]: struct.Context.html#method.edit_role
RecordNotFound,
+ /// When a shard has completely failed to reboot after resume and/or
+ /// reconnect attempts.
ShardBootFailure,
/// When the shard being retrieved from within the Client could not be
/// found after being inserted into the Client's internal vector of
diff --git a/src/client/gateway/shard.rs b/src/client/gateway/shard.rs
index a51c2dc..e4c4720 100644
--- a/src/client/gateway/shard.rs
+++ b/src/client/gateway/shard.rs
@@ -477,6 +477,8 @@ impl Shard {
Ok(())
}
+ /// Uncleanly shuts down the receiver by not sending a close code.
+ #[doc(hidden)]
pub fn shutdown(receiver: &mut Receiver<WebSocketStream>) -> Result<()> {
let r = receiver.get_mut().get_mut();
diff --git a/src/client/rest/ratelimiting.rs b/src/client/rest/ratelimiting.rs
index 8e3cce7..00c374f 100644
--- a/src/client/rest/ratelimiting.rs
+++ b/src/client/rest/ratelimiting.rs
@@ -99,59 +99,258 @@ lazy_static! {
/// [`rest`]: ../index.html
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum Route {
+ /// Route for the `/channels/:channel_id` path.
+ ///
+ /// The data is the relevant [`ChannelId`].
+ ///
+ /// [`ChannelId`]: ../../model/struct.ChannelId.html
ChannelsId(u64),
+ /// Route for the `/channels/:channel_id/invites` path.
+ ///
+ /// The data is the relevant [`ChannelId`].
+ ///
+ /// [`ChannelId`]: ../../model/struct.ChannelId.html
ChannelsIdInvites(u64),
+ /// Route for the `/channels/:channel_id/messages` path.
+ ///
+ /// The data is the relevant [`ChannelId`].
+ ///
+ /// [`ChannelId`]: ../../model/struct.ChannelId.html
ChannelsIdMessages(u64),
+ /// Route for the `/channels/:channel_id/messages/bulk-delete` path.
+ ///
+ /// The data is the relevant [`ChannelId`].
+ ///
+ /// [`ChannelId`]: ../../model/struct.ChannelId.html
ChannelsIdMessagesBulkDelete(u64),
+ /// Route for the `/channels/:channel_id/messages/:message_id` path.
+ ///
+ /// The data is the relevant [`ChannelId`].
+ ///
+ /// [`ChannelId`]: ../../model/struct.ChannelId.html
// This route is a unique case. The ratelimit for message _deletions_ is
// different than the overall route ratelimit.
//
// Refer to the docs on [Rate Limits] in the yellow warning section.
//
+ // Additionally, this needs to be a `LightMethod` from the parent module
+ // and _not_ a `hyper` `Method` due to `hyper`'s not deriving `Copy`.
+ //
// [Rate Limits]: https://discordapp.com/developers/docs/topics/rate-limits
ChannelsIdMessagesId(LightMethod, u64),
+ /// Route for the `/channels/:channel_id/messages/:message_id/ack` path.
+ ///
+ /// The data is the relevant [`ChannelId`].
+ ///
+ /// [`ChannelId`]: ../../model/struct.ChannelId.html
ChannelsIdMessagesIdAck(u64),
+ /// Route for the `/channels/:channel_id/messages/:message_id/reactions`
+ /// path.
+ ///
+ /// The data is the relevant [`ChannelId`].
+ ///
+ /// [`ChannelId`]: ../../model/struct.ChannelId.html
ChannelsIdMessagesIdReactions(u64),
+ /// Route for the
+ /// `/channels/:channel_id/messages/:message_id/reactions/:reaction/@me`
+ /// path.
+ ///
+ /// The data is the relevant [`ChannelId`].
+ ///
+ /// [`ChannelId`]: ../../model/struct.ChannelId.html
ChannelsIdMessagesIdReactionsUserIdType(u64),
+ /// Route for the `/channels/:channel_id/messages/search` path.
+ ///
+ /// The data is the relevant [`ChannelId`].
+ ///
+ /// [`ChannelId`]: ../../model/struct.ChannelId.html
ChannelsIdMessagesSearch(u64),
+ /// Route for the `/channels/:channel_id/permissions/:target_id` path.
+ ///
+ /// The data is the relevant [`ChannelId`].
+ ///
+ /// [`ChannelId`]: ../../model/struct.ChannelId.html
ChannelsIdPermissionsOverwriteId(u64),
+ /// Route for the `/channels/:channel_id/pins` path.
+ ///
+ /// The data is the relevant [`ChannelId`].
+ ///
+ /// [`ChannelId`]: ../../model/struct.ChannelId.html
ChannelsIdPins(u64),
+ /// Route for the `/channels/:channel_id/pins/:message_id` path.
+ ///
+ /// The data is the relevant [`ChannelId`].
+ ///
+ /// [`ChannelId`]: ../../model/struct.ChannelId.html
ChannelsIdPinsMessageId(u64),
+ /// Route for the `/channels/:channel_id/typing` path.
+ ///
+ /// The data is the relevant [`ChannelId`].
+ ///
+ /// [`ChannelId`]: ../../model/struct.ChannelId.html
ChannelsIdTyping(u64),
+ /// Route for the `/channels/:channel_id/webhooks` path.
+ ///
+ /// The data is the relevant [`ChannelId`].
+ ///
+ /// [`ChannelId`]: ../../model/struct.ChannelId.html
ChannelsIdWebhooks(u64),
+ /// Route for the `/gateway` path.
Gateway,
+ /// Route for the `/gateway/bot` path.
GatewayBot,
+ /// Route for the `/guilds` path.
Guilds,
+ /// Route for the `/guilds/:guild_id` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsId(u64),
+ /// Route for the `/guilds/:guild_id/bans` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdBans(u64),
+ /// Route for the `/guilds/:guild_id/bans/:user_id` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdBansUserId(u64),
+ /// Route for the `/guilds/:guild_id/channels/:channel_id` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdChannels(u64),
+ /// Route for the `/guilds/:guild_id/embed` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdEmbed(u64),
+ /// Route for the `/guilds/:guild_id/emojis` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdEmojis(u64),
+ /// Route for the `/guilds/:guild_id/emojis/:emoji_id` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdEmojisId(u64),
+ /// Route for the `/guilds/:guild_id/integrations` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdIntegrations(u64),
+ /// Route for the `/guilds/:guild_id/integrations/:integration_id` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdIntegrationsId(u64),
+ /// Route for the `/guilds/:guild_id/integrations/:integration_id/sync`
+ /// path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdIntegrationsIdSync(u64),
+ /// Route for the `/guilds/:guild_id/invites` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdInvites(u64),
+ /// Route for the `/guilds/:guild_id/members` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdMembers(u64),
+ /// Route for the `/guilds/:guild_id/members/:user_id` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdMembersId(u64),
+ /// Route for the `/guilds/:guild_id/members/:user_id/roles/:role_id` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdMembersIdRolesId(u64),
+ /// Route for the `/guilds/:guild_id/members/@me/nick` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdMembersMeNick(u64),
+ /// Route for the `/guilds/:guild_id/messages/search` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdMessagesSearch(u64),
+ /// Route for the `/guilds/:guild_id/prune` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdPrune(u64),
+ /// Route for the `/guilds/:guild_id/regions` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdRegions(u64),
+ /// Route for the `/guilds/:guild_id/roles` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdRoles(u64),
+ /// Route for the `/guilds/:guild_id/roles/:role_id` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdRolesId(u64),
+ /// Route for the `/guilds/:guild_id/webhooks` path.
+ ///
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
GuildsIdWebhooks(u64),
+ /// Route for the `/invites/:code` path.
InvitesCode,
+ /// Route for the `/users/:user_id` path.
UsersId,
+ /// Route for the `/users/@me` path.
UsersMe,
+ /// Route for the `/users/@me/channels` path.
UsersMeChannels,
+ /// Route for the `/users/@me/connections` path.
UsersMeConnections,
+ /// Route for the `/users/@me/guilds` path.
UsersMeGuilds,
+ /// Route for the `/users/@me/guilds/:guild_id` path.
UsersMeGuildsId,
+ /// Route for the `/voice/regions` path.
VoiceRegions,
+ /// Route for the `/webhooks/:webhook_id` path.
WebhooksId,
+ /// Route where no ratelimit headers are in place (i.e. user account-only
+ /// routes).
+ ///
+ /// This is a special case, in that if the route is `None` then pre- and
+ /// post-hooks are not executed.
None,
}
diff --git a/src/ext/framework/help_commands.rs b/src/ext/framework/help_commands.rs
index d5e6ae2..9f193ec 100644
--- a/src/ext/framework/help_commands.rs
+++ b/src/ext/framework/help_commands.rs
@@ -1,3 +1,25 @@
+//! A collection of default help commands for the framework.
+//!
+//! # Example
+//!
+//! Using the [`with_embeds`] function to have the framework's help message use
+//! embeds:
+//!
+//! ```rs,no_run
+//! use serenity::Client;
+//! use std::env;
+//!
+//! let mut client = Client::login_bot(&env::var("DISCORD_TOKEN").unwrap());
+//! client.with_framework(|f| f
+//! .command("help", |c| c.exec(help_commands::with_embeds)));
+//! ```
+//!
+//! The same can be accomplished with no embeds by substituting `with_embeds`
+//! with the [`plain`] function.
+//!
+//! [`plain`]: fn.plain.html
+//! [`with_embeds`]: fn.with_embeds.html
+
use std::collections::HashMap;
use std::sync::Arc;
use std::fmt::Write;
diff --git a/src/lib.rs b/src/lib.rs
index 59b4acf..40058ac 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -87,6 +87,7 @@
//! [examples]: https://github.com/zeyla/serenity/tree/master/examples
//! [gateway docs]: client/gateway/index.html
#![allow(doc_markdown, inline_always, unknown_lints)]
+#![warn(missing_docs)]
#![doc(html_logo_url="https://docs.austinhellyer.me/serenity/docs_header.png")]
#![warn(enum_glob_use, if_not_else)]
diff --git a/src/model/event.rs b/src/model/event.rs
index 5ae6629..d9e6523 100644
--- a/src/model/event.rs
+++ b/src/model/event.rs
@@ -9,8 +9,19 @@ use ::utils::decode_array;
type Map = BTreeMap<String, Value>;
+/// Event data for the call creation event.
+///
+/// This is fired when:
+///
+/// - a [`Call`] in a [`Group`] is created
+/// - a [`Call`] in a [`PrivateChannel`] is created
+///
+/// [`Call`]: ../struct.Call.html
+/// [`Group`]: ../struct.Group.html
+/// [`PrivateChannel`]: ../struct.PrivateChannel.html
#[derive(Clone, Debug)]
pub struct CallCreateEvent {
+ /// Information about the created call.
pub call: Call,
}
@@ -24,8 +35,21 @@ impl CallCreateEvent {
}
}
+/// Event data for the call deletion event.
+///
+/// This is fired when:
+///
+/// - A [`Call`] in a [`Group`] has ended
+/// - A [`Call`] in a [`PrivateChannel`] has ended
+///
+/// [`Call`]: ../struct.Call.html
+/// [`Group`]: ../struct.Group.html
+/// [`PrivateChannel`]: ../struct.PrivateChannel.html
#[derive(Clone, Debug)]
pub struct CallDeleteEvent {
+ /// The Id of the [`Channel`] that the call took place in.
+ ///
+ /// [`Channel`]: ../enum.Channel.html
pub channel_id: ChannelId,
}
@@ -39,11 +63,40 @@ impl CallDeleteEvent {
}
}
+/// Event data for the call update event.
+///
+/// This is fired when:
+///
+/// - A member of a [`Group`] has been rung
+/// - The voice [`region`] of the [`Call`] has been updated
+///
+/// [`Call`]: ../struct.Call.html
+/// [`Group`]: ../srruct.Group.html
+/// [`region`]: #structfield.region
#[derive(Clone, Debug)]
pub struct CallUpdateEvent {
+ /// The Id of the [channel][`Channel`] that the [call][`Call`] is taking
+ /// place in.
+ ///
+ /// [`Call`]: ../struct.Call.html
+ /// [`Channel`]: ../enum.Channel.html
pub channel_id: ChannelId,
+ /// The Id in the [channel][`Channel`] - mapped by the [`channel_id`] -
+ /// denoting the beginning of the [call][`Call`].
+ ///
+ /// [`Channel`]: ../enum.Channel.html
+ /// [`Call`]: ../struct.Call.html
+ /// [`channel_id`]: #structfield.channel_id
pub message_id: MessageId,
+ /// The voice region that the [call][`Call`] is hosted in.
+ ///
+ /// [`Call`]: ../struct.Call.html
pub region: String,
+ /// A list of [user][`User`]s currently being rung who have not declined or
+ /// accepted the [call][`Call`].
+ ///
+ /// [`Call`]: ../struct.Call.html
+ /// [`User`]: ../struct.User.html
pub ringing: Vec<UserId>,
}
@@ -60,8 +113,21 @@ impl CallUpdateEvent {
}
}
+/// Event data for the channel creation event.
+///
+/// This is fired when:
+///
+/// - A [`Channel`] is created in a [`Guild`]
+/// - A [`PrivateChannel`] is created
+/// - The current user is added to a [`Group`]
+///
+/// [`Channel`]: ../enum.Channel.html
+/// [`Group`]: ../struct.Group.html
+/// [`Guild`]: ../struct.Guild.html
+/// [`PrivateChannel`]: ../struct.PrivateChannel.html
#[derive(Clone, Debug)]
pub struct ChannelCreateEvent {
+ /// The channel that was created.
pub channel: Channel,
}
@@ -945,27 +1011,90 @@ impl GatewayEvent {
#[allow(large_enum_variant)]
#[derive(Clone, Debug)]
pub enum Event {
- /// A new group call has been created
+ /// A new [`Call`] has been created.
+ ///
+ /// Fires the [`Client::on_call_create`] event.
+ ///
+ /// [`Call`]: ../struct.Call.html
+ /// [`Client::on_call_create`]: ../../client/struct.Client.html#on_call_create
CallCreate(CallCreateEvent),
- /// A group call has been deleted (the call ended)
+ /// A [`Call`] has ended.
+ ///
+ /// Fires the [`Client::on_call_delete`] event.
+ ///
+ /// [`Call`]: ../struct.Call.html
+ /// [`Client::on_call_delete`]: ../../client/struct.Client.html#method.on_call_delete
CallDelete(CallDeleteEvent),
- /// A group call has been updated
+ /// A [`Call`] was updated.
+ ///
+ /// Fires the [`Client::on_call_update`] event.
+ ///
+ /// [`Call`]: ../struct.Call.html
+ /// [`Client::on_call_update`]: ../../client/struct.Client.html#method.on_call_update
CallUpdate(CallUpdateEvent),
+ /// A [`Channel`] was created.
+ ///
+ /// Fires the [`Client::on_channel_create`] event.
+ ///
+ /// [`Channel`]: ../enum.Channel.html
+ /// [`Client::on_channel_create`]: ../../client/struct.Client.html#on_channel_create
ChannelCreate(ChannelCreateEvent),
+ /// A [`Channel`] has been deleted.
+ ///
+ /// Fires the [`Client::on_channel_delete`] event.
+ ///
+ /// [`Channel`]: ../enum.Channel.html
ChannelDelete(ChannelDeleteEvent),
+ /// The pins for a [`Channel`] have been acked.
+ ///
+ /// Fires the [`Client::on_channel_pins_ack`] event.
+ ///
+ /// [`Channel`]: ../enum.Channel.html
+ /// [`Client::on_channel_pins_ack`]: ../../client/struct.Client.html#on_channel_pins_ack
ChannelPinsAck(ChannelPinsAckEvent),
+ /// The pins for a [`Channel`] have been updated.
+ ///
+ /// Fires the [`Client::on_channel_pins_update`] event.
+ ///
+ /// [`Channel`]: ../enum.Channel.html
+ /// [`Client::on_channel_pins_update`]: ../../client/struct.Client.html#on_channel_pins_update
ChannelPinsUpdate(ChannelPinsUpdateEvent),
- /// A user has been added to a group
+ /// A [`User`] has been added to a [`Group`].
+ ///
+ /// Fires the [`Client::on_recipient_add`] event.
+ ///
+ /// [`Client::on_recipient_add`]: ../../client/struct.Client.html#on_recipient_add
+ /// [`User`]: ../struct.User.html
ChannelRecipientAdd(ChannelRecipientAddEvent),
- /// A user has been removed from a group
+ /// A [`User`] has been removed from a [`Group`].
+ ///
+ /// Fires the [`Client::on_recipient_remove`] event.
+ ///
+ /// [`Client::on_recipient_remove`]: ../../client/struct.Client.html#on_recipient_remove
+ /// [`User`]: ../struct.User.html
ChannelRecipientRemove(ChannelRecipientRemoveEvent),
+ /// A [`Channel`] has been updated.
+ ///
+ /// Fires the [`Client::on_channel_update`] event.
+ ///
+ /// [`Client::on_channel_update`]: ../../client/struct.Client.html#on_channel_update
+ /// [`User`]: ../struct.User.html
ChannelUpdate(ChannelUpdateEvent),
/// When a suggestion for a friend is created, due to a connection like
- /// [`Skype`].
+ /// [Skype][`Connection::Skype`].
+ ///
+ /// Fires the [`on_friend_suggestion_create`] event.
///
/// [`Connection::Skype`]: enum.Connection.html#variant.Skype
+ /// [`on_friend_suggestion_delete`]: ../../client/struct.Client.html#on_friend_suggestion_create
FriendSuggestionCreate(FriendSuggestionCreateEvent),
- /// When a suggestion for a friend is removed.
+ /// When a suggestion for a friend is removed, due to a connection like
+ /// [Skype][`Connection::Skype`].
+ ///
+ /// Fires the [`on_friend_suggestion_delete`] event.
+ ///
+ /// [`Connection::Skype`]: enum.Connection.html#variant.Skype
+ /// [`on_friend_suggestion_create`]: ../../client/struct.Client.html#on_friend_suggestion_delete
FriendSuggestionDelete(FriendSuggestionDeleteEvent),
GuildBanAdd(GuildBanAddEvent),
GuildBanRemove(GuildBanRemoveEvent),
@@ -1125,6 +1254,7 @@ impl Event {
}
}
+#[allow(missing_docs)]
#[derive(Clone, Copy, Debug)]
pub struct VoiceHeartbeat {
pub heartbeat_interval: u64,
@@ -1140,6 +1270,7 @@ impl VoiceHeartbeat {
}
}
+#[allow(missing_docs)]
#[derive(Clone, Debug)]
pub struct VoiceHello {
pub heartbeat_interval: u64,
@@ -1163,6 +1294,7 @@ impl VoiceHello {
}
}
+#[allow(missing_docs)]
#[derive(Clone, Debug)]
pub struct VoiceSessionDescription {
pub mode: String,
@@ -1183,6 +1315,7 @@ impl VoiceSessionDescription {
}
}
+#[allow(missing_docs)]
#[derive(Clone, Copy, Debug)]
pub struct VoiceSpeaking {
pub speaking: bool,
@@ -1202,13 +1335,25 @@ impl VoiceSpeaking {
}
}
+/// A representation of data received for [`voice`] events.
+///
+/// [`voice`]: ../../ext/voice/index.html
#[derive(Clone, Debug)]
pub enum VoiceEvent {
+ /// A voice heartbeat.
Heartbeat(VoiceHeartbeat),
+ /// A "hello" was received with initial voice data, such as the
+ /// [`heartbeat_interval`].
+ ///
+ /// [`heartbeat_interval`]: struct.VoiceHello.html#structfield.heartbeat_interval
Hello(VoiceHello),
+ /// A simple keepalive event.
KeepAlive,
+ /// A voice event describing the current session.
Ready(VoiceSessionDescription),
+ /// A voice event denoting that someone is speaking.
Speaking(VoiceSpeaking),
+ /// An unknown voice event not registered.
Unknown(VoiceOpCode, Value)
}
diff --git a/src/model/misc.rs b/src/model/misc.rs
index 3784a59..118492c 100644
--- a/src/model/misc.rs
+++ b/src/model/misc.rs
@@ -17,6 +17,8 @@ use ::utils;
/// Allows something - such as a channel or role - to be mentioned in a message.
pub trait Mentionable {
+ /// Creates a mentionable string, that will be able to notify and/or create
+ /// a link to the item.
fn mention(&self) -> String;
}
diff --git a/src/model/mod.rs b/src/model/mod.rs
index c3dd233..c871f90 100644
--- a/src/model/mod.rs
+++ b/src/model/mod.rs
@@ -173,9 +173,24 @@ pub enum PossibleGuild<T> {
Online(T),
}
+/// Denotes the target for a search.
+///
+/// This can be either a [`Guild`] - which can search multiple [`Channel`]s -
+/// or a `Channel`.
+///
+/// [`Channel`]: enum.Channel.html
+/// [`Guild`]: struct.Guild.html
#[derive(Copy, Clone, Debug)]
pub enum SearchTarget {
+ /// An indicator that the target for a [`Search`] is a [`Channel`].
+ ///
+ /// [`Channel`]: enum.Channel.html
+ /// [`Search`]: struct.Search.html
Channel(ChannelId),
+ /// An indicator that the target for a [`Search`] is a [`Guild`].
+ ///
+ /// [`Guild`]: struct.Guild.html
+ /// [`Search`]: struct.Search.html
Guild(GuildId),
}
diff --git a/src/model/permissions.rs b/src/model/permissions.rs
index 1c613d3..98400c6 100644
--- a/src/model/permissions.rs
+++ b/src/model/permissions.rs
@@ -145,8 +145,16 @@ pub fn voice() -> Permissions {
CONNECT | SPEAK | USE_VAD
}
-
bitflags! {
+ /// A set of permissions that can be assigned to [`User`]s and [`Role`]s via
+ /// [`PermissionOverwrite`]s, roles globally in a [`Guild`], and to
+ /// [`GuildChannel`]s.
+ ///
+ /// [`Guild`]: struct.Guild.html
+ /// [`GuildChannel`]: struct.GuildChannel.html
+ /// [`PermissionOverwrite`]: struct.PermissionOverwrite.html
+ /// [`Role`]: struct.Role.html
+ /// [`User`]: struct.User.html
pub flags Permissions: u64 {
/// Allows for the creation of [`RichInvite`]s.
///
diff --git a/src/utils/macros.rs b/src/utils/macros.rs
index 484638f..16382b1 100644
--- a/src/utils/macros.rs
+++ b/src/utils/macros.rs
@@ -1,3 +1,5 @@
+//! A set of macros for easily working with internals.
+
macro_rules! request {
($route:expr, $method:ident($body:expr), $url:expr, $($rest:tt)*) => {{
let client = HyperClient::new();