20 for (
unsigned i = 0; i <
Config->CommandGroups.size(); ++i)
33 this->
SetDesc(
_(
"Displays this list and give information about commands"));
45 const BotInfo *bi = source.service;
47 bool hide_privileged_commands =
Config->GetBlock(
"options")->Get<
bool>(
"hideprivilegedcommands"),
48 hide_registered_commands =
Config->GetBlock(
"options")->Get<
bool>(
"hideregisteredcommands");
50 if (params.empty() || params[0].equals_ci(
"ALL"))
52 bool all = !params.empty() && params[0].equals_ci(
"ALL");
53 typedef std::map<CommandGroup *, std::list<Anope::string> > GroupInfo;
57 source.Reply(
_(
"All available commands for \002%s\002:"), source.service->nick.c_str());
59 for (CommandInfo::map::const_iterator it = map.begin(), it_end = map.end(); it != it_end; ++it)
70 if (cmd != it->first && map.count(cmd))
88 groups[gr].push_back(c_name);
93 source.command = c_name;
98 for (GroupInfo::iterator it = groups.begin(), it_end = groups.end(); it != it_end; ++it)
106 for (std::list<Anope::string>::iterator it2 = it->second.begin(), it2_end = it->second.end(); it2 != it2_end; ++it2)
110 buf +=
", " + c_name;
127 source.Reply(
_(
"Use the \002%s ALL\002 command to list all commands and their descriptions."), source_command.
c_str());
133 for (
unsigned max = params.size(); max > 0; --max)
136 for (
unsigned i = 0; i < max; ++i)
137 full_command +=
" " + params[i];
140 CommandInfo::map::const_iterator it = map.find(full_command);
155 const Anope::string &subcommand = params.size() > max ? params[max] :
"";
156 source.command = full_command;
157 if (!c->
OnHelp(source, subcommand))
166 source.Reply(
_(
"Access to this command requires the permission \002%s\002 to be present in your opertype."), info.
permission.
c_str());
172 source.Reply(
_(
"You need to be identified to use this command."));
177 source.Reply(
_(
"You cannot use this command."));
184 source.Reply(
_(
"No help available for \002%s\002."), params[0].c_str());
Help(const Anope::string &modname, const Anope::string &creator)
CommandHelp(Module *creator)
void AllowUnregistered(bool b)
CommandInfo::map commands
static CommandGroup * FindGroup(const Anope::string &name)
#define FOREACH_RESULT(ename, ret, args)
void SetDesc(const Anope::string &d)
virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand)
#define FOREACH_MOD(ename, args)
iterator erase(const iterator &i)
string substr(size_type pos=0, size_type n=npos) const
static const unsigned help_wrap_len
void Execute(CommandSource &source, const std::vector< Anope::string > ¶ms) anope_override
Anope::string description
bool AllowUnregistered() const
virtual void OnServHelp(CommandSource &source)
bool GetToken(Anope::string &token)
const char * c_str() const