aboutsummaryrefslogtreecommitdiff
path: root/src/framework/standard/mod.rs
diff options
context:
space:
mode:
authorLakelezz <[email protected]>2018-01-10 17:12:20 +0100
committeralex <[email protected]>2018-01-10 17:12:20 +0100
commit470f366000b3d3f8080e02b185f0f7fef592a736 (patch)
treeb1b5a9243db95a7cb563e6b79d292b44389fca97 /src/framework/standard/mod.rs
parentAllow channels to be moved in and out of a category (#248) (diff)
downloadserenity-470f366000b3d3f8080e02b185f0f7fef592a736.tar.xz
serenity-470f366000b3d3f8080e02b185f0f7fef592a736.zip
Add missing `correct roles`-checks in help-commands (#249)
Diffstat (limited to 'src/framework/standard/mod.rs')
-rw-r--r--src/framework/standard/mod.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/framework/standard/mod.rs b/src/framework/standard/mod.rs
index 6fca88f..904ce97 100644
--- a/src/framework/standard/mod.rs
+++ b/src/framework/standard/mod.rs
@@ -1071,10 +1071,14 @@ pub fn has_correct_permissions(command: &Arc<CommandOptions>, message: &Message)
#[cfg(feature = "cache")]
pub fn has_correct_roles(cmd: &Arc<CommandOptions>, guild: &Guild, member: &Member) -> bool {
- cmd.allowed_roles
+ if cmd.allowed_roles.is_empty() {
+ true
+ } else {
+ cmd.allowed_roles
.iter()
.flat_map(|r| guild.role_by_name(r))
.any(|g| member.roles.contains(&g.id))
+ }
}
/// Describes the behaviour the help-command shall execute once it encounters