Skip to content
Snippets Groups Projects
Commit 2adfe6a2 authored by mcmlxxix's avatar mcmlxxix
Browse files

do not attempt to process empty command strings. don't attempt to process...

do not attempt to process empty command strings. don't attempt to process commands for modules that are not enabled in a given channel.
parent 4f7556ab
No related branches found
No related tags found
No related merge requests found
......@@ -620,35 +620,25 @@ Server_Commands["PRIVMSG"] = function (srv,cmd,onick,ouh) {
cmd=parse_cmd_prefix(cmd);
if(!cmd) return false;
if(cmd[0].length == 0) {
srv.o(chan.name,"Type '" + get_cmd_prefix() + "HELP' for a list of commands.");
return false;
}
/* check main bot commands */
srv.bot_command(srv,Bot_Commands,chan.name,onick,ouh,cmd.join(" "));
try
srv.bot_command(srv,Bot_Commands,chan.name,onick,ouh,cmd.join(" "));
catch(e)
srv.o(chan.name,e);
for(var m in Modules) {
var module=Modules[m];
if(!module || !module.enabled) continue;
if(!chan.modules[m]) {
/* check for modules matching the command string */
if(cmd[0].toUpperCase() == m) {
cmd.shift();
if(!cmd.length > 0) {
srv.o(chan.name,"You must specify a module command","NOTICE");
return;
}
try {
srv.bot_command(srv,module.Bot_Commands,chan.name,onick,ouh,cmd.join(" "));
} catch(e) {
srv.o(chan.name,m.toLowerCase() + " bot_command error: " + e,"NOTICE");
module.enabled=false;
}
return;
}
/* check active modules */
} else {
if(chan.modules[m]) {
try {
srv.bot_command(srv,module.Bot_Commands,chan.name,onick,ouh,cmd.join(" "));
} catch(e) {
srv.o(chan.name,m.toLowerCase() + " bot_command error: " + e,"NOTICE");
srv.o(chan.name,m.toLowerCase() + " bot command error: " + e,"NOTICE");
module.enabled=false;
}
}
......@@ -672,7 +662,7 @@ Server_Commands["PRIVMSG"] = function (srv,cmd,onick,ouh) {
try {
srv.bot_command(srv,module.Bot_Commands,onick,onick,ouh,cmd.join(" "));
} catch(e) {
srv.o(onick,m.toLowerCase() + " bot_command error: " + e,"NOTICE");
srv.o(onick,m.toLowerCase() + " bot command error: " + e,"NOTICE");
module.enabled=false;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment