summaryrefslogtreecommitdiff
path: root/src/command.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-04-09 18:17:02 +0100
committerSadie Powell <sadie@witchery.services>2025-04-10 13:34:25 +0100
commit9351debd73cb22f33bc46c201c9d66ec09ea773e (patch)
treebe92bdd1d1f288f375d6ff7fa00afc3db75e255d /src/command.cpp
parent40d558ef21a438bf1dff9ac522cd852166fc4c44 (diff)
Expand GetQueryCommand to take a command name.
Diffstat (limited to 'src/command.cpp')
-rw-r--r--src/command.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/command.cpp b/src/command.cpp
index 6df28aa9f..94f88aba5 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -212,9 +212,14 @@ bool Command::OnHelp(CommandSource &source, const Anope::string &subcommand) { r
void Command::OnSyntaxError(CommandSource &source, const Anope::string &subcommand)
{
this->SendSyntax(source);
- bool has_help = source.service->commands.find("HELP") != source.service->commands.end();
- if (has_help)
- source.Reply(MORE_INFO, source.service->GetQueryCommand().c_str(), source.command.c_str());
+
+ auto it = std::find_if(source.service->commands.begin(), source.service->commands.end(), [](const auto &cmd)
+ {
+ // The help command may not be called HELP.
+ return cmd.second.name == "generic/help";
+ });
+ if (it == source.service->commands.end())
+ source.Reply(MORE_INFO, source.service->GetQueryCommand("generic/help", source.command).c_str());
}
namespace
@@ -241,13 +246,13 @@ namespace
bool has_help = source.service->commands.find("HELP") != source.service->commands.end();
if (has_help && similar.empty())
{
- source.Reply(_("Unknown command \002%s\002. \"%s HELP\" for help."), message.c_str(),
- source.service->GetQueryCommand().c_str());
+ source.Reply(_("Unknown command \002%s\002. \"%s\" for help."), message.c_str(),
+ source.service->GetQueryCommand("generic/help").c_str());
}
else if (has_help)
{
- source.Reply(_("Unknown command \002%s\002. Did you mean \002%s\002? \"%s HELP\" for help."),
- message.c_str(), similar.c_str(), source.service->GetQueryCommand().c_str());
+ source.Reply(_("Unknown command \002%s\002. Did you mean \002%s\002? \"%s\" for help."),
+ message.c_str(), similar.c_str(), source.service->GetQueryCommand("generic/help").c_str());
}
else if (similar.empty())
{