Skip to content

Commit

Permalink
Fix up docs and remove help_text_fn
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Nov 3, 2024
1 parent 7ba29c1 commit 6553c5d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 18 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
10 changes: 3 additions & 7 deletions macros/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub struct CommandArgs {
track_deletion: bool,
track_edits: bool,
broadcast_typing: bool,
help_text_fn: Option<syn::Path>,
#[darling(multiple)]
check: Vec<syn::Path>,
on_error: Option<syn::Path>,
Expand Down Expand Up @@ -291,12 +290,9 @@ fn generate_command(mut inv: Invocation) -> Result<proc_macro2::TokenStream, dar
let dm_only = inv.args.dm_only;
let nsfw_only = inv.args.nsfw_only;

let help_text = match &inv.args.help_text_fn {
Some(help_text_fn) => quote::quote! { Some(#help_text_fn()) },
None => match &inv.help_text {
Some(extracted_explanation) => quote::quote! { Some(#extracted_explanation.into()) },
None => quote::quote! { None },
},
let help_text = match &inv.help_text {
Some(extracted_explanation) => quote::quote! { Some(#extracted_explanation.into()) },
None => quote::quote! { None },
};

let checks = &inv.args.check;
Expand Down
2 changes: 0 additions & 2 deletions macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ for example for command-specific help (i.e. `~help command_name`). Escape newlin
## Help-related arguments
- `hide_in_help`: Hide this command in help menus
- `help_text_fn`: Path to a string-returning function which is used for command help text instead of documentation comments
- Useful if you have many commands with very similar help messages: you can abstract the common parts into a function
## Edit tracking (prefix only)
Expand Down
7 changes: 0 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ type Context<'a> = poise::Context<'a, Data, Error>;
hide_in_help,
required_permissions = "SEND_MESSAGES",
aliases("bigounce", "abomination"),
help_text_fn = "my_huge_ass_command_help",
check = "check",
on_error = "error_handler",
)]
Expand All @@ -201,12 +200,6 @@ async fn my_huge_ass_command(
Ok(())
}
fn my_huge_ass_command_help() -> String {
String::from("\
Example usage:
~my_huge_ass_command 127.0.0.1 @kangalio `i = i + 1` my_flag rest of the message")
}
async fn check(ctx: Context<'_>) -> Result<bool, Error> {
// We discriminate against users starting with an X
Ok(!ctx.author().name.starts_with('X'))
Expand Down

0 comments on commit 6553c5d

Please sign in to comment.