Skip to content
Open
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
5eb4fc3
Update bot.js
mahssaba Feb 6, 2017
47422f7
Update bot.js
mahssaba Feb 6, 2017
c4a6a23
Update bot.js
mahssaba Feb 6, 2017
9b201eb
Update bot.js
mahssaba Feb 6, 2017
67a035a
Update bot.js
mahssaba Feb 6, 2017
17863e4
Update bot.js
mahssaba Feb 6, 2017
224295b
Update bot.js
mahssaba Feb 6, 2017
ef6e2ac
Update bot.js
mahssaba Feb 6, 2017
faf3cdc
Update bot.js
mahssaba Feb 6, 2017
e2b10c0
Update bot.js
mahssaba Feb 6, 2017
b2f123e
Update bot.js
mahssaba Feb 6, 2017
0883c52
Update bot.js
mahssaba Feb 6, 2017
5976c8f
Update bot.js
mahssaba Feb 6, 2017
5ed6ee7
Update bot.js
mahssaba Feb 6, 2017
77cb8ac
Update bot.js
mahssaba Feb 6, 2017
b34e97b
Update bot.js
mahssaba Feb 6, 2017
5b5a146
Update bot.js
mahssaba Feb 6, 2017
47e2829
Update bot.js
mahssaba Feb 6, 2017
85faa03
Update bot.js
mahssaba Feb 6, 2017
b9fedc3
Update bot.js
mahssaba Feb 6, 2017
daf9dad
Update bot.js
mahssaba Feb 7, 2017
50ebf0b
Update bot.js
mahssaba Feb 7, 2017
cd01797
Update bot.js
mahssaba Feb 7, 2017
1532236
Update bot.js
mahssaba Feb 7, 2017
6d196b3
Update bot.js
mahssaba Feb 7, 2017
a687809
Update bot.js
mahssaba Feb 7, 2017
b77e18e
Update bot.js
mahssaba Feb 7, 2017
b758c8e
Update bot.js
mahssaba Feb 7, 2017
0d3fea0
Update bot.js
mahssaba Feb 7, 2017
1b5bb8a
Update bot.js
mahssaba Feb 7, 2017
1268163
Update bot.js
mahssaba Feb 7, 2017
bfb5afb
Update bot.js
mahssaba Feb 7, 2017
133ba2f
Update bot.js
mahssaba Feb 7, 2017
a66331f
Update bot.js
mahssaba Feb 7, 2017
4ea2994
Update bot.js
mahssaba Feb 7, 2017
9ca073b
Update bot.js
mahssaba Feb 7, 2017
70bceb6
Update bot.js
mahssaba Feb 7, 2017
a873776
Update bot.js
mahssaba Feb 7, 2017
293ea01
Update bot.js
mahssaba Feb 7, 2017
2606dc0
Update bot.js
mahssaba Feb 7, 2017
d92345b
Update bot.js
mahssaba Feb 7, 2017
cbad203
Update bot.js
mahssaba Feb 7, 2017
cbf0f5e
Update bot.js
mahssaba Feb 7, 2017
0a1d4d0
Update bot.js
mahssaba Feb 7, 2017
741a943
Update bot.js
mahssaba Feb 7, 2017
57d5382
Update bot.js
mahssaba Feb 7, 2017
0d9d4ac
Update bot.js
mahssaba Feb 8, 2017
a211b08
Update bot.js
mahssaba Feb 8, 2017
d8c7592
Update bot.js
mahssaba Feb 8, 2017
7858d72
Update bot.js
mahssaba Feb 8, 2017
1bb5f7b
Update bot.js
mahssaba Feb 8, 2017
9b61ef6
Update bot.js
mahssaba Feb 8, 2017
88eeba7
Update bot.js
mahssaba Feb 8, 2017
4726990
Update bot.js
mahssaba Feb 8, 2017
50c7538
Update bot.js
mahssaba Feb 8, 2017
09da131
Update bot.js
mahssaba Feb 8, 2017
9034fc4
Update bot.js
mahssaba Feb 8, 2017
8f62eb7
Update bot.js
mahssaba Feb 8, 2017
7c62906
Update bot.js
mahssaba Feb 8, 2017
91381bf
Update bot.js
mahssaba Feb 8, 2017
6b8a2bb
Update bot.js
mahssaba Feb 8, 2017
874d071
Update bot.js
mahssaba Feb 8, 2017
0aa20d1
Update bot.js
mahssaba Feb 8, 2017
2243015
Update bot.js
mahssaba Feb 8, 2017
c6bb888
Update bot.js
mahssaba Feb 8, 2017
8bd059c
Update bot.js
mahssaba Feb 8, 2017
b77b74d
Update bot.js
mahssaba Feb 8, 2017
26f5aea
Update bot.js
mahssaba Feb 8, 2017
fb10345
Update bot.js
mahssaba Feb 8, 2017
23d9a85
Update bot.js
mahssaba Feb 8, 2017
acdb111
Update bot.js
mahssaba Feb 8, 2017
805cb51
Update bot.js
mahssaba Feb 8, 2017
c54ebf0
Update bot.js
mahssaba Feb 8, 2017
ac5631f
Merge pull request #1 from mahssaba/mahssaba-training
mahssaba Feb 8, 2017
d7de6fa
Merge branch 'testing' into master
mahssaba Feb 8, 2017
1d77659
Merge pull request #3 from mahssaba/master
mahssaba Feb 8, 2017
4cc067a
Update bot.js
mahssaba Feb 9, 2017
ac762f7
Update bot.js
mahssaba Feb 10, 2017
8af814b
Merge pull request #5 from mahssaba/master
mahssaba Feb 10, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
202 changes: 74 additions & 128 deletions bot.js
Original file line number Diff line number Diff line change
@@ -1,182 +1,124 @@
var HTTPS = require('https');
var cool = require('cool-ascii-faces');

var botID = process.env.BOT_ID;

function respond() {
var request = JSON.parse(this.req.chunks[0]),
botRegex = /^\/cool guy/; botRegexDL = /^\/DDL/i;botRegexSalt = /^\/salt/;botRegexRules = /^\/rules/
botRegexAd=/^\/advance/;botRegexGTA = /^\/gta/; botRegexSC = /^\/SDL/i; botODB = /(.*\s+)(.*odb)(\s+.*)/i; botDuck = /^\/duck/;
botRegexP = /^\/PDL/i; botRegexTw = /^\/twitch/i; botRegexSb = /^\/sub/; botRegexSh = /^\/shrug/; botRegexWk = /^\/users/; botRegexCC = /^\/cc/;
botRegexSiege = /^\/siege/; botRegexOW = /^\/ratings/;
botRegexSlut = /^\/slut/; botRegexStop = /^\/stop/;
botRegexProp = /^\/prop/;botRegexKys = /^\/kys/; botRegexSlam = /^\/slam/; botRegexBrye = /^\/brye/;
botRegexGian = /^\/gian/; botRegexScrotes = /^\/scrotes/; botRegexShaki = /^\/shaki/;
botRegexDaf = /^\/dafuq/; botRegexMA32 = /^\/pending/; botRegexTrade = /^\/trade/;
siege1 = 'https://i.groupme.com/350x419.png.adc8c73a6c1547e0a9e04320296329f8'; siege2 = 'https://i.groupme.com/1279x752.jpeg.aa5d0401e0df495bba4b4e09dc5a6bd7'
siege3 = 'https://i.groupme.com/960x960.png.006e180e05d841c6a2962e844bf1e6fd';
var teamAb = ["NE","NO","ARI","PHI","CLE","TEN","OAK","DAL","IND","SEA","CIN","PIT","JAC"
,"BAL","SD","DEN","MIN","ATL","KC","NYG","GB","DET","HOU","STL","CHI","CAR",
"MIA","BUF","SF","WAS","NYJ","TB"]

botRegex = /(\s|^)(B|b)ot(\s|$)/; botRegexTi = /(.*)(T|t)itan(.*)/;botRegexBi = /(.*)(B|b)itch(.*)/
botRegexBk = /(.*)(B|b)oss kill(.*)/;botRegexAr = /(.*)(A|a)rena cutoff(.*)/;botRegexPr = /(.*)(P|p)restige link(.*)/;
botRegexFu = /(.*)(F|f)uck (Y|y)ou(.*)/;botRegexHg = /Graves/;botRegexFf = /(.*)(B|b)(R|r)(A|a|U|u)(H|h)(.*)/;
botRegexDo = /\/(D|d)onations/;botRegex6 = /\/(M|m)ap6$/;botRegex61 = /\/(M|m)ap6[.]1$/;botRegex62 = /\/(M|m)ap6[.]2$/;
botRegex63 = /\/(M|m)ap6[.]3$/;botRegexLe = /\/(L|l)egend$/;botRegexSc = /(\s|^)(S|s)crew (Y|y)ou(\s|$)/;

var phraseArray = ["#?",
"#wtf",
"#saymyname",
"#24msgs",
"#omv",
"#legend",
"#iamgroot",
"#telomere",
"http://pix.iemoji.com/images/emoji/apple/ios-9/256/lion-face.png",
"#here"];
var phrase = chooseRandom(phraseArray);
var phraseArray2 = ["#2fast",
"#2furious",
"#ask any racer. any real racer",
"#for those 10 seconds or less, I'm free",
"#i'll have the tuna. no crust",
"#still a buster",
"#ejecto seato, cuz!",
"#too soon, junior",
"#it's a ho-asis in here, brah",
"#rideordie",
"#i never narc'd on nobody",
"#overnight parts from japan"];
var phrase2 = chooseRandom(phraseArray2);

if(request.text && botRegex.test(request.text)) {
this.res.writeHead(200);
postMessage(cool());
postMessage(phrase);
this.res.end();
}
else if(request.text && botRegexSlut.test(request.text)) {
this.res.writeHead(200);
postMessage("https://i.groupme.com/640x364.jpeg.f8a0e216bf7e42ed9a86b3ae23cc2ff1.large");
this.res.end();
}
else if(request.text && botRegexStop.test(request.text)) {
this.res.writeHead(200);
postMessage("Stop appropriating black culture");
this.res.end();
}
else if(request.text && botRegexProp.test(request.text)) {
this.res.writeHead(200);
postMessage("https://i.groupme.com/409x327.jpeg.08b5d95c51bb4897835cfe6b514f2f52.large");
this.res.end();
}
else if(request.text && botRegexKys.test(request.text)) {
this.res.writeHead(200);
postMessage("http://www.wikihow.com/Tie-a-Noose");
this.res.end();
}
else if(request.text && botRegexSlam.test(request.text)) {
else if(request.text && botRegexTi.test(request.text)) {
this.res.writeHead(200);
postMessage("https://pbs.twimg.com/profile_images/587294731471757313/ZpI5PfKq.jpg");
this.res.end();
}
else if(request.text && botRegexDaf.test(request.text)) {
this.res.writeHead(200);
postMessage("http://i3.kym-cdn.com/photos/images/facebook/000/787/356/d6f.jpg");
this.res.end();
}
else if(request.text && botRegexBrye.test(request.text)) {
this.res.writeHead(200);
postMessage("https://i.groupme.com/600x490.jpeg.b31d5153fb474d9bb18dd51b3d650afe.large");
this.res.end();
}
else if(request.text && botRegexGian.test(request.text)) {
this.res.writeHead(200);
postMessage("http://i.imgur.com/9V6ZnvD.png");
this.res.end();
}
else if(request.text && botRegexScrotes.test(request.text)) {
this.res.writeHead(200);
postMessage("https://i.groupme.com/1006x1340.jpeg.730381e4280e4028b8375432af14f39f.large");
this.res.end();
}
else if(request.text && botRegexShaki.test(request.text)) {
this.res.writeHead(200);
postMessage("https://i.groupme.com/305x375.jpeg.a8dd3aa18c7a4963a553e6dc16bcb100.large");
this.res.end();
}
else if(request.text && botRegexDL.test(request.text)) {
this.res.writeHead(200);
//postMessage("http://www.daddyleagues.com/maddenrating?name=&position=all&team="+request.text.substring(5,8));
postMessage("http://daddyleagues.com/maddenall32/team/"+request.text.substring(5,8)+"/depthchart");
postMessage("#hebackyet?");
this.res.end();
}

else if(request.text && botRegexOW.test(request.text)) {
this.res.writeHead(200);
postMessage("www.daddyleagues.com/maddenrating/");
this.res.end();
}
else if(request.text && botRegexSalt.test(request.text)) {
else if(request.text && botRegexBi.test(request.text)) {
this.res.writeHead(200);
postMessage("https://i.imgur.com/B5BSVqH.png");
postMessage("#thatbih");
this.res.end();
}
else if(request.text && botRegexAd.test(request.text)) {
else if(request.text && botRegexBk.test(request.text)) {
this.res.writeHead(200);
postMessage("http://www.hackcollege.com/wp-content/uploads/2013/02/kno_advance.jpg");
postMessage("#bosskillah");
this.res.end();
}
else if(request.text && botRegexRules.test(request.text)) {
this.res.writeHead(200);
postMessage("https://docs.google.com/document/d/1hSuEG7oplnx4IX6HGsMOjsWb9TCqC4-F1NLjuBz5PCM/edit");
this.res.end();
}
else if(request.text && botRegexGTA.test(request.text)) {
this.res.writeHead(200);
postMessage("https://i.groupme.com/220x147.jpeg.a2dd2add32b14fff9e329535186d793c.large");
this.res.end();
}
else if(request.text && botRegexSC.test(request.text)) {
}
else if(request.text && botRegexAr.test(request.text)) {
this.res.writeHead(200);

postMessage("http://daddyleagues.com/maddenall32/team/"+request.text.substring(5,8)+"/schedule");
postMessage("https://docs.google.com/spreadsheets/d/1sJtSVnjhhRNxpiuMR5uXrsTlrsXMjp9TNO7JHDXhtsk/htmlview?pli=1");
this.res.end();
}
else if(request.text && botRegexP.test(request.text)) {
}
else if(request.text && botRegexPr.test(request.text)) {
this.res.writeHead(200);
var req = request.text.substring(5,request.text.length);
var rep = req.replace(/ /,"+");
postMessage("http://daddyleagues.com/maddenall32/players?name="+rep+"&position=all&team=all");

postMessage("https://docs.google.com/spreadsheets/d/13oEg8HzEB11-il7o4mBDUpPx-s2hnPvRa1PSMgpxyYE/edit?usp=sharing");
this.res.end();
}

else if(request.text && botRegexTw.test(request.text)) {
else if(request.text && botRegexFu.test(request.text)) {
this.res.writeHead(200);
postMessage("http://www.twitch.tv/"+request.text.substring(8,request.text.length));
postMessage("#Me?? Fuq you!");
this.res.end();
}
else if(request.text && botRegexSb.test(request.text)) {
}
else if(request.text && botRegexHg.test(request.text)) {
this.res.writeHead(200);
postMessage("http://www.reddit.com/r/maddenall32");
if(Math.random() >= 0.9)
postMessage("http://pix.iemoji.com/images/emoji/apple/ios-9/256/lion-face.png");
this.res.end();
}
else if(request.text && botRegexSh.test(request.text)) {
else if(request.text && botRegexFf.test(request.text)) {
this.res.writeHead(200);
postMessage("¯\\_(ツ)_/¯");
postMessage(phrase2);
this.res.end();
}
else if(request.text && botRegexWk.test(request.text)) {
else if(request.text && botRegexDo.test(request.text)) {
this.res.writeHead(200);
postMessage("https://docs.google.com/spreadsheets/d/1kJqQWCq3RKiTrd4f71FFNKr-Y0ppJzjk0fSF0rP6Bto/edit?usp=sharing");
postMessage("GO: 170k\nBC: 46k\nLO: 15k");
this.res.end();
}
else if(request.text && botODB.test(request.text)) {
}
else if(request.text && botRegex6.test(request.text)) {
this.res.writeHead(200);
postMessage("OBJ*");
postMessage("http://marvelbitvachempionov.ru/wp-content/uploads/maps/aqmap6en.jpg");
postMessage("https://docs.google.com/spreadsheets/d/1qi-3KOfLnI0c4YL4b9CB85e1OXw4HmtaVaCbbUR4aOs/htmlview");
this.res.end();
}
else if(request.text && botDuck.test(request.text)) {
}
else if(request.text && botRegex61.test(request.text)) {
this.res.writeHead(200);
postMessage("http://media3.giphy.com/media/YCseTHF2I6CCA/giphy.gif");
postMessage("http://marvelbitvachempionov.ru/wp-content/uploads/maps/aqmap6-1en.jpg");
this.res.end();
}
else if(request.text && botRegexCC.test(request.text)) {
else if(request.text && botRegex62.test(request.text)) {
this.res.writeHead(200);
postMessage("https://i.groupme.com/851x1184.jpeg.330228901f684b0cb46cd1cef6953923");
postMessage("http://marvelbitvachempionov.ru/wp-content/uploads/maps/aqmap6-2en.jpg");
this.res.end();
}
else if(request.text && botRegexMA32.test(request.text)) {
else if(request.text && botRegex63.test(request.text)) {
this.res.writeHead(200);
postMessage("https://docs.google.com/spreadsheets/d/12hVrn7ShR3An6bP5uBF3gaoTQQgVciC-0RqtWVZ39Ls/edit?usp=sharing");
postMessage("http://marvelbitvachempionov.ru/wp-content/uploads/maps/aqmap6-3en.jpg");
this.res.end();
}
else if(request.text && botRegexTrade.test(request.text)) {
else if(request.text && botRegexLe.test(request.text)) {
this.res.writeHead(200);
postMessage("https://docs.google.com/forms/d/e/1FAIpQLSdrbe5iBRaBC7EWoodVm8z6285-dG2EdHXAOMOgz8md8T1jwQ/viewform");
postMessage("http://community.kabam.com/forums/showthread.php?650203-Hall-of-Legends&p=3307845#post3307845");
this.res.end();
}

else if(request.text && botRegexSiege.test(request.text)) {
else if(request.text && botRegexSc.test(request.text)) {
this.res.writeHead(200);
if(0.6 >= Math.random() > 0.3)
postMessage(siege1);
else if(Math.random() >0.6)
postMessage(siege3)
else
postMessage(siege2);
postMessage("https://s-media-cache-ak0.pinimg.com/564x/cb/91/72/cb9172eba64a409ebc3422a3c22ba6e7.jpg");
this.res.end();
}

else {
console.log("don't care");
this.res.writeHead(200);
Expand Down Expand Up @@ -219,6 +161,10 @@ function postMessage(response) {
botReq.end(JSON.stringify(body));
}

function chooseRandom(myArray) {
return myArray[Math.floor(Math.random() * myArray.length)];
}

function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
Expand Down