From 962756b07bf175c6848bc9a6e1ee3f05cbc5c7e4 Mon Sep 17 00:00:00 2001 From: Sellara <147769367+Sella-GH@users.noreply.github.com> Date: Sun, 21 Jul 2024 20:44:40 +0200 Subject: [PATCH] Fix help command (#133) * Add debug logging * Add more debug logging * Add first counter measure * Try another way * Remove test code * Test another thing * Return --- src/AzzyBot-Next.Bot/Utilities/AzzyHelp.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/AzzyBot-Next.Bot/Utilities/AzzyHelp.cs b/src/AzzyBot-Next.Bot/Utilities/AzzyHelp.cs index 724a5299..e93a882f 100644 --- a/src/AzzyBot-Next.Bot/Utilities/AzzyHelp.cs +++ b/src/AzzyBot-Next.Bot/Utilities/AzzyHelp.cs @@ -40,7 +40,9 @@ public static AzzyHelpRecord GetSingleCommand(IReadOnlyDictionary r.Value.Any(c => c.Name == commandName)).Value.FirstOrDefault() ?? throw new InvalidOperationException("Command not found"); + string[] parts = commandName.Split(' '); + + return GetCommandGroups(commands, adminServer, approvedDebug, member, true).Where(c => c.Key == parts[0]).SelectMany(r => r.Value).FirstOrDefault(c => c.Name == commandName) ?? throw new InvalidOperationException($"Command not found: {commandName}"); } private static Dictionary> GetCommandGroups(IReadOnlyDictionary commands, bool adminServer, bool approvedDebug, DiscordMember member, bool singleCommand = false)