diff options
| author | Lakelezz <[email protected]> | 2017-09-05 15:16:05 +0200 |
|---|---|---|
| committer | alex <[email protected]> | 2017-09-05 15:16:05 +0200 |
| commit | d925f926c0f9f5b8010a998570441258417fc89a (patch) | |
| tree | 3496f5f6f8ef0310a91ed90a8366e0ecb555181e /src/framework/standard/create_command.rs | |
| parent | match to map/? (diff) | |
| download | serenity-d925f926c0f9f5b8010a998570441258417fc89a.tar.xz serenity-d925f926c0f9f5b8010a998570441258417fc89a.zip | |
Allow commands to be limited to certain roles (#157)
Diffstat (limited to 'src/framework/standard/create_command.rs')
| -rw-r--r-- | src/framework/standard/create_command.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/framework/standard/create_command.rs b/src/framework/standard/create_command.rs index 4fe11f2..546447e 100644 --- a/src/framework/standard/create_command.rs +++ b/src/framework/standard/create_command.rs @@ -207,6 +207,13 @@ impl CreateCommand { self } + + /// Sets roles that are allowed to use the command. + pub fn allowed_roles(mut self, allowed_roles: Vec<&str>) -> Self { + self.0.allowed_roles = allowed_roles.iter().map(|x| x.to_string()).collect(); + + self + } } impl Default for Command { @@ -226,6 +233,7 @@ impl Default for Command { guild_only: false, help_available: true, owners_only: false, + allowed_roles: Vec::new(), } } } |