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

simplified module template

parent 7b721962
Branches
Tags
No related merge requests found
...@@ -20,13 +20,13 @@ ...@@ -20,13 +20,13 @@
*/ */
this.Bot_Commands["WHOIS"] = new Bot_Command(0,false,false); Bot_Commands["WHOIS"] = new Bot_Command(0,false,false);
this.Bot_Commands["WHOIS"].usage = Bot_Commands["WHOIS"].usage =
get_cmd_prefix() + "WHOIS <nick>"; get_cmd_prefix() + "WHOIS <nick>";
this.Bot_Commands["WHOIS"].help = Bot_Commands["WHOIS"].help =
"Brings up information about a user. If the <nick> argument is omitted, " "Brings up information about a user. If the <nick> argument is omitted, "
+ "then it will display information about you."; + "then it will display information about you.";
this.Bot_Commands["WHOIS"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["WHOIS"].command = function (target,onick,ouh,srv,lvl,cmd) {
if (!cmd[1]) { if (!cmd[1]) {
srv.o(target,"You are recognized as access level " + lvl); srv.o(target,"You are recognized as access level " + lvl);
cmd[1] = onick; cmd[1] = onick;
...@@ -48,12 +48,12 @@ this.Bot_Commands["WHOIS"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -48,12 +48,12 @@ this.Bot_Commands["WHOIS"].command = function (target,onick,ouh,srv,lvl,cmd) {
return; return;
} }
this.Bot_Commands["ADDMASK"] = new Bot_Command(50,1,false); Bot_Commands["ADDMASK"] = new Bot_Command(50,1,false);
this.Bot_Commands["ADDMASK"].usage = Bot_Commands["ADDMASK"].usage =
get_cmd_prefix() + "ADDMASK <nick> <user>@<host>"; get_cmd_prefix() + "ADDMASK <nick> <user>@<host>";
this.Bot_Commands["ADDMASK"].help = Bot_Commands["ADDMASK"].help =
"Stores information used by the bot to identify you."; "Stores information used by the bot to identify you.";
this.Bot_Commands["ADDMASK"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["ADDMASK"].command = function (target,onick,ouh,srv,lvl,cmd) {
var addmask = false; var addmask = false;
var delmask = false; var delmask = false;
if (cmd[0] == "ADDMASK") { if (cmd[0] == "ADDMASK") {
...@@ -116,10 +116,10 @@ this.Bot_Commands["ADDMASK"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -116,10 +116,10 @@ this.Bot_Commands["ADDMASK"].command = function (target,onick,ouh,srv,lvl,cmd) {
} }
return; return;
} }
this.Bot_Commands["DELMASK"] = this.Bot_Commands["ADDMASK"]; Bot_Commands["DELMASK"] = Bot_Commands["ADDMASK"];
this.Bot_Commands["ADDUSER"] = new Bot_Command(80,2,false); Bot_Commands["ADDUSER"] = new Bot_Command(80,2,false);
this.Bot_Commands["ADDUSER"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["ADDUSER"].command = function (target,onick,ouh,srv,lvl,cmd) {
if (IRC_check_nick(cmd[1],40)) { if (IRC_check_nick(cmd[1],40)) {
srv.o(target,cmd[1] + " isn't a valid nickname."); srv.o(target,cmd[1] + " isn't a valid nickname.");
return; return;
...@@ -186,13 +186,13 @@ this.Bot_Commands["ADDUSER"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -186,13 +186,13 @@ this.Bot_Commands["ADDUSER"].command = function (target,onick,ouh,srv,lvl,cmd) {
return; return;
} }
this.Bot_Commands["CHANGE"] = new Bot_Command(80,2,false); Bot_Commands["CHANGE"] = new Bot_Command(80,2,false);
this.Bot_Commands["CHANGE"].usage = Bot_Commands["CHANGE"].usage =
get_cmd_prefix() + "CHANGE <nick> <security_level>"; get_cmd_prefix() + "CHANGE <nick> <security_level>";
this.Bot_Commands["CHANGE"].help = Bot_Commands["CHANGE"].help =
"Allows you to change the security level of users with a lower level " + "Allows you to change the security level of users with a lower level " +
"than you up to, but not including yours."; "than you up to, but not including yours.";
this.Bot_Commands["CHANGE"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["CHANGE"].command = function (target,onick,ouh,srv,lvl,cmd) {
var usr = new User(system.matchuser(cmd[1])); var usr = new User(system.matchuser(cmd[1]));
if (usr.number == 0) { if (usr.number == 0) {
srv.o(target,"The user " + cmd[1] + " doesn't exist in my database."); srv.o(target,"The user " + cmd[1] + " doesn't exist in my database.");
...@@ -215,8 +215,8 @@ this.Bot_Commands["CHANGE"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -215,8 +215,8 @@ this.Bot_Commands["CHANGE"].command = function (target,onick,ouh,srv,lvl,cmd) {
return; return;
} }
this.Bot_Commands["RESETPASS"] = new Bot_Command(90,true,false); Bot_Commands["RESETPASS"] = new Bot_Command(90,true,false);
this.Bot_Commands["RESETPASS"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["RESETPASS"].command = function (target,onick,ouh,srv,lvl,cmd) {
var usr = new User(system.matchuser(cmd[1])); var usr = new User(system.matchuser(cmd[1]));
if (usr.number > 0) { if (usr.number > 0) {
srv.o(target,usr.alias + "'s password has been reset. " srv.o(target,usr.alias + "'s password has been reset. "
...@@ -230,8 +230,8 @@ this.Bot_Commands["RESETPASS"].command = function (target,onick,ouh,srv,lvl,cmd) ...@@ -230,8 +230,8 @@ this.Bot_Commands["RESETPASS"].command = function (target,onick,ouh,srv,lvl,cmd)
return; return;
} }
this.Bot_Commands["PASS"] = new Bot_Command(50,true,false); Bot_Commands["PASS"] = new Bot_Command(50,true,false);
this.Bot_Commands["PASS"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["PASS"].command = function (target,onick,ouh,srv,lvl,cmd) {
if ((target[0] == "#") || (target[0] == "&")) { if ((target[0] == "#") || (target[0] == "&")) {
srv.o(target,"Fool! I'm not setting your password to something " srv.o(target,"Fool! I'm not setting your password to something "
+ "you broadcast in a public channel. Pick a new password and " + "you broadcast in a public channel. Pick a new password and "
...@@ -263,12 +263,12 @@ this.Bot_Commands["PASS"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -263,12 +263,12 @@ this.Bot_Commands["PASS"].command = function (target,onick,ouh,srv,lvl,cmd) {
return; return;
} }
this.Bot_Commands["IDENT"] = new Bot_Command(0,true,false); Bot_Commands["IDENT"] = new Bot_Command(0,true,false);
this.Bot_Commands["IDENT"].usage = Bot_Commands["IDENT"].usage =
"/MSG %s IDENT <nick> <pass>"; "/MSG %s IDENT <nick> <pass>";
this.Bot_Commands["IDENT"].help = Bot_Commands["IDENT"].help =
"Identifies a user by alias and password. Use via private message only."; "Identifies a user by alias and password. Use via private message only.";
this.Bot_Commands["IDENT"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["IDENT"].command = function (target,onick,ouh,srv,lvl,cmd) {
var usr = new User(system.matchuser(onick)); var usr = new User(system.matchuser(onick));
if (cmd[2]) { /* Username passed */ if (cmd[2]) { /* Username passed */
usr = new User(system.matchuser(cmd[1])); usr = new User(system.matchuser(cmd[1]));
...@@ -306,8 +306,8 @@ this.Bot_Commands["IDENT"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -306,8 +306,8 @@ this.Bot_Commands["IDENT"].command = function (target,onick,ouh,srv,lvl,cmd) {
return; return;
} }
this.Bot_Commands["EVAL"] = new Bot_Command(0,true,false); Bot_Commands["EVAL"] = new Bot_Command(0,true,false);
this.Bot_Commands["EVAL"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["EVAL"].command = function (target,onick,ouh,srv,lvl,cmd) {
var query = ""; var query = "";
var usr = new User(system.matchuser(onick)); var usr = new User(system.matchuser(onick));
...@@ -340,8 +340,8 @@ this.Bot_Commands["EVAL"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -340,8 +340,8 @@ this.Bot_Commands["EVAL"].command = function (target,onick,ouh,srv,lvl,cmd) {
return; return;
} }
this.Bot_Commands["SEVAL"] = new Bot_Command(99,true,true); Bot_Commands["SEVAL"] = new Bot_Command(99,true,true);
this.Bot_Commands["SEVAL"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["SEVAL"].command = function (target,onick,ouh,srv,lvl,cmd) {
cmd.shift(); cmd.shift();
var query = cmd.join(" "); var query = cmd.join(" ");
try { try {
...@@ -352,8 +352,8 @@ this.Bot_Commands["SEVAL"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -352,8 +352,8 @@ this.Bot_Commands["SEVAL"].command = function (target,onick,ouh,srv,lvl,cmd) {
return; return;
} }
this.Bot_Commands["GROUPS"] = new Bot_Command(50,true,false); Bot_Commands["GROUPS"] = new Bot_Command(50,true,false);
this.Bot_Commands["GROUPS"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["GROUPS"].command = function (target,onick,ouh,srv,lvl,cmd) {
for (g in msg_area.grp_list) { for (g in msg_area.grp_list) {
srv.o(target,"[" + msg_area.grp_list[g].number + "] " srv.o(target,"[" + msg_area.grp_list[g].number + "] "
+ msg_area.grp_list[g].description); + msg_area.grp_list[g].description);
...@@ -361,8 +361,8 @@ this.Bot_Commands["GROUPS"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -361,8 +361,8 @@ this.Bot_Commands["GROUPS"].command = function (target,onick,ouh,srv,lvl,cmd) {
return; return;
} }
this.Bot_Commands["SUBS"] = new Bot_Command(50,true,false); Bot_Commands["SUBS"] = new Bot_Command(50,true,false);
this.Bot_Commands["SUBS"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["SUBS"].command = function (target,onick,ouh,srv,lvl,cmd) {
var groupnum = parseInt(cmd[1]); var groupnum = parseInt(cmd[1]);
if (!msg_area.grp_list[groupnum]) { if (!msg_area.grp_list[groupnum]) {
srv.o(target,"Group number " + cmd[1] + " doesn't exist!"); srv.o(target,"Group number " + cmd[1] + " doesn't exist!");
...@@ -375,10 +375,10 @@ this.Bot_Commands["SUBS"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -375,10 +375,10 @@ this.Bot_Commands["SUBS"].command = function (target,onick,ouh,srv,lvl,cmd) {
} }
return; return;
} }
this.Bot_Commands["SUBGROUPS"] = this.Bot_Commands["SUBS"]; Bot_Commands["SUBGROUPS"] = Bot_Commands["SUBS"];
this.Bot_Commands["READ"] = new Bot_Command(50,true,false); Bot_Commands["READ"] = new Bot_Command(50,true,false);
this.Bot_Commands["READ"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["READ"].command = function (target,onick,ouh,srv,lvl,cmd) {
if (!cmd[2]) { // user wants to list msgs? if (!cmd[2]) { // user wants to list msgs?
var msgs = new MsgBase(cmd[1]); var msgs = new MsgBase(cmd[1]);
if(!msgs) { if(!msgs) {
...@@ -414,8 +414,8 @@ this.Bot_Commands["READ"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -414,8 +414,8 @@ this.Bot_Commands["READ"].command = function (target,onick,ouh,srv,lvl,cmd) {
return; return;
} }
this.Bot_Commands["FINGER"] = new Bot_Command(50,true,false); Bot_Commands["FINGER"] = new Bot_Command(50,true,false);
this.Bot_Commands["FINGER"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["FINGER"].command = function (target,onick,ouh,srv,lvl,cmd) {
var udpfinger = false; var udpfinger = false;
if (cmd[0] == "UDPFINGER") if (cmd[0] == "UDPFINGER")
udpfinger = true; udpfinger = true;
...@@ -480,10 +480,10 @@ this.Bot_Commands["FINGER"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -480,10 +480,10 @@ this.Bot_Commands["FINGER"].command = function (target,onick,ouh,srv,lvl,cmd) {
} }
return; return;
} }
this.Bot_Commands["UDPFINGER"] = this.Bot_Commands["FINGER"]; Bot_Commands["UDPFINGER"] = Bot_Commands["FINGER"];
this.Bot_Commands["EXEC"] = new Bot_Command(99,true,true); Bot_Commands["EXEC"] = new Bot_Command(99,true,true);
this.Bot_Commands["EXEC"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["EXEC"].command = function (target,onick,ouh,srv,lvl,cmd) {
cmd.shift(); cmd.shift();
var query = cmd.join(" "); var query = cmd.join(" ");
var this_poutput = system.popen(query); var this_poutput = system.popen(query);
...@@ -499,8 +499,8 @@ this.Bot_Commands["EXEC"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -499,8 +499,8 @@ this.Bot_Commands["EXEC"].command = function (target,onick,ouh,srv,lvl,cmd) {
return; return;
} }
this.Bot_Commands["ADDQUOTE"] = new Bot_Command(80,true,false); Bot_Commands["ADDQUOTE"] = new Bot_Command(80,true,false);
this.Bot_Commands["ADDQUOTE"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["ADDQUOTE"].command = function (target,onick,ouh,srv,lvl,cmd) {
cmd.shift(); cmd.shift();
var the_quote = cmd.join(" "); var the_quote = cmd.join(" ");
quotes.push(the_quote); quotes.push(the_quote);
...@@ -508,8 +508,8 @@ this.Bot_Commands["ADDQUOTE"].command = function (target,onick,ouh,srv,lvl,cmd) ...@@ -508,8 +508,8 @@ this.Bot_Commands["ADDQUOTE"].command = function (target,onick,ouh,srv,lvl,cmd)
return; return;
} }
this.Bot_Commands["QUOTE"] = new Bot_Command(0,false,false); Bot_Commands["QUOTE"] = new Bot_Command(0,false,false);
this.Bot_Commands["QUOTE"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["QUOTE"].command = function (target,onick,ouh,srv,lvl,cmd) {
if (cmd[1]) { if (cmd[1]) {
cmd.shift(); cmd.shift();
var searched_quotes = new Object(); var searched_quotes = new Object();
...@@ -532,8 +532,8 @@ this.Bot_Commands["QUOTE"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -532,8 +532,8 @@ this.Bot_Commands["QUOTE"].command = function (target,onick,ouh,srv,lvl,cmd) {
return; return;
} }
this.Bot_Commands["SAY"] = new Bot_Command(80,true,false); Bot_Commands["SAY"] = new Bot_Command(80,true,false);
this.Bot_Commands["SAY"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["SAY"].command = function (target,onick,ouh,srv,lvl,cmd) {
cmd.shift(); cmd.shift();
var say_target = cmd.shift(); var say_target = cmd.shift();
if ( (say_target[0] != "#") && (say_target[0] != "&") if ( (say_target[0] != "#") && (say_target[0] != "&")
...@@ -546,8 +546,8 @@ this.Bot_Commands["SAY"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -546,8 +546,8 @@ this.Bot_Commands["SAY"].command = function (target,onick,ouh,srv,lvl,cmd) {
return; return;
} }
this.Bot_Commands["LASTSPOKE"] = new Bot_Command(0,false,false); Bot_Commands["LASTSPOKE"] = new Bot_Command(0,false,false);
this.Bot_Commands["LASTSPOKE"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["LASTSPOKE"].command = function (target,onick,ouh,srv,lvl,cmd) {
if (!cmd[1]) { if (!cmd[1]) {
srv.o(target,"You spoke just now, chief."); srv.o(target,"You spoke just now, chief.");
return; return;
...@@ -564,8 +564,8 @@ this.Bot_Commands["LASTSPOKE"].command = function (target,onick,ouh,srv,lvl,cmd) ...@@ -564,8 +564,8 @@ this.Bot_Commands["LASTSPOKE"].command = function (target,onick,ouh,srv,lvl,cmd)
return; return;
} }
this.Bot_Commands["FORCE"] = new Bot_Command(90,true,true) Bot_Commands["FORCE"] = new Bot_Command(90,true,true)
this.Bot_Commands["FORCE"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["FORCE"].command = function (target,onick,ouh,srv,lvl,cmd) {
cmd.shift(); cmd.shift();
if(!cmd[0] || !cmd[1]) { if(!cmd[0] || !cmd[1]) {
srv.o(target,"Invalid arguments."); srv.o(target,"Invalid arguments.");
...@@ -579,8 +579,8 @@ this.Bot_Commands["FORCE"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -579,8 +579,8 @@ this.Bot_Commands["FORCE"].command = function (target,onick,ouh,srv,lvl,cmd) {
srv.check_bot_command(target,onick,srv.users[onick.toUpperCase()].uh,cmd.join(" ")); srv.check_bot_command(target,onick,srv.users[onick.toUpperCase()].uh,cmd.join(" "));
} }
this.Bot_Commands["DEBUG"] = new Bot_Command(99,true,true); Bot_Commands["DEBUG"] = new Bot_Command(99,true,true);
this.Bot_Commands["DEBUG"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["DEBUG"].command = function (target,onick,ouh,srv,lvl,cmd) {
cmd.shift(); cmd.shift();
var data=eval(cmd.join(" ")); var data=eval(cmd.join(" "));
var str=debug_trace(data,1).split("\r\n"); var str=debug_trace(data,1).split("\r\n");
...@@ -588,8 +588,8 @@ this.Bot_Commands["DEBUG"].command = function (target,onick,ouh,srv,lvl,cmd) { ...@@ -588,8 +588,8 @@ this.Bot_Commands["DEBUG"].command = function (target,onick,ouh,srv,lvl,cmd) {
return; return;
} }
this.Bot_Commands["OBJKEYS"] = new Bot_Command(99,true,true); Bot_Commands["OBJKEYS"] = new Bot_Command(99,true,true);
this.Bot_Commands["OBJKEYS"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["OBJKEYS"].command = function (target,onick,ouh,srv,lvl,cmd) {
cmd.shift(); cmd.shift();
cmdline=cmd.join(" "); cmdline=cmd.join(" ");
var data=eval(cmdline); var data=eval(cmdline);
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
*/ */
/********** Command Processors. **********/ /********** Command Processors. **********/
this.Server_command=function(srv,cmdline,onick,ouh) { function Server_command(srv,cmdline,onick,ouh) {
var cmd=IRC_parsecommand(cmdline); var cmd=IRC_parsecommand(cmdline);
switch (cmd[0]) { switch (cmd[0]) {
case "PRIVMSG": case "PRIVMSG":
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
if there are duplicate command names, they will be superseded in the order if there are duplicate command names, they will be superseded in the order
in which they are loaded (in the order they are listed in ircbot.ini). in which they are loaded (in the order they are listed in ircbot.ini).
*/ */
var working_dir=this.dir; working_dir=this.dir;
/* This method is executed by the IRCBot during its "save_everything()" cycle */ /* This method is executed by the IRCBot during its "save_everything()" cycle */
this.save=function() function save()
{ {
//var s_file=new File(working_dir + "file.ini"); //var s_file=new File(working_dir + "file.ini");
//if(!s_file.open(file_exists(s_file.name)?"r+":"w+")) return false; //if(!s_file.open(file_exists(s_file.name)?"r+":"w+")) return false;
...@@ -21,7 +21,7 @@ this.save=function() ...@@ -21,7 +21,7 @@ this.save=function()
//s_file.close(); //s_file.close();
} }
/* This method is executed by the IRCBot during its "main()" loop, once per cycle (DO NOT MAKE A LOOP) */ /* This method is executed by the IRCBot during its "main()" loop, once per cycle (DO NOT MAKE A LOOP) */
this.main=function(srv) function main(srv)
{ {
/* Do some work here. /* Do some work here.
You can use a timer to time events or process scores. You can use a timer to time events or process scores.
......
this.Bot_Commands["ROLL"] = new Bot_Command(0,false,false); Bot_Commands["ROLL"] = new Bot_Command(0,false,false);
this.Bot_Commands["ROLL"].usage = Bot_Commands["ROLL"].usage =
get_cmd_prefix() + "ROLL <num_dice>d<num_sides>"; get_cmd_prefix() + "ROLL <num_dice>d<num_sides>";
this.Bot_Commands["ROLL"].help = Bot_Commands["ROLL"].help =
"This is the command used to roll dice."; "This is the command used to roll dice.";
this.Bot_Commands["ROLL"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["ROLL"].command = function (target,onick,ouh,srv,lvl,cmd) {
cmd.shift(); cmd.shift();
var num_dice; var num_dice;
var sides_per_die; var sides_per_die;
var totals=[];
var die_max=100000;
var roll_max=10;
if(!cmd[0]) { if(!cmd[0]) {
/* If no arguments are supplied, assume a roll of two six-sided dice. */ /* If no arguments are supplied, assume a roll of two six-sided dice. */
num_dice=2; num_dice=2;
sides_per_die=6; sides_per_die=6;
totals.push(roll_them_dice(num_dice,sides_per_die));
} else { } else {
var args=cmd[0].toUpperCase().split("D"); var rolls=0;
num_dice=args[0]; while(cmd.length && rolls<roll_max){
sides_per_die=args[1]; var args=cmd.shift().toUpperCase().split("D");
num_dice=js.eval(args[0]);
sides_per_die=js.eval(args[1]);
if(!num_dice>0 || !sides_per_die>0) {
srv.o(target,"Invalid arguments.");
return;
}
if(num_dice>die_max || sides_per_die>die_max) {
srv.o(target,"I think not, sir.");
return;
}
totals.push(roll_them_dice(num_dice,sides_per_die));
rolls++;
}
} }
if(!num_dice>0 || !sides_per_die>0) { srv.o(target,onick + " rolled: " + totals.join(", "));
srv.o(target,"Invalid arguments.");
return;
}
var total=roll_them_dice(num_dice,sides_per_die);
srv.o(target,onick + " rolled: " + total);
return; return;
} }
this.Bot_Commands["DICE"] = new Bot_Command(0,false,false); Bot_Commands["DICE"] = new Bot_Command(0,false,false);
this.Bot_Commands["DICE"].help = Bot_Commands["DICE"].help =
"To roll some dice, type '" + get_cmd_prefix() + "ROLL <num_dice>d<num_sides>'. " + "To roll some dice, type '" + get_cmd_prefix() + "ROLL <num_dice>d<num_sides>'. " +
"For a full list of commands, type '" + get_cmd_prefix() + "HELP'."; "For a full list of commands, type '" + get_cmd_prefix() + "HELP'.";
this.Bot_Commands["DICE"].command = function (target,onick,ouh,srv,lvl,cmd) { Bot_Commands["DICE"].command = function (target,onick,ouh,srv,lvl,cmd) {
srv.o(target,"Help: " + this.help); srv.o(target,"Help: " + this.help);
return; return;
} }
......
/* IRC Bot Module - Server Commands /* IRC Bot Module - Server Commands
You would place all of your module functions in this file. */ You would place all of your module functions in this file. */
this.Server_command=function(srv,cmdline,onick,ouh) function Server_command(srv,cmdline,onick,ouh)
{ {
var cmd=IRC_parsecommand(cmdline); var cmd=IRC_parsecommand(cmdline);
switch (cmd[0]) { switch (cmd[0]) {
case "JOIN":
if (onick == srv.curnick) break;
// Someone else joining? Let's send them a private welcome message!
srv.o(onick,"Welcome to the DiceBot show!");
srv.o(onick,"This is a module for IRCBot - by Cyan");
break;
case "PRIVMSG": case "PRIVMSG":
if ((cmd[1][0] == "#") || (cmd[1][0] == "&")) { if ((cmd[1][0] == "#") || (cmd[1][0] == "&")) {
var chan = srv.channel[cmd[1].toUpperCase()]; var chan = srv.channel[cmd[1].toUpperCase()];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment