diff options
author | Adam <Adam@anope.org> | 2011-08-07 16:04:40 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-08-07 16:04:40 -0400 |
commit | 35588cc521cb0ea8c15b0bde3d2543ada9db3751 (patch) | |
tree | a4c6a99a485a9c22e294e7060baf73df143e9ebf /src/bots.cpp | |
parent | 32bb63f0478b0fc91295d31bf5de794dfe49313a (diff) |
Made botserv bots with no commands just ignore messages to them, and made bots only tell users to use HELP if they have a HELP command
Diffstat (limited to 'src/bots.cpp')
-rw-r--r-- | src/bots.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/bots.cpp b/src/bots.cpp index bff2adac8..2ebe4bb58 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -201,7 +201,11 @@ void BotInfo::Part(Channel *c, const Anope::string &reason) void BotInfo::OnMessage(User *u, const Anope::string &message) { + if (this->commands.empty()) + return; + std::vector<Anope::string> params = BuildStringVector(message); + bool has_help = this->commands.find("HELP") != this->commands.end(); BotInfo::command_map::iterator it = this->commands.end(); unsigned count = 0; @@ -218,7 +222,10 @@ void BotInfo::OnMessage(User *u, const Anope::string &message) if (it == this->commands.end()) { - u->SendMessage(this, _("Unknown command \002%s\002. \"%s%s HELP\" for help."), message.c_str(), Config->UseStrictPrivMsgString.c_str(), this->nick.c_str()); + if (has_help) + u->SendMessage(this, _("Unknown command \002%s\002. \"%s%s HELP\" for help."), message.c_str(), Config->UseStrictPrivMsgString.c_str(), this->nick.c_str()); + else + u->SendMessage(this, _("Unknown command \002%s\002."), message.c_str()); return; } @@ -226,7 +233,10 @@ void BotInfo::OnMessage(User *u, const Anope::string &message) service_reference<Command> c(info.name); if (!c) { - u->SendMessage(this, _("Unknown command \002%s\002. \"%s%s HELP\" for help."), message.c_str(), Config->UseStrictPrivMsgString.c_str(), this->nick.c_str()); + if (has_help) + u->SendMessage(this, _("Unknown command \002%s\002. \"%s%s HELP\" for help."), message.c_str(), Config->UseStrictPrivMsgString.c_str(), this->nick.c_str()); + else + u->SendMessage(this, _("Unknown command \002%s\002."), message.c_str()); Log(this) << "Command " << it->first << " exists on me, but its service " << info.name << " was not found!"; return; } |