Struct serenity::framework::standard::CreateGroup
[−]
[src]
pub struct CreateGroup(pub CommandGroup);
Used to create command groups
Examples
Create group named Information where all commands are prefixed with info, and add one command named "name". For example, if prefix is "~", we say "~info name" to call the "name" command.
framework.group("Information", |g| g .prefix("info") .command("name", |c| c .exec_str("Hakase")))
Methods
impl CreateGroup
[src]
fn command<F>(self, command_name: &str, f: F) -> Self where
F: FnOnce(CreateCommand) -> CreateCommand,
[src]
F: FnOnce(CreateCommand) -> CreateCommand,
Adds a command to group.
fn on(
self,
name: &str,
f: fn(_: &mut Context, _: &Message, _: Args) -> Result<(), CommandError>
) -> Self
[src]
self,
name: &str,
f: fn(_: &mut Context, _: &Message, _: Args) -> Result<(), CommandError>
) -> Self
Adds a command to group with simplified API. You can return Err(From::from(string)) if there's an error.
fn prefix(self, desc: &str) -> Self
[src]
If prefix is set, it will be required before all command names. For example, if bot prefix is "~" and group prefix is "image" we'd call a subcommand named "hibiki" by sending "~image hibiki".
Note: serenity automatically puts a space after group prefix.
Note: It's suggested to call this first when making a group.
fn bucket(self, bucket: &str) -> Self
[src]
Adds a ratelimit bucket.
fn dm_only(self, dm_only: bool) -> Self
[src]
Whether command can be used only privately or not.
fn guild_only(self, guild_only: bool) -> Self
[src]
Whether command can be used only in guilds or not.
fn help_available(self, help_available: bool) -> Self
[src]
Whether command should be displayed in help list or not, used by other commands.
fn owners_only(self, owners_only: bool) -> Self
[src]
Whether command can be used only privately or not.
fn required_permissions(self, permissions: Permissions) -> Self
[src]
The permissions that a user must have in the contextual channel in order for the command to be processed.
fn allowed_roles(self, allowed_roles: Vec<&str>) -> Self
[src]
Sets roles that are allowed to use the command.
Trait Implementations
impl Default for CreateGroup
[src]
fn default() -> CreateGroup
[src]
Returns the "default value" for a type. Read more