From 6553c5dffdf7ffae637be2273e4133ac75d2cb70 Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Sun, 3 Nov 2024 00:55:04 +0000 Subject: [PATCH] Fix up docs and remove help_text_fn --- examples/README.md | 3 +-- macros/src/command/mod.rs | 10 +++------- macros/src/lib.rs | 2 -- src/lib.rs | 7 ------- 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/examples/README.md b/examples/README.md index 74d4f2264135..5eb1890eacb4 100644 --- a/examples/README.md +++ b/examples/README.md @@ -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 diff --git a/macros/src/command/mod.rs b/macros/src/command/mod.rs index 8c7f8bbd6136..b5d9ab0cdd6f 100644 --- a/macros/src/command/mod.rs +++ b/macros/src/command/mod.rs @@ -26,7 +26,6 @@ pub struct CommandArgs { track_deletion: bool, track_edits: bool, broadcast_typing: bool, - help_text_fn: Option, #[darling(multiple)] check: Vec, on_error: Option, @@ -291,12 +290,9 @@ fn generate_command(mut inv: Invocation) -> Result 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; diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 5316651af233..55fb9e53a525 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -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) diff --git a/src/lib.rs b/src/lib.rs index ef3c164d6fa9..032a9ef40ca2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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", )] @@ -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 { // We discriminate against users starting with an X Ok(!ctx.author().name.starts_with('X'))