@@ -16,20 +16,20 @@ struct CommandInfo {
1616 description : String ,
1717}
1818
19+ const ADMIN_COMMANDS : & [ & str ] = & [ "dl" , "mot" , "sh" , "ul" ] ;
20+
1921pub async fn knightcmd_help ( message : & Message ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
2022 let mut commands = Vec :: new ( ) ;
2123
2224 let plugin_dir = "src/plugins" ;
2325 for entry in fs:: read_dir ( plugin_dir) ? {
2426 if let Ok ( entry) = entry {
2527 if let Some ( filename) = entry. file_name ( ) . to_str ( ) {
28+ let command_name = filename. trim_end_matches ( ".rs" ) ;
2629 if filename. ends_with ( ".rs" )
2730 && filename != "mod.rs"
28- && filename != "dl.rs"
2931 && filename != "req.rs"
30- && filename != "sh.rs"
31- && filename != "mot.rs"
32- && filename != "ul.rs"
32+ && !ADMIN_COMMANDS . contains ( & command_name)
3333 {
3434 let command_name = filename. trim_end_matches ( ".rs" ) . to_string ( ) ;
3535 let description = get_command_description ( & command_name, plugin_dir) ?;
@@ -54,6 +54,15 @@ pub async fn knightcmd_help(message: &Message) -> Result<(), Box<dyn std::error:
5454 ) ) ;
5555 }
5656
57+ help_msg. push_str ( "\n Admin commands:\n " ) ;
58+ for command in ADMIN_COMMANDS {
59+ help_msg. push_str ( & format ! (
60+ "k.{name} - {description}\n " ,
61+ name = command,
62+ description = get_command_description( command, plugin_dir) ?
63+ ) ) ;
64+ }
65+
5766 message. reply ( help_msg) . await ?;
5867
5968 Ok ( ( ) )
0 commit comments