Skip to content

Commit

Permalink
Remove help commands from built-ins (#323)
Browse files Browse the repository at this point in the history
* Remove help commands from built-ins

* Fix up docs and remove help_text_fn
  • Loading branch information
GnomedDev committed Nov 15, 2024
1 parent 433b299 commit 980f607
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 1,133 deletions.
3 changes: 1 addition & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ by poise.

# basic_structure

Showcases the basics of poise: `FrameworkOptions`, creating and accessing the data struct, a help
command, defining commands and sending responses.
Showcases the basics of poise: `FrameworkOptions`, creating and accessing the data struct, defining commands and sending responses.

# feature_showcase

Expand Down
20 changes: 0 additions & 20 deletions examples/basic_structure/commands.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
use crate::{Context, Error};

/// Show this help menu
#[poise::command(prefix_command, track_edits, slash_command)]
pub async fn help(
ctx: Context<'_>,
#[description = "Specific command to show help about"]
#[autocomplete = "poise::builtins::autocomplete_command"]
command: Option<String>,
) -> Result<(), Error> {
poise::builtins::help(
ctx,
command.as_deref(),
poise::builtins::HelpConfiguration {
extra_text_at_bottom: "This is an example bot made to showcase features of my custom Discord bot framework",
..Default::default()
},
)
.await?;
Ok(())
}

/// Vote for something
///
/// Enter `~vote pumpkin` to vote for pumpkins
Expand Down
2 changes: 1 addition & 1 deletion examples/basic_structure/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async fn main() {
// FrameworkOptions contains all of poise's configuration option in one struct
// Every option can be omitted to use its default value
let options = poise::FrameworkOptions {
commands: vec![commands::help(), commands::vote(), commands::getvotes()],
commands: vec![commands::vote(), commands::getvotes()],
prefix_options: poise::PrefixFrameworkOptions {
prefix: Some("~".into()),
edit_tracker: Some(Arc::new(poise::EditTracker::for_timespan(
Expand Down
20 changes: 0 additions & 20 deletions examples/feature_showcase/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,3 @@ pub async fn servers(ctx: Context<'_>) -> Result<(), Error> {
poise::builtins::servers(ctx).await?;
Ok(())
}

#[poise::command(slash_command, prefix_command)]
pub async fn help(ctx: Context<'_>, command: Option<String>) -> Result<(), Error> {
let configuration = poise::builtins::HelpConfiguration {
// [configure aspects about the help message here]
..Default::default()
};
poise::builtins::help(ctx, command.as_deref(), configuration).await?;
Ok(())
}

#[poise::command(slash_command, prefix_command)]
pub async fn pretty_help(ctx: Context<'_>, command: Option<String>) -> Result<(), Error> {
let configuration = poise::builtins::PrettyHelpConfiguration {
// [configure aspects about the help message here]
..Default::default()
};
poise::builtins::pretty_help(ctx, command.as_deref(), configuration).await?;
Ok(())
}
2 changes: 0 additions & 2 deletions examples/feature_showcase/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ async fn main() {
bool_parameter::oracle(),
#[cfg(feature = "cache")]
builtins::servers(),
builtins::help(),
builtins::pretty_help(),
checks::shutdown(),
checks::modonly(),
checks::delete(),
Expand Down
Loading

0 comments on commit 980f607

Please sign in to comment.