diff options
author | Sadie Powell <sadie@witchery.services> | 2025-04-19 16:43:21 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2025-04-19 16:54:26 +0100 |
commit | 70bf013ef0bf6c8ba60e85aacca2ec97848ca0b3 (patch) | |
tree | 70ae17296baa6de7bc7ffee105702b6e28584a5a /modules | |
parent | 18dfa62626468c18177ba6ff24be34f4b64f1d37 (diff) |
Allow syntax messages to take a predicate.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/database/db_atheme.cpp | 1 | ||||
-rw-r--r-- | modules/nickserv/ns_group.cpp | 28 | ||||
-rw-r--r-- | modules/nickserv/ns_logout.cpp | 33 |
3 files changed, 33 insertions, 29 deletions
diff --git a/modules/database/db_atheme.cpp b/modules/database/db_atheme.cpp index 525173613..fccef4b36 100644 --- a/modules/database/db_atheme.cpp +++ b/modules/database/db_atheme.cpp @@ -9,7 +9,6 @@ * Based on the original code of Services by Andy Church. */ -#include <functional> #include "module.h" #include "modules/botserv/badwords.h" diff --git a/modules/nickserv/ns_group.cpp b/modules/nickserv/ns_group.cpp index e1cd7e46f..d84b8b703 100644 --- a/modules/nickserv/ns_group.cpp +++ b/modules/nickserv/ns_group.cpp @@ -312,6 +312,7 @@ public: CommandNSGList(Module *creator) : Command(creator, "nickserv/glist", 0, 1) { this->SetDesc(_("Lists all nicknames in your group")); + this->SetSyntax(_("[\037nickname\037]"), [](auto &source) { return source.IsServicesOper(); }); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -372,29 +373,22 @@ public: bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { + this->SendSyntax(source); if (source.IsServicesOper()) { source.Reply(_( - "Syntax: \002%s [\037nickname\037]\002" - "\n\n" - "Without a parameter, lists all nicknames that are in " - "your group." - "\n\n" - "With a parameter, lists all nicknames that are in the " - "group of the given nick." - "\n\n" - "Specifying a nick is limited to \002Services Operators\002." - ), - source.command.c_str()); + "Without a parameter, lists all nicknames that are in " + "your group." + "\n\n" + "With a parameter, lists all nicknames that are in the " + "group of the given nick." + "\n\n" + "Specifying a nick is limited to \002Services Operators\002." + )); } else { - source.Reply(_( - "Syntax: \002%s\002" - "\n\n" - "Lists all nicks in your group." - ), - source.command.c_str()); + source.Reply(_("Lists all nicks in your group.")); } return true; diff --git a/modules/nickserv/ns_logout.cpp b/modules/nickserv/ns_logout.cpp index c0095e95d..a5a6a2714 100644 --- a/modules/nickserv/ns_logout.cpp +++ b/modules/nickserv/ns_logout.cpp @@ -20,7 +20,7 @@ public: CommandNSLogout(Module *creator) : Command(creator, "nickserv/logout", 0, 2) { this->SetDesc(_("Reverses the effect of the IDENTIFY command")); - this->SetSyntax(_("[\037nickname\037 [REVALIDATE]]")); + this->SetSyntax(_("[\037nickname\037 [REVALIDATE]]"), [](auto &source) { return source.IsServicesOper(); }); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -64,17 +64,28 @@ public: { this->SendSyntax(source); source.Reply(" "); - source.Reply(_( - "Without a parameter, reverses the effect of the \002IDENTIFY\002 " - "command, i.e. make you not recognized as the real owner of the nick " - "anymore. Note, however, that you won't be asked to reidentify " - "yourself." - "\n\n" - "With a parameter, does the same for the given nick. If you " - "specify \002REVALIDATE\002 as well, services will ask the given nick " - "to re-identify. This is limited to \002Services Operators\002." - )); + if (source.IsServicesOper()) + { + source.Reply(_( + "Without a parameter, reverses the effect of the \002IDENTIFY\002 " + "command, i.e. make you not recognized as the real owner of the nick " + "anymore. Note, however, that you won't be asked to reidentify " + "yourself." + "\n\n" + "With a parameter, does the same for the given nick. If you " + "specify \002REVALIDATE\002 as well, services will ask the given nick " + "to re-identify. This is limited to \002Services Operators\002." + )); + } + else + { + source.Reply(_( + "Reverses the effect of the \002IDENTIFY\002 command, i.e. make you not " + "recognized as the real owner of the nick anymore. Note, however, that " + "you won't be asked to reidentify yourself." + )); + } return true; } }; |