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

added module enabling/disabling, module list

parent 67abf70a
No related branches found
No related tags found
No related merge requests found
...@@ -202,3 +202,46 @@ Bot_Commands["PREFIX"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -202,3 +202,46 @@ Bot_Commands["PREFIX"].command = function (target,onick,ouh,srv,lvl,cmd) {
return; return;
} }
Bot_Commands["ENABLE"] = new Bot_Command(80,true,false);
Bot_Commands["ENABLE"].command = function (target,onick,ouh,srv,lvl,cmd) {
cmd.shift();
var mod=Modules[cmd[0].toUpperCase()];
if (mod) {
if(!mod.enabled) {
mod.enabled=true;
srv.o(target,cmd[0].toUpperCase() + " module enabled.");
} else {
srv.o(target,cmd[0].toUpperCase() + " module is already enabled.");
}
} else {
srv.o(target,"No such module.");
}
return;
}
Bot_Commands["DISABLE"] = new Bot_Command(80,true,false);
Bot_Commands["DISABLE"].command = function (target,onick,ouh,srv,lvl,cmd) {
cmd.shift();
var mod=Modules[cmd[0].toUpperCase()];
if (mod) {
if(mod.enabled) {
mod.enabled=false;
srv.o(target,cmd[0].toUpperCase() + " module disabled.");
} else {
srv.o(target,cmd[0].toUpperCase() + " module is already disabled.");
}
} else {
srv.o(target,"No such module.");
}
return;
}
Bot_Commands["MODULES"] = new Bot_Command(0,false,false);
Bot_Commands["MODULES"].command = function (target,onick,ouh,srv,lvl,cmd) {
var str="Modules: ";
for(m in Modules) {
str+=m+"("+(Modules[m].enabled?"ENABLED":"DISABLED")+") ";
}
srv.o(target,str);
return;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment