forked from robotunicr0n/twitch-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.min.js
More file actions
91 lines (82 loc) · 29.6 KB
/
bot.min.js
File metadata and controls
91 lines (82 loc) · 29.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* Twitch Chat Commands
/timeout <username> <time in seconds> -Times out the specified user for x number of seconds
/timeout <username> – times out the selected user for ten minutes
/timeout <username> 1 – purges the chat of the user. (Actually it times out the user for one second.)
/ban <username> – Bans the specified username
/mods – Calls up list of channel moderators
/slow – Turns slow mode on. I would prefer to be the only one using this command.
/slowoff – Turns slow mode off.
/clear – Clears the chat. We try to use this command sparingly and opt for the ‘purge' command.
**************** IRC Shit ******************
https://node-irc.readthedocs.org/en/latest/API.html#client
*/
function adminCheck(e){for(var t=0;t<settings.admins.length;t++)if(admins[t]===e)return!0
return!1}function noMoreLinks(e){bot.say(e,"/me is no longer accepting links from "+settings[e.substr(1)].allowing),settings[e.substr(1)].allowing=""}function sendAdminMsg(e){console.log("Sending Admin Message. Viewers: "+settings[e.substr(1)].viewers),bot.say(e,settings.adminMsgs[settings[e.substr(1)].msgCount].replace(/{CHANNEL}/g,e.substr(1).toUpperCase())),settings[e.substr(1)].msgCount++,console.log("Admin Msgs:",settings.adminMsgs.length,"count:",settings[e.substr(1)].msgCount),settings[e.substr(1)].msgCount==settings.adminMsgs.length&&(settings[e.substr(1)].msgCount=0)}function textScan(e,t,s){for(var o,a=0;a<settings.botNick.length;a++){var o=e.toLowerCase().match(settings.botNick[a])
if(null!=o)return console.log("sending random message to "+t),void getRandomReply("misc",t,s)}swearCheck(e,t,s)}function scanForLink(e){var t=/(([a-z]+:\/\/)?(([a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|tv|local|internal|xxx))(:[0-9]{1,5})?(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-zA-Z0-9!$&'()*+.=-_~:@\/?]*)?)(\s+|$)/gi
return null!=e.match(t)&&-1==e.indexOf("youtube.com")?!1:!0}function swearCheck(e,t,s){for(var o=0;o<swears.length;o++){var a=e.match(settings.swears[o])
if(null!=a)return console.log("sending random swear"),void getRandomReply("swear",t,s)}}function getRandomReply(e,t,s){var o=""
"swear"==e?(o=settings.backtalk[Math.floor(Math.random()*settings.backtalk.length)],checkViolations(s)):"misc"==e&&(o=settings.quotes[Math.floor(Math.random()*settings.quotes.length)]),o=o.replace("{NICK}",s),bot.say(t,o)}function parseCmd(e,t,s){switch(e=e.split(" "),e[0]){case"status":getStatus(t)
break
case"creator":bot.say(t,"I am ready to meet my Maker. Whether my Maker is prepared for the ordeal of meeting me is another matter. His name is....RedSeal.")
break
case"allow":adminCheck(s)?(settings[t.substr(1)].allowing=e[1],bot.say(t,"/me is allowing links from "+e[1]+" (2min)"),setTimeout(function(){noMoreLinks(t)},12e4)):bot.say(t,"Nice try, "+s+", but I do not obey you.")
break
case"help":bot.say(t,"======================="),bot.say(t,"status - get various information"),bot.say(t,"admin - display people I listen to"),bot.say(t,"violators - display people that annoy MGbot"),bot.say(t,"allow [name]- admins only; allows user to post links"),bot.say(t,"setviewers [#] - admins only; set the viewer count to the right #"),bot.say(t,"creator - find out who the genius is behind this bad ass bot"),bot.say(t,"=========================================")
break
case"admin":for(var o="People who can control me are: ",a=0;a<admins.length;a++)o+=0==a?admins[a]:", "+admins[a]
bot.say(t,o)
break
case"violators":getViolatorsList(t)
break
case"setviewers":adminCheck(s)?(settings[t.substr(1)].viewers=e[1],bot.say(t,"I have set viewer count to "+settings[t.substr(1)].viewers),settings[t.substr(1)].viewers>=8?settings[t.substr(1)].adminMsg||(console.log("starting interval for adminMsg"),settings[t.substr(1)].adminMsg=setInterval(function(){sendAdminMsg(t)},18e5)):(clearInterval(settings[t.substr(1)].adminMsg),settings[t.substr(1)].adminMsg=!1,console.log("clearing adminMsg interval for "+t))):bot.say(t,"Nice try, "+s+", but I do not obey you.")
break
default:e[0].length>1&&bot.say(t,"I'm sorry, "+s+", but I do not understand the ["+e[0]+'] command. Try typing "!help" to get the available commands.')}}function getStatus(e){bot.say(e,"======================="),bot.say(e,"I am currently seeing the following viewers:")
for(var t=0;t<settings.channels.length;t++){var s=settings.channels[t].substr(1)
bot.say(e,s+" has "+settings[s].viewers+(1==settings[s].viewers?" viewer.":" viewers."))}bot.say(e,"=======================================")}function getViolatorsList(e){if(bot.say(e,"======================="),""!=violators){for(var t="Top 5 Violators for all MG channels are: ",s=violators.length>5?5:violators.length,o=0;s>o;o++)t+=violators[o].name+": "+violators[o].violations,o!=violators.length-1&&(t+=" | ")
bot.say(e,t)}else bot.say(e,"We have no violators, yet! Kappa")
bot.say(e,"=======================================")}function checkViolations(e){if(""==violators){var t={name:e,violations:1}
return violators.push(t),void jf.writeFileSync(file,violators)}for(var s=0;s<violators.length;s++){if(violators[s].name==e)return violators[s].violations++,violators.sort(function(e,t){return parseInt(e.violations)<parseInt(t.violations)?1:-1}),void jf.writeFileSync(file,violators)
if(s==violators.length-1){var t={name:e,violations:1}
violators.push(t),violators.sort(function(e,t){return parseInt(e.violations)<parseInt(t.violations)?1:-1}),jf.writeFileSync(file,violators)}}}function adminCheck(e){for(var t=0;t<settings.admins.length;t++)if(admins[t]===e)return!0
return!1}function noMoreLinks(e){bot.say(e,"/me is no longer accepting links from "+settings[e.substr(1)].allowing),settings[e.substr(1)].allowing=""}function sendAdminMsg(e){console.log("Sending Admin Message. Viewers: "+settings[e.substr(1)].viewers),bot.say(e,settings.adminMsgs[settings[e.substr(1)].msgCount].replace(/{CHANNEL}/g,e.substr(1).toUpperCase())),settings[e.substr(1)].msgCount++,console.log("Admin Msgs:",settings.adminMsgs.length,"count:",settings[e.substr(1)].msgCount),settings[e.substr(1)].msgCount==settings.adminMsgs.length&&(settings[e.substr(1)].msgCount=0)}function textScan(e,t,s){for(var o,a=0;a<settings.botNick.length;a++)if(o=e.toLowerCase().match(settings.botNick[a]),null!=o)return console.log("sending random message to "+t),void getRandomReply("misc",t,s)
swearCheck(e,t,s)}function scanForLink(e){return null!=e.match(/(([a-z]+:\/\/)?(([a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|tv|local|internal|xxx))(:[0-9]{1,5})?(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-zA-Z0-9!$&'()*+.=-_~:@\/?]*)?)(\s+|$)/gi)&&-1==e.indexOf("youtube.com")?!1:!0}function swearCheck(e,t,s){for(var o=0;o<swears.length;o++)if(null!=e.match(settings.swears[o])){console.log("sending random swear"),getRandomReply("swear",t,s)
break}}function getRandomReply(e,t,s){var o=""
"swear"==e?(o=settings.backtalk[Math.floor(Math.random()*settings.backtalk.length)],checkViolations(s)):"misc"==e&&(o=settings.quotes[Math.floor(Math.random()*settings.quotes.length)]),o=o.replace("{NICK}",s),bot.say(t,o)}function parseCmd(e,t,s){switch(e=e.split(" "),e[0]){case"status":getStatus(t)
break
case"creator":bot.say(t,"I am ready to meet my Maker. Whether my Maker is prepared for the ordeal of meeting me is another matter. His name is....RedSeal.")
break
case"allow":adminCheck(s)?(settings[t.substr(1)].allowing=e[1],bot.say(t,"/me is allowing links from "+e[1]+" (2min)"),setTimeout(function(){noMoreLinks(t)},12e4)):bot.say(t,"Nice try, "+s+", but I do not obey you.")
break
case"help":bot.say(t,"======================="),bot.say(t,"status - get various information"),bot.say(t,"admin - display people I listen to"),bot.say(t,"violators - display people that annoy MGbot"),bot.say(t,"allow [name]- admins only; allows user to post links"),bot.say(t,"setviewers [#] - admins only; set the viewer count to the right #"),bot.say(t,"creator - find out who the genius is behind this bad ass bot"),bot.say(t,"=========================================")
break
case"admin":for(e="People who can control me are: ",s=0;s<admins.length;s++)e+=0==s?admins[s]:", "+admins[s]
bot.say(t,e)
break
case"violators":getViolatorsList(t)
break
case"setviewers":adminCheck(s)?(settings[t.substr(1)].viewers=e[1],bot.say(t,"I have set viewer count to "+settings[t.substr(1)].viewers),8<=settings[t.substr(1)].viewers?settings[t.substr(1)].adminMsg||(console.log("starting interval for adminMsg"),settings[t.substr(1)].adminMsg=setInterval(function(){sendAdminMsg(t)},18e5)):(clearInterval(settings[t.substr(1)].adminMsg),settings[t.substr(1)].adminMsg=!1,console.log("clearing adminMsg interval for "+t))):bot.say(t,"Nice try, "+s+", but I do not obey you.")
break
default:1<e[0].length&&bot.say(t,"I'm sorry, "+s+", but I do not understand the ["+e[0]+'] command. Try typing "!help" to get the available commands.')}}function getStatus(e){bot.say(e,"======================="),bot.say(e,"I am currently seeing the following viewers:")
for(var t=0;t<settings.channels.length;t++){var s=settings.channels[t].substr(1)
bot.say(e,s+" has "+settings[s].viewers+(1==settings[s].viewers?" viewer.":" viewers."))}bot.say(e,"=======================================")}function getViolatorsList(e){if(bot.say(e,"======================="),""!=violators){for(var t="Top 5 Violators for all MG channels are: ",s=5<violators.length?5:violators.length,o=0;s>o;o++)t+=violators[o].name+": "+violators[o].violations,o!=violators.length-1&&(t+=" | ")
bot.say(e,t)}else bot.say(e,"We have no violators, yet! Kappa")
bot.say(e,"=======================================")}function checkViolations(e){if(""==violators){var t={name:e,violations:1}
violators.push(t),jf.writeFileSync(file,violators)}else for(var s=0;s<violators.length;s++){if(violators[s].name==e){violators[s].violations++,violators.sort(function(e,t){return parseInt(e.violations)<parseInt(t.violations)?1:-1}),jf.writeFileSync(file,violators)
break}s==violators.length-1&&(t={name:e,violations:1},violators.push(t),violators.sort(function(e,t){return parseInt(e.violations)<parseInt(t.violations)?1:-1}),jf.writeFileSync(file,violators))}}var settings={channels:["#channel","#channel2","#channel3","#channel4"],server:"irc.twitch.tv",botName:"<BOT USERNAME>",botNick:["bot"],password:"<OAUTH TOKEN>",admins:["adminName1","adminName2"],swears:["badword1","badword2","badwords"],quotes:["Did someone say my name?","You've enjoyed all the power you've been given, haven't you? I wonder how you'd take to working in a pocket calculator.","On the other side of the screen, it all looks so easy.","FYI man, alright. You could sit at home, and do like absolutely nothing, and your name goes through like 17 computers a day. 1984? Yeah right, man. That's a typo. Orwell is here now. He's livin' large. We have no names, man. No names. We are nameless!","Someone didn't bother reading my carefully prepared memo on commonly-used passwords. Now, then, as I so meticulously pointed out, the four most-used passwords are: love, sex, secret, and God. So, would your holiness care to change her password?",'Type "cookie", you idiot.',"Did someone say my name?","/me is starting to hear things...","You're in the butter zone now, baby.","Thank you {NICK}! But our Princess is in another castle!",'"When I get all excited about a topic I start gesticulating." -Ian Murdock','"If I were wearing a black turtle neck, I\'d tell you this was going to be a magical experience" -Kevin Parkerson','"This is going to make you ill with joy" -Kevin Parkerson',"Hello. My name is Inigo Montoya. You killed my father. Prepare to die.","You rush a miracle man, you get rotten miracles.","Oh, the sot has spoken. What happens to her is not truly your concern. I will kill her. And remember this, never forget this: when I found you, you were so slobbering drunk, you couldn't buy Brandy!","As I told you, it would be absolutely, totally, and in all other ways inconceivable.","You keep using that word. I do not think it means what you think it means.","I do not mean to pry, but you don't by any chance happen to have six fingers on your right hand?","I can't compete with you physically, and you're no match for my brains. Let me put it this way. Have you ever heard of Plato, Aristotle, Socrates? Morons.","Life is pain, {NICK}. Anyone who says differently is selling something.","This will be a day long remembered. It has seen the end of Kenobi, and will soon see the end of the rebellion.","Oh no! Nuclear launch detected!","What a piece of junk!","Snake? Snake? SNAAAAAAAAKE!!!","AREEEEEEEEEES!!!!!!!!!","Show me your moves, {NICK}!","{NICK}, feeling happy is a fucking skill. Learn it!","…","It’s dangerous to go alone; take this! PJSalt","Hey dudes thanks, for rescuing me. Let's go for a burger....Ha! Ha! Ha! Ha! - The President","{NICK}, you must construct additional pylons.","Don't call me a mindless philosopher, you overweight glob of grease.",'Why not take a break? You can pause the game by pressing +. Just kidding! Instead, press "Follow"! Kappa',"Don't worry {NICK}, I'm here to rescue you.","Evacuate in our moment of triumph? I think you overestimate their chances.","If this is a consular ship, where is the ambassador? - Commander, tear this ship apart until you've found those plans. And bring me the passengers, I want them alive!","Look, good against remotes is one thing, good against the living, that's something else.","Aren't you a little short for a stormtrooper?","Hey {NICK}, stay a while, and listen!","In the year 200x a super robot named Mega Man was created.","Boomshakalaka!","First blood! BloodTrail","I need a weapon.","Wakka wakka wakka!","It's time to kick ass and chew bubble gum, and I'm all out of gum.","Segaaaaaaaaaaaaaaaaaaaaa.","What are we going to do? We'll be sent to the spice mines of Kessel and smashed into who knows what.","That's no moon, it's a space station.","Oh look, another visitor. Stay awhile... Stay FOREVER! (and click 'Follow')","Spy's sappin’ my sentry!","The President has been kidnapped by ninjas. Are you a bad enough dude to rescue the president, {NICK}?","This is some rescue. You came in here and you didn't have a plan for getting out?","He's the brains, sweetheart!","Wake me when you need me.","Mos Eisley spaceport. You will never find a more wretched hive of scum and villainy.","Into the garbage chute, flyboy!","Hey hey hey it's time to make some carrrrazzzyy money are ya ready? Here we go!","This is Red 5, I'm going in.","Boring conversation anyway. Luke, we're gonna have company!","The right man in the wrong place can make all the difference in the world, {NICK}","The Force is strong with this one.","All your base are belong to us.","I suggest a new strategy, R2. Let the wookiee win.","I'm a member of the Imperial Senate on a diplomatic mission to Alderaan.","You are part of the Rebel Alliance and a traitor. Take her away!","You're all clear, kid! Now let's blow this thing and go home!","These blast points - too accurate for sandpeople. Only imperial stormtroopers are so precise.","I've got a very bad feeling about this.","You've never heard of the Millennium Falcon? ... It's the ship that made the Kessel run in less than 12 parsecs.","When I left you, I was but the learner, now I am the master.","/me thinks {NICK} talks too much.","{NICK} has died of dysentery","I am error. BibleThump","Fus-ro-dah!","{NICK}, Finish Him!","Welcome to Summoner's Rift....Pfft, just kidding. SwiftRage","I find your lack of faith disturbing.","I am the great mighty poo, and I’m going to throw my shit at you.","This is your fault, {NICK}, I'm going to kill you. And all the cake is gone. You don't even care, do you?","Use the Force, {NICK}","You don't need to see his identification ... These aren't the droids you're looking for ... He can go about his business ... Move along.","Help me {NICK}. You're my only hope.","No one said you have to like me, but you're in MY house, buster!","I'm fine... We're all fine here. How are you?","Didn’t we have some fun though? Remember when the platform was sliding into the fire pit and I said 'Goodbye' and you were like 'NO WAY!' and then I was all 'We pretended we were going to murder you'? That was great.","C-c-c-combo breaker!","It's a-me! MGbot! Kappa","Sorry {NICK}, our princess is in another castle!"],backtalk:["Hey, {NICK}, watch your fucking mouth!","{NICK}, watch what you say, there might be fucking kids in here!","GOD DAMNIT, {NICK} I said NO fucking swearing!","You kiss your mother with that mouth, {NICK}?","Sigh, I give up! Fuckers be swearing all over this bitch!","/me is really starting to not like {NICK}","Stop poking me!","Damn {NICK}, you are worse than Khrono!","I will kill your dicks! - (Bulletstorm)","Learn from your parents' mistakes, {NICK}, use birth control!","The universe is laughing behind {NICK}'s back.","You're just jealous because the voices only talk to me.","Hey Sailor! Join the Army, meet interesting people, kill them","/me is looking for a new job","Wow {NICK}, your vocab talents will be recognized and suitably rewarded.","Deep down I'm a very shallow person.","Sigh! Bullshit: the art of making the idiotic sound sensible.","Watch your mouth kid, or you'll find yourself floating home."],adminMsgs:["Welcome to {CHANNEL}'s channel. Click 'FOLLOW' to stay up to date on when {CHANNEL} goes live.","You guys rock! Thanks for hanging out with us today!"]}
console.log("*** Bot Started ***")
var violators=[],startTime=new Date,admins=settings.admins,swears=settings.swears,irc=require("irc"),fs=require("fs"),jf=require("jsonfile"),util=require("util")
console.log("loading violators...")
var file="violators.json"
violators=jf.readFileSync(file)
for(var i=0;i<settings.channels.length;i++){var chanObj=settings.channels[i].substr(1)
settings[chanObj]={},settings[chanObj].viewers=0,settings[chanObj].adminMsg=null,settings[chanObj].allowing="",settings[chanObj].msgCount=0}var bot=new irc.Client(settings.server,settings.botName,{channels:[settings.channels+" "+settings.password],debug:!1,password:settings.password,username:settings.botName})
bot.addListener("join",function(e,t){settings[e.substr(1)].viewers++,settings[e.substr(1)].viewers>=8&&(console.log(e.substr(1)+" viewers = "+settings[e.substr(1)].viewers),settings[e.substr(1)].adminMsg||(console.log("starting interval for adminMsg"),settings[e.substr(1)].adminMsg=setInterval(function(){sendAdminMsg(e)},6e5)))}),bot.addListener("message",function(e,t,s,o){return"cookie"===s?void bot.say(t,"Great! You jump off bridges when bots tell you to as well?"):s===s.toUpperCase()&&s.length>5?void(adminCheck(e)||(setTimeout(function(){bot.say(t,"/timeout "+e+" 20"),bot.say(t,e+", calm down! Try that again in 20 secs. BloodTrail")},1500),checkViolations(e))):scanForLink(s)||adminCheck(e)?"!"==s.substr(0,1)?void parseCmd(s.substr(1).toLowerCase(),t,e):void textScan(s,t,e):void(settings[t.substr(1)].allowing!=e&&(setTimeout(function(){bot.say(t,"/timeout "+e+" 20"),bot.say(t,"Ahem! "+e+", did you ask for permission to post that link?")},1500),checkViolations(e)))}),bot.addListener("connect",function(){console.log("*** Bot Connected ***"),bot.say(settings.channels[0],"I am Here Bitches!")
for(var e=0;e<settings.channels.length;e++)clearInterval(settings[settings.channels[e].substr(1)].adminMsg),settings[settings.channels[e].substr(1)].adminMsg=!1}),bot.addListener("part",function(e,t,s,o){settings[e.substr(1)].viewers--,settings[e.substr(1)].viewers<0&&(settings[e.substr(1)].viewers=0),settings[e.substr(1)].viewers<8&&(clearInterval(settings[e.substr(1)].adminMsg),settings[e.substr(1)].adminMsg=!1,console.log("clearing adminMsg interval for "+e)),console.log(e.substr(1)+" viewers = "+settings[e.substr(1)].viewers)}),bot.addListener("quit",function(e,t,s,o){settings[channel.substr(1)].viewers--,settings[channel.substr(1)].viewers<0&&(settings[channel.substr(1)].viewers=0),settings[channel.substr(1)].viewers<8&&(clearInterval(settings[channel.substr(1)].adminMsg),settings[channel.substr(1)].adminMsg=!1,console.log("clearing adminMsg interval for "+channel)),console.log(channel.substr(1)+" viewers = "+settings[channel.substr(1)].viewers)})
var settings={channels:["#channel1","#channel2","#channel3","#channel4"],server:"{botname}.jtvirc.com",botName:"{actual bot account name}",botNick:["bot"],password:"{password}",admins:["adminName1","adminName2"],swears:["badword1","badword2","badwords"],quotes:["Did someone say my name?","You've enjoyed all the power you've been given, haven't you? I wonder how you'd take to working in a pocket calculator.","On the other side of the screen, it all looks so easy.","FYI man, alright. You could sit at home, and do like absolutely nothing, and your name goes through like 17 computers a day. 1984? Yeah right, man. That's a typo. Orwell is here now. He's livin' large. We have no names, man. No names. We are nameless!","Someone didn't bother reading my carefully prepared memo on commonly-used passwords. Now, then, as I so meticulously pointed out, the four most-used passwords are: love, sex, secret, and God. So, would your holiness care to change her password?",'Type "cookie", you idiot.',"Did someone say my name?","/me is starting to hear things...","You're in the butter zone now, baby.","Thank you {NICK}! But our Princess is in another castle!",'"When I get all excited about a topic I start gesticulating." -Ian Murdock','"If I were wearing a black turtle neck, I\'d tell you this was going to be a magical experience" -Kevin Parkerson','"This is going to make you ill with joy" -Kevin Parkerson',"Hello. My name is Inigo Montoya. You killed my father. Prepare to die.","You rush a miracle man, you get rotten miracles.","Oh, the sot has spoken. What happens to her is not truly your concern. I will kill her. And remember this, never forget this: when I found you, you were so slobbering drunk, you couldn't buy Brandy!","As I told you, it would be absolutely, totally, and in all other ways inconceivable.","You keep using that word. I do not think it means what you think it means.","I do not mean to pry, but you don't by any chance happen to have six fingers on your right hand?","I can't compete with you physically, and you're no match for my brains. Let me put it this way. Have you ever heard of Plato, Aristotle, Socrates? Morons.","Life is pain, {NICK}. Anyone who says differently is selling something.","This will be a day long remembered. It has seen the end of Kenobi, and will soon see the end of the rebellion.","Oh no! Nuclear launch detected!","What a piece of junk!","Snake? Snake? SNAAAAAAAAKE!!!","AREEEEEEEEEES!!!!!!!!!","Show me your moves, {NICK}!","{NICK}, feeling happy is a fucking skill. Learn it!","…","It’s dangerous to go alone; take this! PJSalt","Hey dudes thanks, for rescuing me. Let's go for a burger....Ha! Ha! Ha! Ha! - The President","{NICK}, you must construct additional pylons.","Don't call me a mindless philosopher, you overweight glob of grease.",'Why not take a break? You can pause the game by pressing +. Just kidding! Instead, press "Follow"! Kappa',"Don't worry {NICK}, I'm here to rescue you.","Evacuate in our moment of triumph? I think you overestimate their chances.","If this is a consular ship, where is the ambassador? - Commander, tear this ship apart until you've found those plans. And bring me the passengers, I want them alive!","Look, good against remotes is one thing, good against the living, that's something else.","Aren't you a little short for a stormtrooper?","Hey {NICK}, stay a while, and listen!","In the year 200x a super robot named Mega Man was created.","Boomshakalaka!","First blood! BloodTrail","I need a weapon.","Wakka wakka wakka!","It's time to kick ass and chew bubble gum, and I'm all out of gum.","Segaaaaaaaaaaaaaaaaaaaaa.","What are we going to do? We'll be sent to the spice mines of Kessel and smashed into who knows what.","That's no moon, it's a space station.","Oh look, another visitor. Stay awhile... Stay FOREVER! (and click 'Follow')","Spy's sappin’ my sentry!","The President has been kidnapped by ninjas. Are you a bad enough dude to rescue the president, {NICK}?","This is some rescue. You came in here and you didn't have a plan for getting out?","He's the brains, sweetheart!","Wake me when you need me.","Mos Eisley spaceport. You will never find a more wretched hive of scum and villainy.","Into the garbage chute, flyboy!","Hey hey hey it's time to make some carrrrazzzyy money are ya ready? Here we go!","This is Red 5, I'm going in.","Boring conversation anyway. Luke, we're gonna have company!","The right man in the wrong place can make all the difference in the world, {NICK}","The Force is strong with this one.","All your base are belong to us.","I suggest a new strategy, R2. Let the wookiee win.","I'm a member of the Imperial Senate on a diplomatic mission to Alderaan.","You are part of the Rebel Alliance and a traitor. Take her away!","You're all clear, kid! Now let's blow this thing and go home!","These blast points - too accurate for sandpeople. Only imperial stormtroopers are so precise.","I've got a very bad feeling about this.","You've never heard of the Millennium Falcon? ... It's the ship that made the Kessel run in less than 12 parsecs.","When I left you, I was but the learner, now I am the master.","/me thinks {NICK} talks too much.","{NICK} has died of dysentery","I am error. BibleThump","Fus-ro-dah!","{NICK}, Finish Him!","Welcome to Summoner's Rift....Pfft, just kidding. SwiftRage","I find your lack of faith disturbing.","I am the great mighty poo, and I’m going to throw my shit at you.","This is your fault, {NICK}, I'm going to kill you. And all the cake is gone. You don't even care, do you?","Use the Force, {NICK}","You don't need to see his identification ... These aren't the droids you're looking for ... He can go about his business ... Move along.","Help me {NICK}. You're my only hope.","No one said you have to like me, but you're in MY house, buster!","I'm fine... We're all fine here. How are you?","Didn’t we have some fun though? Remember when the platform was sliding into the fire pit and I said 'Goodbye' and you were like 'NO WAY!' and then I was all 'We pretended we were going to murder you'? That was great.","C-c-c-combo breaker!","It's a-me! MGbot! Kappa","Sorry {NICK}, our princess is in another castle!"],backtalk:"Hey, {NICK}, watch your fucking mouth!;{NICK}, watch what you say, there might be fucking kids in here!;GOD DAMNIT, {NICK} I said NO fucking swearing!;You kiss your mother with that mouth, {NICK}?;Sigh, I give up! Fuckers be swearing all over this bitch!;/me is really starting to not like {NICK};Stop poking me!;Damn {NICK}, you are worse than Khrono!;I will kill your dicks! - (Bulletstorm);Learn from your parents' mistakes, {NICK}, use birth control!;The universe is laughing behind {NICK}'s back.;You're just jealous because the voices only talk to me.;Hey Sailor! Join the Army, meet interesting people, kill them;/me is looking for a new job;Wow {NICK}, your vocab talents will be recognized and suitably rewarded.;Deep down I'm a very shallow person.;Sigh! Bullshit: the art of making the idiotic sound sensible.;Watch your mouth kid, or you'll find yourself floating home.".split(";"),adminMsgs:["Welcome to {CHANNEL}'s channel. Click 'FOLLOW' to stay up to date on when {CHANNEL} goes live.","You guys rock! Thanks for hanging out with us today!"]}
console.log("*** Bot Started ***")
var violators=[],startTime=new Date,admins=settings.admins,swears=settings.swears,irc=require("irc"),fs=require("fs"),jf=require("jsonfile"),util=require("util")
console.log("loading violators...")
for(var file="violators.json",violators=jf.readFileSync(file),i=0;i<settings.channels.length;i++){var chanObj=settings.channels[i].substr(1)
settings[chanObj]={},settings[chanObj].viewers=0,settings[chanObj].adminMsg=null,settings[chanObj].allowing="",settings[chanObj].msgCount=0}var bot=new irc.Client(settings.server,settings.botName,{channels:[settings.channels+" "+settings.password],debug:!1,password:settings.password,username:settings.botName})
bot.addListener("join",function(e){settings[e.substr(1)].viewers++,8<=settings[e.substr(1)].viewers&&(console.log(e.substr(1)+" viewers = "+settings[e.substr(1)].viewers),settings[e.substr(1)].adminMsg||(console.log("starting interval for adminMsg"),settings[e.substr(1)].adminMsg=setInterval(function(){sendAdminMsg(e)},6e5)))}),bot.addListener("message",function(e,t,s){"cookie"===s?bot.say(t,"Great! You jump off bridges when bots tell you to as well?"):s===s.toUpperCase()&&5<s.length?adminCheck(e)||(setTimeout(function(){bot.say(t,"/timeout "+e+" 20"),bot.say(t,e+", calm down! Try that again in 20 secs. BloodTrail")},1500),checkViolations(e)):scanForLink(s)||adminCheck(e)?"!"==s.substr(0,1)?parseCmd(s.substr(1).toLowerCase(),t,e):textScan(s,t,e):settings[t.substr(1)].allowing!=e&&(setTimeout(function(){bot.say(t,"/timeout "+e+" 20"),bot.say(t,"Ahem! "+e+", did you ask for permission to post that link?")},1500),checkViolations(e))}),bot.addListener("connect",function(){console.log("*** Bot Connected ***")
for(var e=0;e<settings.channels.length;e++)clearInterval(settings[settings.channels[e].substr(1)].adminMsg),settings[settings.channels[e].substr(1)].adminMsg=!1}),bot.addListener("part",function(e){settings[e.substr(1)].viewers--,0>settings[e.substr(1)].viewers&&(settings[e.substr(1)].viewers=0),8>settings[e.substr(1)].viewers&&(clearInterval(settings[e.substr(1)].adminMsg),settings[e.substr(1)].adminMsg=!1,console.log("clearing adminMsg interval for "+e)),console.log(e.substr(1)+" viewers = "+settings[e.substr(1)].viewers)}),bot.addListener("quit",function(){settings[channel.substr(1)].viewers--,0>settings[channel.substr(1)].viewers&&(settings[channel.substr(1)].viewers=0),8>settings[channel.substr(1)].viewers&&(clearInterval(settings[channel.substr(1)].adminMsg),settings[channel.substr(1)].adminMsg=!1,console.log("clearing adminMsg interval for "+channel)),console.log(channel.substr(1)+" viewers = "+settings[channel.substr(1)].viewers)})