aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-09-21 17:29:10 -0700
committerZeyla Hellyer <[email protected]>2017-09-21 17:29:10 -0700
commit092f288fdd22ae39b019e61a6f12420b6ca3b67c (patch)
tree6d8863cc859945457dc6c4b111017fa21ca8103f /src
parentRemove tokio usage (diff)
downloadserenity-092f288fdd22ae39b019e61a6f12420b6ca3b67c.tar.xz
serenity-092f288fdd22ae39b019e61a6f12420b6ca3b67c.zip
Update bitflags, other dependencies
Bitflags changed its macro codegen from creating constants to associated constants on structs. Upgrade path: Update code from: ```rust use serenity::model::permissions::{ADD_REACTIONS, MANAGE_MESSAGES}; foo(vec![ADD_REACTIONS, MANAGE_MESSAGES]); ``` to: ```rust use serenity::model::Permissions; foo(vec![Permissions::ADD_REACTIONS, Permissions::MANAGE_MESSAGES]); ```
Diffstat (limited to 'src')
-rw-r--r--src/model/channel/channel_category.rs4
-rw-r--r--src/model/channel/guild_channel.rs24
-rw-r--r--src/model/channel/message.rs12
-rw-r--r--src/model/channel/reaction.rs2
-rw-r--r--src/model/guild/member.rs2
-rw-r--r--src/model/guild/mod.rs53
-rw-r--r--src/model/invite.rs8
-rw-r--r--src/model/permissions.rs56
-rw-r--r--src/model/user.rs4
9 files changed, 87 insertions, 78 deletions
diff --git a/src/model/channel/channel_category.rs b/src/model/channel/channel_category.rs
index c88f7fa..50df35e 100644
--- a/src/model/channel/channel_category.rs
+++ b/src/model/channel/channel_category.rs
@@ -60,7 +60,7 @@ impl ChannelCategory {
pub fn delete(&self) -> Result<()> {
#[cfg(feature = "cache")]
{
- let req = permissions::MANAGE_CHANNELS;
+ let req = Permissions::MANAGE_CHANNELS;
if !utils::user_has_perms(self.id, req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -86,7 +86,7 @@ impl ChannelCategory {
where F: FnOnce(EditChannel) -> EditChannel {
#[cfg(feature = "cache")]
{
- let req = permissions::MANAGE_CHANNELS;
+ let req = Permissions::MANAGE_CHANNELS;
if !utils::user_has_perms(self.id, req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
diff --git a/src/model/channel/guild_channel.rs b/src/model/channel/guild_channel.rs
index 20e5d41..a6bc597 100644
--- a/src/model/channel/guild_channel.rs
+++ b/src/model/channel/guild_channel.rs
@@ -109,7 +109,7 @@ impl GuildChannel {
where F: FnOnce(CreateInvite) -> CreateInvite {
#[cfg(feature = "cache")]
{
- let req = permissions::CREATE_INVITE;
+ let req = Permissions::CREATE_INVITE;
if !utils::user_has_perms(self.id, req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -135,7 +135,7 @@ impl GuildChannel {
/// permissions:
///
/// ```rust,no_run
- /// # use serenity::model::{ChannelId, UserId};
+ /// # use serenity::model::{ChannelId, Permissions, UserId};
/// # use std::error::Error;
/// #
/// # fn try_main() -> Result<(), Box<Error>> {
@@ -149,8 +149,8 @@ impl GuildChannel {
/// };
/// use serenity::CACHE;
///
- /// let allow = permissions::SEND_MESSAGES;
- /// let deny = permissions::SEND_TTS_MESSAGES | permissions::ATTACH_FILES;
+ /// let allow = Permissions::SEND_MESSAGES;
+ /// let deny = Permissions::SEND_TTS_MESSAGES | Permissions::ATTACH_FILES;
/// let overwrite = PermissionOverwrite {
/// allow: allow,
/// deny: deny,
@@ -177,7 +177,7 @@ impl GuildChannel {
/// permissions:
///
/// ```rust,no_run
- /// # use serenity::model::{ChannelId, UserId};
+ /// # use serenity::model::{ChannelId, Permissions, UserId};
/// # use std::error::Error;
/// #
/// # fn try_main() -> Result<(), Box<Error>> {
@@ -191,8 +191,8 @@ impl GuildChannel {
/// };
/// use serenity::CACHE;
///
- /// let allow = permissions::SEND_MESSAGES;
- /// let deny = permissions::SEND_TTS_MESSAGES | permissions::ATTACH_FILES;
+ /// let allow = Permissions::SEND_MESSAGES;
+ /// let deny = Permissions::SEND_TTS_MESSAGES | Permissions::ATTACH_FILES;
/// let overwrite = PermissionOverwrite {
/// allow: allow,
/// deny: deny,
@@ -233,7 +233,7 @@ impl GuildChannel {
pub fn delete(&self) -> Result<Channel> {
#[cfg(feature = "cache")]
{
- let req = permissions::MANAGE_CHANNELS;
+ let req = Permissions::MANAGE_CHANNELS;
if !utils::user_has_perms(self.id, req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -305,7 +305,7 @@ impl GuildChannel {
where F: FnOnce(EditChannel) -> EditChannel {
#[cfg(feature = "cache")]
{
- let req = permissions::MANAGE_CHANNELS;
+ let req = Permissions::MANAGE_CHANNELS;
if !utils::user_has_perms(self.id, req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -473,8 +473,8 @@ impl GuildChannel {
/// let permissions =
/// channel.read().unwrap().permissions_for(current_user_id).unwrap();
///
- /// if !permissions.contains(permissions::ATTACH_FILES |
- /// permissions::SEND_MESSAGES) {
+ /// if !permissions.contains(Permissions::ATTACH_FILES |
+ /// Permissions::SEND_MESSAGES) {
/// return;
/// }
///
@@ -605,7 +605,7 @@ impl GuildChannel {
pub fn send_message<F: FnOnce(CreateMessage) -> CreateMessage>(&self, f: F) -> Result<Message> {
#[cfg(feature = "cache")]
{
- let req = permissions::SEND_MESSAGES;
+ let req = Permissions::SEND_MESSAGES;
if !utils::user_has_perms(self.id, req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs
index d36d290..7b94540 100644
--- a/src/model/channel/message.rs
+++ b/src/model/channel/message.rs
@@ -137,7 +137,7 @@ impl Message {
pub fn delete(&self) -> Result<()> {
#[cfg(feature = "cache")]
{
- let req = permissions::MANAGE_MESSAGES;
+ let req = Permissions::MANAGE_MESSAGES;
let is_author = self.author.id == CACHE.read().unwrap().user.id;
let has_perms = utils::user_has_perms(self.channel_id, req)?;
@@ -165,7 +165,7 @@ impl Message {
pub fn delete_reactions(&self) -> Result<()> {
#[cfg(feature = "cache")]
{
- let req = permissions::MANAGE_MESSAGES;
+ let req = Permissions::MANAGE_MESSAGES;
if !utils::user_has_perms(self.channel_id, req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -394,7 +394,7 @@ impl Message {
pub fn pin(&self) -> Result<()> {
#[cfg(feature = "cache")]
{
- let req = permissions::MANAGE_MESSAGES;
+ let req = Permissions::MANAGE_MESSAGES;
if !utils::user_has_perms(self.channel_id, req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -421,7 +421,7 @@ impl Message {
pub fn react<R: Into<ReactionType>>(&self, reaction_type: R) -> Result<()> {
#[cfg(feature = "cache")]
{
- let req = permissions::ADD_REACTIONS;
+ let req = Permissions::ADD_REACTIONS;
if !utils::user_has_perms(self.channel_id, req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -460,7 +460,7 @@ impl Message {
#[cfg(feature = "cache")]
{
- let req = permissions::SEND_MESSAGES;
+ let req = Permissions::SEND_MESSAGES;
if !utils::user_has_perms(self.channel_id, req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -494,7 +494,7 @@ impl Message {
pub fn unpin(&self) -> Result<()> {
#[cfg(feature = "cache")]
{
- let req = permissions::MANAGE_MESSAGES;
+ let req = Permissions::MANAGE_MESSAGES;
if !utils::user_has_perms(self.channel_id, req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
diff --git a/src/model/channel/reaction.rs b/src/model/channel/reaction.rs
index 605ac7f..2420ba7 100644
--- a/src/model/channel/reaction.rs
+++ b/src/model/channel/reaction.rs
@@ -61,7 +61,7 @@ impl Reaction {
//
// * The `Manage Messages` permission.
if user.is_some() {
- let req = permissions::MANAGE_MESSAGES;
+ let req = Permissions::MANAGE_MESSAGES;
if !utils::user_has_perms(self.channel_id, req).unwrap_or(true) {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
diff --git a/src/model/guild/member.rs b/src/model/guild/member.rs
index 3e8ae64..09474f9 100644
--- a/src/model/guild/member.rs
+++ b/src/model/guild/member.rs
@@ -246,7 +246,7 @@ impl Member {
pub fn kick(&self) -> Result<()> {
#[cfg(feature = "cache")]
{
- let req = permissions::KICK_MEMBERS;
+ let req = Permissions::KICK_MEMBERS;
let has_perms = CACHE
.read()
diff --git a/src/model/guild/mod.rs b/src/model/guild/mod.rs
index b668875..3979cd9 100644
--- a/src/model/guild/mod.rs
+++ b/src/model/guild/mod.rs
@@ -207,7 +207,7 @@ impl Guild {
pub fn ban<U: Into<UserId>, BO: BanOptions>(&self, user: U, options: BO) -> Result<()> {
#[cfg(feature = "cache")]
{
- let req = permissions::BAN_MEMBERS;
+ let req = Permissions::BAN_MEMBERS;
if !self.has_perms(req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -232,7 +232,7 @@ impl Guild {
pub fn bans(&self) -> Result<Vec<Ban>> {
#[cfg(feature = "cache")]
{
- let req = permissions::BAN_MEMBERS;
+ let req = Permissions::BAN_MEMBERS;
if !self.has_perms(req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -314,7 +314,7 @@ impl Guild {
pub fn create_channel(&self, name: &str, kind: ChannelType) -> Result<GuildChannel> {
#[cfg(feature = "cache")]
{
- let req = permissions::MANAGE_CHANNELS;
+ let req = Permissions::MANAGE_CHANNELS;
if !self.has_perms(req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -385,7 +385,7 @@ impl Guild {
where F: FnOnce(EditRole) -> EditRole {
#[cfg(feature = "cache")]
{
- let req = permissions::MANAGE_ROLES;
+ let req = Permissions::MANAGE_ROLES;
if !self.has_perms(req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -410,7 +410,7 @@ impl Guild {
#[cfg(feature = "cache")]
{
if self.owner_id != CACHE.read().unwrap().user.id {
- let req = permissions::MANAGE_GUILD;
+ let req = Permissions::MANAGE_GUILD;
return Err(Error::Model(ModelError::InvalidPermissions(req)));
}
@@ -487,7 +487,7 @@ impl Guild {
where F: FnOnce(EditGuild) -> EditGuild {
#[cfg(feature = "cache")]
{
- let req = permissions::MANAGE_GUILD;
+ let req = Permissions::MANAGE_GUILD;
if !self.has_perms(req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -567,7 +567,7 @@ impl Guild {
pub fn edit_nickname(&self, new_nickname: Option<&str>) -> Result<()> {
#[cfg(feature = "cache")]
{
- let req = permissions::CHANGE_NICKNAME;
+ let req = Permissions::CHANGE_NICKNAME;
if !self.has_perms(req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -629,7 +629,7 @@ impl Guild {
pub fn invites(&self) -> Result<Vec<RichInvite>> {
#[cfg(feature = "cache")]
{
- let req = permissions::MANAGE_GUILD;
+ let req = Permissions::MANAGE_GUILD;
if !self.has_perms(req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -757,8 +757,6 @@ impl Guild {
/// [`User`]: struct.User.html
pub fn permissions_for<C, U>(&self, channel_id: C, user_id: U) -> Permissions
where C: Into<ChannelId>, U: Into<UserId> {
- use super::permissions::*;
-
let user_id = user_id.into();
// The owner has all permissions in all cases.
@@ -804,7 +802,7 @@ impl Guild {
}
// Administrators have all permissions in any channel.
- if permissions.contains(ADMINISTRATOR) {
+ if permissions.contains(Permissions::ADMINISTRATOR) {
return Permissions::all();
}
@@ -813,8 +811,12 @@ impl Guild {
// If this is a text channel, then throw out voice permissions.
if channel.kind == ChannelType::Text {
- permissions &=
- !(CONNECT | SPEAK | MUTE_MEMBERS | DEAFEN_MEMBERS | MOVE_MEMBERS | USE_VAD);
+ permissions &= !(Permissions::CONNECT
+ | Permissions::SPEAK
+ | Permissions::MUTE_MEMBERS
+ | Permissions::DEAFEN_MEMBERS
+ | Permissions::MOVE_MEMBERS
+ | Permissions::USE_VAD);
}
// Apply the permission overwrites for the channel for each of the
@@ -853,21 +855,28 @@ impl Guild {
// The default channel is always readable.
if channel_id.0 == self.id.0 {
- permissions |= READ_MESSAGES;
+ permissions |= Permissions::READ_MESSAGES;
}
// No SEND_MESSAGES => no message-sending-related actions
// If the member does not have the `SEND_MESSAGES` permission, then
// throw out message-able permissions.
- if !permissions.contains(SEND_MESSAGES) {
- permissions &= !(SEND_TTS_MESSAGES | MENTION_EVERYONE | EMBED_LINKS | ATTACH_FILES);
+ if !permissions.contains(Permissions::SEND_MESSAGES) {
+ permissions &= !(Permissions::SEND_TTS_MESSAGES
+ | Permissions::MENTION_EVERYONE
+ | Permissions::EMBED_LINKS
+ | Permissions::ATTACH_FILES);
}
// If the member does not have the `READ_MESSAGES` permission, then
// throw out actionable permissions.
- if !permissions.contains(READ_MESSAGES) {
- permissions &= KICK_MEMBERS | BAN_MEMBERS | ADMINISTRATOR | MANAGE_GUILD |
- CHANGE_NICKNAME | MANAGE_NICKNAMES;
+ if !permissions.contains(Permissions::READ_MESSAGES) {
+ permissions &= Permissions::KICK_MEMBERS
+ | Permissions::BAN_MEMBERS
+ | Permissions::ADMINISTRATOR
+ | Permissions::MANAGE_GUILD
+ | Permissions::CHANGE_NICKNAME
+ | Permissions::MANAGE_NICKNAMES;
}
permissions
@@ -892,7 +901,7 @@ impl Guild {
pub fn prune_count(&self, days: u16) -> Result<GuildPrune> {
#[cfg(feature = "cache")]
{
- let req = permissions::KICK_MEMBERS;
+ let req = Permissions::KICK_MEMBERS;
if !self.has_perms(req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -975,7 +984,7 @@ impl Guild {
pub fn start_prune(&self, days: u16) -> Result<GuildPrune> {
#[cfg(feature = "cache")]
{
- let req = permissions::KICK_MEMBERS;
+ let req = Permissions::KICK_MEMBERS;
if !self.has_perms(req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -1000,7 +1009,7 @@ impl Guild {
pub fn unban<U: Into<UserId>>(&self, user_id: U) -> Result<()> {
#[cfg(feature = "cache")]
{
- let req = permissions::BAN_MEMBERS;
+ let req = Permissions::BAN_MEMBERS;
if !self.has_perms(req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
diff --git a/src/model/invite.rs b/src/model/invite.rs
index 4c5aa28..ba7521a 100644
--- a/src/model/invite.rs
+++ b/src/model/invite.rs
@@ -2,7 +2,7 @@ use chrono::{DateTime, FixedOffset};
use super::*;
#[cfg(all(feature = "cache", feature = "model"))]
-use super::{permissions, utils as model_utils};
+use super::{Permissions, utils as model_utils};
#[cfg(feature = "model")]
use builder::CreateInvite;
#[cfg(feature = "model")]
@@ -66,7 +66,7 @@ impl Invite {
#[cfg(feature = "cache")]
{
- let req = permissions::CREATE_INVITE;
+ let req = Permissions::CREATE_INVITE;
if !model_utils::user_has_perms(channel_id, req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -91,7 +91,7 @@ impl Invite {
pub fn delete(&self) -> Result<Invite> {
#[cfg(feature = "cache")]
{
- let req = permissions::MANAGE_GUILD;
+ let req = Permissions::MANAGE_GUILD;
if !model_utils::user_has_perms(self.channel.id, req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
@@ -270,7 +270,7 @@ impl RichInvite {
pub fn delete(&self) -> Result<Invite> {
#[cfg(feature = "cache")]
{
- let req = permissions::MANAGE_GUILD;
+ let req = Permissions::MANAGE_GUILD;
if !model_utils::user_has_perms(self.channel.id, req)? {
return Err(Error::Model(ModelError::InvalidPermissions(req)));
diff --git a/src/model/permissions.rs b/src/model/permissions.rs
index ecbcaa1..22599ea 100644
--- a/src/model/permissions.rs
+++ b/src/model/permissions.rs
@@ -259,169 +259,169 @@ impl Permissions {
/// [Add Reactions] permission.
///
/// [Add Reactions]: constant.ADD_REACTIONS.html
- pub fn add_reactions(&self) -> bool { self.contains(self::ADD_REACTIONS) }
+ pub fn add_reactions(&self) -> bool { self.contains(Self::ADD_REACTIONS) }
/// Shorthand for checking that the set of permissions contains the
/// [Administrator] permission.
///
/// [Administrator]: constant.ADMINISTRATOR.html
- pub fn administrator(&self) -> bool { self.contains(self::ADMINISTRATOR) }
+ pub fn administrator(&self) -> bool { self.contains(Self::ADMINISTRATOR) }
/// Shorthand for checking that the set of permissions contains the
/// [Attach Files] permission.
///
/// [Attach Files]: constant.ATTACH_FILES.html
- pub fn attach_files(&self) -> bool { self.contains(self::ATTACH_FILES) }
+ pub fn attach_files(&self) -> bool { self.contains(Self::ATTACH_FILES) }
/// Shorthand for checking that the set of permissions contains the
/// [Ban Members] permission.
///
/// [Ban Members]: constant.BAN_MEMBERS.html
- pub fn ban_members(&self) -> bool { self.contains(self::BAN_MEMBERS) }
+ pub fn ban_members(&self) -> bool { self.contains(Self::BAN_MEMBERS) }
/// Shorthand for checking that the set of permissions contains the
/// [Change Nickname] permission.
///
/// [Change Nickname]: constant.CHANGE_NICKNAME.html
- pub fn change_nickname(&self) -> bool { self.contains(self::CHANGE_NICKNAME) }
+ pub fn change_nickname(&self) -> bool { self.contains(Self::CHANGE_NICKNAME) }
/// Shorthand for checking that the set of permissions contains the
/// [Connect] permission.
///
/// [Connect]: constant.CONNECT.html
- pub fn connect(&self) -> bool { self.contains(self::CONNECT) }
+ pub fn connect(&self) -> bool { self.contains(Self::CONNECT) }
/// Shorthand for checking that the set of permissions contains the
/// [Create Invite] permission.
///
/// [Create Invite]: constant.CREATE_INVITE.html
- pub fn create_invite(&self) -> bool { self.contains(self::CREATE_INVITE) }
+ pub fn create_invite(&self) -> bool { self.contains(Self::CREATE_INVITE) }
/// Shorthand for checking that the set of permissions contains the
/// [Deafen Members] permission.
///
/// [Deafen Members]: constant.DEAFEN_MEMBERS.html
- pub fn deafen_members(&self) -> bool { self.contains(self::DEAFEN_MEMBERS) }
+ pub fn deafen_members(&self) -> bool { self.contains(Self::DEAFEN_MEMBERS) }
/// Shorthand for checking that the set of permissions contains the
/// [Embed Links] permission.
///
/// [Embed Links]: constant.EMBED_LINKS.html
- pub fn embed_links(&self) -> bool { self.contains(self::EMBED_LINKS) }
+ pub fn embed_links(&self) -> bool { self.contains(Self::EMBED_LINKS) }
/// Shorthand for checking that the set of permissions contains the
/// [Use External Emojis] permission.
///
/// [Use External Emojis]: constant.USE_EXTERNAL_EMOJIS.html
- pub fn external_emojis(&self) -> bool { self.contains(self::USE_EXTERNAL_EMOJIS) }
+ pub fn external_emojis(&self) -> bool { self.contains(Self::USE_EXTERNAL_EMOJIS) }
/// Shorthand for checking that the set of permissions contains the
/// [Kick Members] permission.
///
/// [Kick Members]: constant.KICK_MEMBERS.html
- pub fn kick_members(&self) -> bool { self.contains(self::KICK_MEMBERS) }
+ pub fn kick_members(&self) -> bool { self.contains(Self::KICK_MEMBERS) }
/// Shorthand for checking that the set of permissions contains the
/// [Manage Channels] permission.
///
/// [Manage Channels]: constant.MANAGE_CHANNELS.html
- pub fn manage_channels(&self) -> bool { self.contains(self::MANAGE_CHANNELS) }
+ pub fn manage_channels(&self) -> bool { self.contains(Self::MANAGE_CHANNELS) }
/// Shorthand for checking that the set of permissions contains the
/// [Manage Emojis] permission.
///
/// [Manage Emojis]: constant.MANAGE_EMOJIS.html
- pub fn manage_emojis(&self) -> bool { self.contains(self::MANAGE_EMOJIS) }
+ pub fn manage_emojis(&self) -> bool { self.contains(Self::MANAGE_EMOJIS) }
/// Shorthand for checking that the set of permissions contains the
/// [Manage Guild] permission.
///
/// [Manage Guild]: constant.MANAGE_GUILD.html
- pub fn manage_guild(&self) -> bool { self.contains(self::MANAGE_GUILD) }
+ pub fn manage_guild(&self) -> bool { self.contains(Self::MANAGE_GUILD) }
/// Shorthand for checking that the set of permissions contains the
/// [Manage Messages] permission.
///
/// [Manage Messages]: constant.MANAGE_MESSAGES.html
- pub fn manage_messages(&self) -> bool { self.contains(self::MANAGE_MESSAGES) }
+ pub fn manage_messages(&self) -> bool { self.contains(Self::MANAGE_MESSAGES) }
/// Shorthand for checking that the set of permissions contains the
/// [Manage Nicknames] permission.
///
/// [Manage Nicknames]: constant.MANAGE_NICKNAMES.html
- pub fn manage_nicknames(&self) -> bool { self.contains(self::MANAGE_NICKNAMES) }
+ pub fn manage_nicknames(&self) -> bool { self.contains(Self::MANAGE_NICKNAMES) }
/// Shorthand for checking that the set of permissions contains the
/// [Manage Roles] permission.
///
/// [Manage Roles]: constant.MANAGE_ROLES.html
- pub fn manage_roles(&self) -> bool { self.contains(self::MANAGE_ROLES) }
+ pub fn manage_roles(&self) -> bool { self.contains(Self::MANAGE_ROLES) }
/// Shorthand for checking that the set of permissions contains the
/// [Manage Webhooks] permission.
///
/// [Manage Webhooks]: constant.MANAGE_WEBHOOKS.html
- pub fn manage_webhooks(&self) -> bool { self.contains(self::MANAGE_WEBHOOKS) }
+ pub fn manage_webhooks(&self) -> bool { self.contains(Self::MANAGE_WEBHOOKS) }
/// Shorthand for checking that the set of permissions contains the
/// [Mention Everyone] permission.
///
/// [Mention Everyone]: constant.MENTION_EVERYONE.html
- pub fn mention_everyone(&self) -> bool { self.contains(self::MENTION_EVERYONE) }
+ pub fn mention_everyone(&self) -> bool { self.contains(Self::MENTION_EVERYONE) }
/// Shorthand for checking that the set of permissions contains the
/// [Move Members] permission.
///
/// [Move Members]: constant.MOVE_MEMBERS.html
- pub fn move_members(&self) -> bool { self.contains(self::MOVE_MEMBERS) }
+ pub fn move_members(&self) -> bool { self.contains(Self::MOVE_MEMBERS) }
/// Shorthand for checking that the set of permissions contains the
/// [Mute Members] permission.
///
/// [Mute Members]: constant.MUTE_MEMBERS.html
- pub fn mute_members(&self) -> bool { self.contains(self::MUTE_MEMBERS) }
+ pub fn mute_members(&self) -> bool { self.contains(Self::MUTE_MEMBERS) }
/// Shorthand for checking that the set of permissions contains the
/// [Read Message History] permission.
///
/// [Read Message History]: constant.READ_MESSAGE_HISTORY.html
- pub fn read_message_history(&self) -> bool { self.contains(self::READ_MESSAGE_HISTORY) }
+ pub fn read_message_history(&self) -> bool { self.contains(Self::READ_MESSAGE_HISTORY) }
/// Shorthand for checking that the set of permissions contains the
/// [Read Messages] permission.
///
/// [Read Messages]: constant.READ_MESSAGES.html
- pub fn read_messages(&self) -> bool { self.contains(self::READ_MESSAGES) }
+ pub fn read_messages(&self) -> bool { self.contains(Self::READ_MESSAGES) }
/// Shorthand for checking that the set of permissions contains the
/// [Send Messages] permission.
///
/// [Send Messages]: constant.SEND_MESSAGES.html
- pub fn send_messages(&self) -> bool { self.contains(self::SEND_MESSAGES) }
+ pub fn send_messages(&self) -> bool { self.contains(Self::SEND_MESSAGES) }
/// Shorthand for checking that the set of permissions contains the
/// [Send TTS Messages] permission.
///
/// [Send TTS Messages]: constant.SEND_TTS_MESSAGES.html
- pub fn send_tts_messages(&self) -> bool { self.contains(self::SEND_TTS_MESSAGES) }
+ pub fn send_tts_messages(&self) -> bool { self.contains(Self::SEND_TTS_MESSAGES) }
/// Shorthand for checking that the set of permissions contains the
/// [Speak] permission.
///
/// [Speak]: constant.SPEAK.html
- pub fn speak(&self) -> bool { self.contains(self::SPEAK) }
+ pub fn speak(&self) -> bool { self.contains(Self::SPEAK) }
/// Shorthand for checking that the set of permissions contains the
/// [Use External Emojis] permission.
///
/// [Use External Emojis]: constant.USE_EXTERNAL_EMOJIS.html
- pub fn use_external_emojis(&self) -> bool { self.contains(self::USE_EXTERNAL_EMOJIS) }
+ pub fn use_external_emojis(&self) -> bool { self.contains(Self::USE_EXTERNAL_EMOJIS) }
/// Shorthand for checking that the set of permissions contains the
/// [Use VAD] permission.
///
/// [Use VAD]: constant.USE_VAD.html
- pub fn use_vad(&self) -> bool { self.contains(self::USE_VAD) }
+ pub fn use_vad(&self) -> bool { self.contains(Self::USE_VAD) }
}
impl<'de> Deserialize<'de> for Permissions {
diff --git a/src/model/user.rs b/src/model/user.rs
index fb6acf0..a214b3d 100644
--- a/src/model/user.rs
+++ b/src/model/user.rs
@@ -176,10 +176,10 @@ impl CurrentUser {
/// #
/// # let mut cache = CACHE.write().unwrap();
///
- /// use serenity::model::permissions::*;
+ /// use serenity::model::Permissions;
///
/// // assuming the cache has been unlocked
- /// let url = match cache.user.invite_url(READ_MESSAGES | SEND_MESSAGES | EMBED_LINKS) {
+ /// let url = match cache.user.invite_url(Permissions::READ_MESSAGES | Permissions::SEND_MESSAGES | Permissions::EMBED_LINKS) {
/// Ok(v) => v,
/// Err(why) => {
/// println!("Error getting invite url: {:?}", why);