[−][src]Struct serenity::framework::standard::CreateGroup
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]
impl CreateGroup
pub fn command<F>(self, command_name: &str, f: F) -> Self where
F: FnOnce(CreateCommand) -> CreateCommand,
[src]
pub fn command<F>(self, command_name: &str, f: F) -> Self where
F: FnOnce(CreateCommand) -> CreateCommand,
Adds a command to group.
pub fn on(
self,
name: &str,
f: fn(_: &mut Context, _: &Message, _: Args) -> Result<(), CommandError>
) -> Self
[src]
pub fn on(
self,
name: &str,
f: fn(_: &mut Context, _: &Message, _: Args) -> Result<(), CommandError>
) -> Self
Adds a command to group with a simplified API. You can return Err(From::from(string)) if there's an error.
pub fn cmd<C: Command + 'static>(self, name: &str, c: C) -> Self
[src]
pub fn cmd<C: Command + 'static>(self, name: &str, c: C) -> Self
Like on
, but accepts a Command
directly.
pub fn prefix(self, prefix: &str) -> Self
[src]
pub fn prefix(self, prefix: &str) -> Self
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.
pub fn prefixes<T: ToString, I: IntoIterator<Item = T>>(
self,
prefixes: I
) -> Self
[src]
pub fn prefixes<T: ToString, I: IntoIterator<Item = T>>(
self,
prefixes: I
) -> Self
Sets prefixes to respond to. Each can be a string slice of any non-zero length.
Note: serenity automatically puts a space after group prefix.
Note: It's suggested to call this first when making a group.
pub fn bucket(self, bucket: &str) -> Self
[src]
pub fn bucket(self, bucket: &str) -> Self
Adds a ratelimit bucket.
pub fn dm_only(self, dm_only: bool) -> Self
[src]
pub fn dm_only(self, dm_only: bool) -> Self
Whether command can be used only privately or not.
pub fn guild_only(self, guild_only: bool) -> Self
[src]
pub fn guild_only(self, guild_only: bool) -> Self
Whether command can be used only in guilds or not.
pub fn owner_privileges(self, owner_privileges: bool) -> Self
[src]
pub fn owner_privileges(self, owner_privileges: bool) -> Self
Whether owners shall bypass buckets, missing permissions, wrong channels, missing roles, and checks.
pub fn help_available(self, help_available: bool) -> Self
[src]
pub fn help_available(self, help_available: bool) -> Self
Whether command should be displayed in help list or not, used by other commands.
pub fn owners_only(self, owners_only: bool) -> Self
[src]
pub fn owners_only(self, owners_only: bool) -> Self
Whether command can be used only privately or not.
pub fn required_permissions(self, permissions: Permissions) -> Self
[src]
pub fn required_permissions(self, permissions: Permissions) -> Self
The permissions that a user must have in the contextual channel in order for the command to be processed.
pub fn allowed_roles<T: ToString, It: IntoIterator<Item = T>>(
self,
allowed_roles: It
) -> Self
[src]
pub fn allowed_roles<T: ToString, It: IntoIterator<Item = T>>(
self,
allowed_roles: It
) -> Self
Sets roles that are allowed to use the command.
pub fn check<F>(self, check: F) -> Self where
F: Fn(&mut Context, &Message, &mut Args, &CommandOptions) -> bool + Send + Sync + 'static,
[src]
pub fn check<F>(self, check: F) -> Self where
F: Fn(&mut Context, &Message, &mut Args, &CommandOptions) -> bool + Send + Sync + 'static,
Adds a "check" to a group, which checks whether or not the groups's commands should be called.
Note: These checks are bypassed for commands sent by the application owner.
pub fn default_cmd<C: Command + 'static>(self, c: C) -> Self
[src]
pub fn default_cmd<C: Command + 'static>(self, c: C) -> Self
Adds a command for a group that will be executed if no command-name has been passed.
pub fn desc(self, text: &str) -> Self
[src]
pub fn desc(self, text: &str) -> Self
Sets a description for the group that will be displayed if only one specific group is requested via help.
Trait Implementations
impl Default for CreateGroup
[src]
impl Default for CreateGroup
fn default() -> CreateGroup
[src]
fn default() -> CreateGroup
Returns the "default value" for a type. Read more
Auto Trait Implementations
impl Send for CreateGroup
impl Send for CreateGroup
impl Sync for CreateGroup
impl Sync for CreateGroup
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> Erased for T
impl<T> Erased for T
impl<T> Typeable for T where
T: Any,
impl<T> Typeable for T where
T: Any,
impl<T> UnsafeAny for T where
T: Any,
impl<T> UnsafeAny for T where
T: Any,