Module serenity::framework::standard::help_commands
source · 👎Deprecated: The standard framework is deprecated, and will be removed in 0.13. Please migrate to
poise
for command handlingAvailable on crate features
framework
and standard_framework
only.Expand description
A collection of default help commands for the framework.
§Example
Using the with_embeds
function to have the framework’s help message use embeds:
use std::collections::HashSet;
use std::env;
use serenity::client::{Client, Context, EventHandler};
use serenity::framework::standard::macros::help;
use serenity::framework::standard::{
help_commands,
Args,
CommandGroup,
CommandResult,
HelpOptions,
StandardFramework,
};
use serenity::model::prelude::{Message, UserId};
struct Handler;
impl EventHandler for Handler {}
#[help]
async fn my_help(
context: &Context,
msg: &Message,
args: Args,
help_options: &'static HelpOptions,
groups: &[&'static CommandGroup],
owners: HashSet<UserId>,
) -> CommandResult {
let _ = help_commands::with_embeds(context, msg, args, help_options, groups, owners).await;
Ok(())
}
let framework = StandardFramework::new().help(&MY_HELP);
The same can be accomplished with no embeds by substituting with_embeds
with the plain
function.
Structs§
- CommandDeprecatedA single command containing all related pieces of information.
- GroupCommandsPairDeprecatedA single group containing its name and all related commands that are eligible in relation of help-settings measured to the user.
- SuggestedCommandNameDeprecatedA single suggested command containing its name and Levenshtein distance to the actual user’s searched command name.
- SuggestionsDeprecatedContains possible suggestions in case a command could not be found but are similar enough.
Enums§
- CustomisedHelpDataDeprecatedCovers possible outcomes of a help-request and yields relevant data in customised textual representation.
Functions§
- Iterates over all commands and forges them into a
CustomisedHelpData
, takingHelpOptions
into consideration when deciding on whether a command shall be picked and in what textual format. - Checks whether a user is member of required roles and given the required permissions.
- Posts formatted text displaying each individual command group and its commands.
- Posts an embed showing each individual command group and its commands.