From c63819b94c3a31d783f2fbf200022ce31a23a827 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Thu, 11 Apr 2024 19:28:11 -0400 Subject: [PATCH 01/49] Updated with my info --- .env | 2 +- app.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env b/.env index a02c3d776..8e1b0cb5d 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -BOT_ID="YOUR_BOT_ID_HERE" \ No newline at end of file +BOT_ID="de7b9e2d4f6734f3e993ba22d5" \ No newline at end of file diff --git a/app.json b/app.json index 693c54cf0..2e549818e 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { - "name": "Cool guy bot", - "description": "Basic Groupme Bot written in Node", - "repository": "https://github.com/petemcgrath/cool-guy-bot", + "name": "Jake's Bot", + "description": "Jake's AI replacement", + "repository": "https://github.com/TheBiggestOfBoys/bot-tutorial-nodejs", "logo": "http://www.tailgate365.com/wp-content/uploads/2011/06/tom-hanks-906.jpg", "keywords": [] } From cb038fb35244ab25ade0a05c103f85e147b01ee2 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:09:50 -0400 Subject: [PATCH 02/49] added random quotes and images, should be called randomly --- bot.js | 50 ++++++++++++++++++++++++++++++------------------- image links.txt | 4 ++++ quotes.txt | 7 +++++++ 3 files changed, 42 insertions(+), 19 deletions(-) create mode 100644 image links.txt create mode 100644 quotes.txt diff --git a/bot.js b/bot.js index d04b04016..84737f904 100644 --- a/bot.js +++ b/bot.js @@ -1,27 +1,34 @@ -var HTTPS = require('https'); -var cool = require('cool-ascii-faces'); +import { request as _request } from 'https'; var botID = process.env.BOT_ID; +const quotes = getLines("quotes.txt"); +const imageLinks = getLines("image links.txt"); + function respond() { - var request = JSON.parse(this.req.chunks[0]), - botRegex = /^\/cool guy$/; + var request = JSON.parse(this.req.chunks[0]); - if(request.text && botRegex.test(request.text)) { + if (request.text && request.text == "Activate Jake's Bot") { this.res.writeHead(200); postMessage(); this.res.end(); - } else { - console.log("don't care"); - this.res.writeHead(200); - this.res.end(); } } +function getLines(path) { + fetch(path) + .then((response) => response.text()) + .then((text) => { + const lines = text.split('\n'); // Split by newline character + console.log(lines); + }) + .catch((error) => console.error(error)); +} + function postMessage() { - var botResponse, options, body, botReq; + var botResponse, options, body, botReq, attachments; - botResponse = cool(); + botResponse = quotes[Math.random(length(quotes))]; options = { hostname: 'api.groupme.com', @@ -30,16 +37,21 @@ function postMessage() { }; body = { - "bot_id" : botID, - "text" : botResponse + bot_id : botID, + text : botResponse, + attachments : + { + type : "image", + url : "" + } }; + attachments.url = imageLinks[Math.random(length(imageLinks))]; + console.log('sending ' + botResponse + ' to ' + botID); - botReq = HTTPS.request(options, function(res) { - if(res.statusCode == 202) { - //neat - } else { + botReq = _request(options, function(res) { + if(res.statusCode != 202) { console.log('rejecting bad status code ' + res.statusCode); } }); @@ -53,5 +65,5 @@ function postMessage() { botReq.end(JSON.stringify(body)); } - -exports.respond = respond; \ No newline at end of file +const _respond = respond; +export { _respond as respond }; \ No newline at end of file diff --git a/image links.txt b/image links.txt new file mode 100644 index 000000000..0557ae764 --- /dev/null +++ b/image links.txt @@ -0,0 +1,4 @@ +https://1drv.ms/i/s!Aq3xr_iB_2BTrqEEWYxM-oo1u8693g?e=zSgIbe +https://1drv.ms/i/s!Aq3xr_iB_2BTrqB3W0VKdBuSGNDMjw?e=ByF1tz +https://1drv.ms/i/s!Aq3xr_iB_2BTrq8EMiFzmic5B_LlkQ?e=EXbmlb +https://1drv.ms/i/s!Aq3xr_iB_2BTrq8wM28GUJQdYCyFuw?e=Bp94T5 \ No newline at end of file diff --git a/quotes.txt b/quotes.txt new file mode 100644 index 000000000..6ccebc099 --- /dev/null +++ b/quotes.txt @@ -0,0 +1,7 @@ +In this world you either drip or drown, and baby, I brought the life jacket. +Ok pal +Sure buddy +Ok buster +In this world you either milk or get milked, and baby, I'm the cow. +All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit. +Tavin Reeves likes crotch shots. \ No newline at end of file From 69b593fdfae589a961701697c3ee5d49367df81f Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:16:52 -0400 Subject: [PATCH 03/49] changed wakeup phrase --- bot.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot.js b/bot.js index 84737f904..a7948ef0d 100644 --- a/bot.js +++ b/bot.js @@ -7,8 +7,9 @@ const imageLinks = getLines("image links.txt"); function respond() { var request = JSON.parse(this.req.chunks[0]); + var botRegex = /^\/Activate Jake's Bot$/; - if (request.text && request.text == "Activate Jake's Bot") { + if (request.text && botRegex.test(request.text)) { this.res.writeHead(200); postMessage(); this.res.end(); From 4f4a50f7545deb1b629001a6bb34479a8f9bbba7 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:34:11 -0400 Subject: [PATCH 04/49] fixed compatibility (hopefully) --- bot.js | 19 ++++++++++--------- image links.txt | 2 +- quotes.txt | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bot.js b/bot.js index a7948ef0d..6da3f38fc 100644 --- a/bot.js +++ b/bot.js @@ -1,15 +1,16 @@ -import { request as _request } from 'https'; +var HTTPS = require('https'); var botID = process.env.BOT_ID; -const quotes = getLines("quotes.txt"); -const imageLinks = getLines("image links.txt"); +var quotes = getLines("quotes.txt"); +var imageLinks = getLines("image links.txt"); + +var activationString = "Activate Jake's Bot" function respond() { var request = JSON.parse(this.req.chunks[0]); - var botRegex = /^\/Activate Jake's Bot$/; - if (request.text && botRegex.test(request.text)) { + if (request.text && request.text === activationString) { this.res.writeHead(200); postMessage(); this.res.end(); @@ -27,7 +28,7 @@ function getLines(path) { } function postMessage() { - var botResponse, options, body, botReq, attachments; + var botResponse, options, body, botReq; botResponse = quotes[Math.random(length(quotes))]; @@ -50,9 +51,10 @@ function postMessage() { attachments.url = imageLinks[Math.random(length(imageLinks))]; console.log('sending ' + botResponse + ' to ' + botID); + console.log(body); botReq = _request(options, function(res) { - if(res.statusCode != 202) { + if (res.statusCode != 202) { console.log('rejecting bad status code ' + res.statusCode); } }); @@ -66,5 +68,4 @@ function postMessage() { botReq.end(JSON.stringify(body)); } -const _respond = respond; -export { _respond as respond }; \ No newline at end of file +exports.respond = respond; \ No newline at end of file diff --git a/image links.txt b/image links.txt index 0557ae764..3786ea561 100644 --- a/image links.txt +++ b/image links.txt @@ -1,4 +1,4 @@ https://1drv.ms/i/s!Aq3xr_iB_2BTrqEEWYxM-oo1u8693g?e=zSgIbe https://1drv.ms/i/s!Aq3xr_iB_2BTrqB3W0VKdBuSGNDMjw?e=ByF1tz https://1drv.ms/i/s!Aq3xr_iB_2BTrq8EMiFzmic5B_LlkQ?e=EXbmlb -https://1drv.ms/i/s!Aq3xr_iB_2BTrq8wM28GUJQdYCyFuw?e=Bp94T5 \ No newline at end of file +https://1drv.ms/i/s!Aq3xr_iB_2BTrq8wM28GUJQdYCyFuw?e=Bp94T5 diff --git a/quotes.txt b/quotes.txt index 6ccebc099..35ea962ba 100644 --- a/quotes.txt +++ b/quotes.txt @@ -4,4 +4,4 @@ Sure buddy Ok buster In this world you either milk or get milked, and baby, I'm the cow. All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit. -Tavin Reeves likes crotch shots. \ No newline at end of file +Tavin Reeves likes crotch shots. From 5201d288b3fe747b9135c6e5650aff7a3199e08f Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:37:56 -0400 Subject: [PATCH 05/49] removed image capabilities (for now) --- bot.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bot.js b/bot.js index 6da3f38fc..970178dcd 100644 --- a/bot.js +++ b/bot.js @@ -3,7 +3,7 @@ var HTTPS = require('https'); var botID = process.env.BOT_ID; var quotes = getLines("quotes.txt"); -var imageLinks = getLines("image links.txt"); +//var imageLinks = getLines("image links.txt"); var activationString = "Activate Jake's Bot" @@ -41,14 +41,14 @@ function postMessage() { body = { bot_id : botID, text : botResponse, - attachments : - { - type : "image", - url : "" - } + //attachments : + //{ + // type : "image", + // url : "" + //} }; - attachments.url = imageLinks[Math.random(length(imageLinks))]; + //attachments.url = imageLinks[Math.random(length(imageLinks))]; console.log('sending ' + botResponse + ' to ' + botID); console.log(body); From 541d1ba95a5110da2df08315bd402c49572a73c4 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:50:42 -0400 Subject: [PATCH 06/49] updated to modern javascript language and removed external text files --- bot.js | 52 ++++++++++++++++++++++--------------------------- image links.txt | 4 ---- quotes.txt | 7 ------- 3 files changed, 23 insertions(+), 40 deletions(-) delete mode 100644 image links.txt delete mode 100644 quotes.txt diff --git a/bot.js b/bot.js index 970178dcd..6b41a4578 100644 --- a/bot.js +++ b/bot.js @@ -1,14 +1,21 @@ -var HTTPS = require('https'); +import HTTPS from 'https'; -var botID = process.env.BOT_ID; +let botID = process.env.BOT_ID; -var quotes = getLines("quotes.txt"); -//var imageLinks = getLines("image links.txt"); +const quotes = [ + "In this world you either drip or drown, and baby, I brought the life jacket.", + "Ok pal", + "Sure buddy", + "Ok buster", + "In this world you either milk or get milked, and baby, I'm the cow.", + "All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit.", + "Tavin Reeves likes crotch shots.", +]; -var activationString = "Activate Jake's Bot" +const activationString = "Activate Jake's Bot" function respond() { - var request = JSON.parse(this.req.chunks[0]); + let request = JSON.parse(this.req.chunks[0]); if (request.text && request.text === activationString) { this.res.writeHead(200); @@ -17,43 +24,29 @@ function respond() { } } -function getLines(path) { - fetch(path) - .then((response) => response.text()) - .then((text) => { - const lines = text.split('\n'); // Split by newline character - console.log(lines); - }) - .catch((error) => console.error(error)); +function getRandomIndex(arr) { + const randomIndex = Math.floor(Math.random() * arr.length); + return randomIndex; } function postMessage() { - var botResponse, options, body, botReq; + let botResponse = quotes[getRandomIndex(quotes)]; - botResponse = quotes[Math.random(length(quotes))]; - - options = { + let options = { hostname: 'api.groupme.com', path: '/v3/bots/post', method: 'POST' }; - body = { + let body = { bot_id : botID, - text : botResponse, - //attachments : - //{ - // type : "image", - // url : "" - //} + text : botResponse }; - - //attachments.url = imageLinks[Math.random(length(imageLinks))]; console.log('sending ' + botResponse + ' to ' + botID); console.log(body); - botReq = _request(options, function(res) { + let botReq = _request(options, function(res) { if (res.statusCode != 202) { console.log('rejecting bad status code ' + res.statusCode); } @@ -68,4 +61,5 @@ function postMessage() { botReq.end(JSON.stringify(body)); } -exports.respond = respond; \ No newline at end of file +const _respond = respond; +export { _respond as respond }; \ No newline at end of file diff --git a/image links.txt b/image links.txt deleted file mode 100644 index 3786ea561..000000000 --- a/image links.txt +++ /dev/null @@ -1,4 +0,0 @@ -https://1drv.ms/i/s!Aq3xr_iB_2BTrqEEWYxM-oo1u8693g?e=zSgIbe -https://1drv.ms/i/s!Aq3xr_iB_2BTrqB3W0VKdBuSGNDMjw?e=ByF1tz -https://1drv.ms/i/s!Aq3xr_iB_2BTrq8EMiFzmic5B_LlkQ?e=EXbmlb -https://1drv.ms/i/s!Aq3xr_iB_2BTrq8wM28GUJQdYCyFuw?e=Bp94T5 diff --git a/quotes.txt b/quotes.txt deleted file mode 100644 index 35ea962ba..000000000 --- a/quotes.txt +++ /dev/null @@ -1,7 +0,0 @@ -In this world you either drip or drown, and baby, I brought the life jacket. -Ok pal -Sure buddy -Ok buster -In this world you either milk or get milked, and baby, I'm the cow. -All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit. -Tavin Reeves likes crotch shots. From ea80097bfdfe720b5054fd9578fdf2fd02edf77d Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:55:03 -0400 Subject: [PATCH 07/49] fixed semicolons (might fix it) --- bot.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bot.js b/bot.js index 6b41a4578..a9cad4250 100644 --- a/bot.js +++ b/bot.js @@ -1,5 +1,3 @@ -import HTTPS from 'https'; - let botID = process.env.BOT_ID; const quotes = [ @@ -12,7 +10,7 @@ const quotes = [ "Tavin Reeves likes crotch shots.", ]; -const activationString = "Activate Jake's Bot" +const activationString = "Activate Jake's Bot"; function respond() { let request = JSON.parse(this.req.chunks[0]); From 4fef61205f3448c94de5380699769b2e422162c6 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:57:59 -0400 Subject: [PATCH 08/49] reverted back to old code --- bot.js | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/bot.js b/bot.js index a9cad4250..81b1e5136 100644 --- a/bot.js +++ b/bot.js @@ -1,6 +1,8 @@ -let botID = process.env.BOT_ID; +var HTTPS = require('https'); -const quotes = [ +var botID = process.env.BOT_ID; + +var quotes = [ "In this world you either drip or drown, and baby, I brought the life jacket.", "Ok pal", "Sure buddy", @@ -10,12 +12,13 @@ const quotes = [ "Tavin Reeves likes crotch shots.", ]; -const activationString = "Activate Jake's Bot"; +const activationString = "Activate Jake's Bot" function respond() { - let request = JSON.parse(this.req.chunks[0]); + var request = JSON.parse(this.req.chunks[0]); + var activationPhrase = "Activate Jake's Bot"; - if (request.text && request.text === activationString) { + if(request.text && request.text === activationPhrase) { this.res.writeHead(200); postMessage(); this.res.end(); @@ -28,24 +31,27 @@ function getRandomIndex(arr) { } function postMessage() { - let botResponse = quotes[getRandomIndex(quotes)]; + var botResponse, options, body, botReq; + + botResponse = quotes[getRandomIndex(quotes)]; - let options = { + options = { hostname: 'api.groupme.com', path: '/v3/bots/post', method: 'POST' }; - let body = { - bot_id : botID, - text : botResponse + body = { + "bot_id" : botID, + "text" : botResponse }; - + console.log('sending ' + botResponse + ' to ' + botID); - console.log(body); - let botReq = _request(options, function(res) { - if (res.statusCode != 202) { + botReq = HTTPS.request(options, function(res) { + if(res.statusCode == 202) { + //neat + } else { console.log('rejecting bad status code ' + res.statusCode); } }); @@ -59,5 +65,5 @@ function postMessage() { botReq.end(JSON.stringify(body)); } -const _respond = respond; -export { _respond as respond }; \ No newline at end of file + +exports.respond = respond; \ No newline at end of file From c0290cf144b1769629e8f388c6e71085d15cc052 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Thu, 11 Apr 2024 23:55:09 -0400 Subject: [PATCH 09/49] reimplement correct image urls --- bot.js | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/bot.js b/bot.js index 81b1e5136..72e8848cb 100644 --- a/bot.js +++ b/bot.js @@ -1,8 +1,8 @@ var HTTPS = require('https'); -var botID = process.env.BOT_ID; +const botID = process.env.BOT_ID; -var quotes = [ +const quotes = [ "In this world you either drip or drown, and baby, I brought the life jacket.", "Ok pal", "Sure buddy", @@ -12,13 +12,21 @@ var quotes = [ "Tavin Reeves likes crotch shots.", ]; -const activationString = "Activate Jake's Bot" +const imageURLs = [ + "https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842.large", + "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d", + "https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5", + "https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3", + "https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77", + "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751", +] + +const activationPhrase = "Activate that sucka!" function respond() { var request = JSON.parse(this.req.chunks[0]); - var activationPhrase = "Activate Jake's Bot"; - if(request.text && request.text === activationPhrase) { + if (request.text && request.text === activationPhrase) { this.res.writeHead(200); postMessage(); this.res.end(); @@ -31,9 +39,10 @@ function getRandomIndex(arr) { } function postMessage() { - var botResponse, options, body, botReq; + var botResponse, options, body, botReq, imageURL; botResponse = quotes[getRandomIndex(quotes)]; + imageURL = imageURLs[getRandomIndex(imageURLs)]; options = { hostname: 'api.groupme.com', @@ -42,16 +51,18 @@ function postMessage() { }; body = { - "bot_id" : botID, - "text" : botResponse + bot_id : botID, + text : botResponse, + attachments : { + type : "image", + url : imageURL + } }; console.log('sending ' + botResponse + ' to ' + botID); botReq = HTTPS.request(options, function(res) { - if(res.statusCode == 202) { - //neat - } else { + if (res.statusCode != 202) { console.log('rejecting bad status code ' + res.statusCode); } }); From f411d05dbe83d6341222da3b369e42459fa9cfd7 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Fri, 12 Apr 2024 00:15:54 -0400 Subject: [PATCH 10/49] fixed .large links, added quotifying --- bot.js | 46 ++++++++++++++++++++++++++++++++++++++-------- index.js | 5 ++--- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/bot.js b/bot.js index 72e8848cb..e91932a30 100644 --- a/bot.js +++ b/bot.js @@ -14,16 +14,20 @@ const quotes = [ const imageURLs = [ "https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842.large", - "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d", - "https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5", - "https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3", - "https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77", - "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751", -] + "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d.large", + "https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5.large", + "https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3.large", + "https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77.large", + "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751.large", +]; + +const activationPhrase = "Activate that sucka!"; +const quotifyPhrase = '"Bot"'; -const activationPhrase = "Activate that sucka!" +var shouldQuotify = false; function respond() { + shouldQuotify = false; var request = JSON.parse(this.req.chunks[0]); if (request.text && request.text === activationPhrase) { @@ -31,6 +35,13 @@ function respond() { postMessage(); this.res.end(); } + + if (request.text && request.text === quotifyPhrase) { + shouldQuotify = true; + this.res.writeHead(200); + postMessage(); + this.res.end(); + } } function getRandomIndex(arr) { @@ -38,10 +49,29 @@ function getRandomIndex(arr) { return randomIndex; } +function quotify(string, amount) { + var quotifiedString = ""; + string.forEach(element => { + if (Math.random() > amount) { + quotifiedString += '"' + element + '" '; + } + else { + quotifiedString += element; + } + }); + return quotifiedString; +} + function postMessage() { var botResponse, options, body, botReq, imageURL; - botResponse = quotes[getRandomIndex(quotes)]; + if (shouldQuotify) { + botResponse = quotify(quotes[getRandomIndex(quotes)]); + } + else { + botResponse = quotes[getRandomIndex(quotes)]; + } + imageURL = imageURLs[getRandomIndex(imageURLs)]; options = { diff --git a/index.js b/index.js index 672900471..f1e14b558 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,7 @@ -var http, director, cool, bot, router, server, port; +var http, director, bot, router, server, port; http = require('http'); director = require('director'); -cool = require('cool-ascii-faces'); bot = require('./bot.js'); router = new director.http.Router({ @@ -29,5 +28,5 @@ server.listen(port); function ping() { this.res.writeHead(200); - this.res.end("Hey, I'm Cool Guy."); + this.res.end('"Jake" Bot'); } \ No newline at end of file From ab9fa0e591caad6e3c41984617e4375ffea362b0 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Fri, 12 Apr 2024 00:18:22 -0400 Subject: [PATCH 11/49] undid quotify inplementation --- bot.js | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/bot.js b/bot.js index e91932a30..5497cc7f5 100644 --- a/bot.js +++ b/bot.js @@ -22,12 +22,8 @@ const imageURLs = [ ]; const activationPhrase = "Activate that sucka!"; -const quotifyPhrase = '"Bot"'; - -var shouldQuotify = false; function respond() { - shouldQuotify = false; var request = JSON.parse(this.req.chunks[0]); if (request.text && request.text === activationPhrase) { @@ -35,18 +31,10 @@ function respond() { postMessage(); this.res.end(); } - - if (request.text && request.text === quotifyPhrase) { - shouldQuotify = true; - this.res.writeHead(200); - postMessage(); - this.res.end(); - } } function getRandomIndex(arr) { - const randomIndex = Math.floor(Math.random() * arr.length); - return randomIndex; + return Math.floor(Math.random() * arr.length); } function quotify(string, amount) { @@ -65,12 +53,7 @@ function quotify(string, amount) { function postMessage() { var botResponse, options, body, botReq, imageURL; - if (shouldQuotify) { - botResponse = quotify(quotes[getRandomIndex(quotes)]); - } - else { - botResponse = quotes[getRandomIndex(quotes)]; - } + botResponse = quotes[getRandomIndex(quotes)]; imageURL = imageURLs[getRandomIndex(imageURLs)]; From 703b16a7bc1a5dcd7f50d7f91d87e259cfcd1746 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Fri, 12 Apr 2024 00:22:44 -0400 Subject: [PATCH 12/49] undid more quotification --- bot.js | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/bot.js b/bot.js index 5497cc7f5..dd086cddb 100644 --- a/bot.js +++ b/bot.js @@ -37,19 +37,6 @@ function getRandomIndex(arr) { return Math.floor(Math.random() * arr.length); } -function quotify(string, amount) { - var quotifiedString = ""; - string.forEach(element => { - if (Math.random() > amount) { - quotifiedString += '"' + element + '" '; - } - else { - quotifiedString += element; - } - }); - return quotifiedString; -} - function postMessage() { var botResponse, options, body, botReq, imageURL; @@ -64,27 +51,27 @@ function postMessage() { }; body = { - bot_id : botID, - text : botResponse, - attachments : { - type : "image", - url : imageURL + bot_id: botID, + text: botResponse, + attachments: { + type: "image", + url: imageURL } }; console.log('sending ' + botResponse + ' to ' + botID); - botReq = HTTPS.request(options, function(res) { - if (res.statusCode != 202) { - console.log('rejecting bad status code ' + res.statusCode); - } + botReq = HTTPS.request(options, function (res) { + if (res.statusCode != 202) { + console.log('rejecting bad status code ' + res.statusCode); + } }); - botReq.on('error', function(err) { - console.log('error posting message ' + JSON.stringify(err)); + botReq.on('error', function (err) { + console.log('error posting message ' + JSON.stringify(err)); }); - botReq.on('timeout', function(err) { - console.log('timeout posting message ' + JSON.stringify(err)); + botReq.on('timeout', function (err) { + console.log('timeout posting message ' + JSON.stringify(err)); }); botReq.end(JSON.stringify(body)); } From 2e3c49ab57672090e43af0e1898f4cae1e934381 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Fri, 12 Apr 2024 00:32:49 -0400 Subject: [PATCH 13/49] cleaned up, variable declarations --- bot.js | 43 +++++++++++++++++++++---------------------- public/node.svg | 17 ----------------- 2 files changed, 21 insertions(+), 39 deletions(-) delete mode 100644 public/node.svg diff --git a/bot.js b/bot.js index dd086cddb..93d8b6ec9 100644 --- a/bot.js +++ b/bot.js @@ -2,6 +2,21 @@ var HTTPS = require('https'); const botID = process.env.BOT_ID; +const options = { + hostname: 'api.groupme.com', + path: '/v3/bots/post', + method: 'POST' +}; + +var body = { + bot_id: botID, + text: "", + attachments: { + type: "image", + url: "" + } +}; + const quotes = [ "In this world you either drip or drown, and baby, I brought the life jacket.", "Ok pal", @@ -38,30 +53,15 @@ function getRandomIndex(arr) { } function postMessage() { - var botResponse, options, body, botReq, imageURL; - - botResponse = quotes[getRandomIndex(quotes)]; - - imageURL = imageURLs[getRandomIndex(imageURLs)]; + var botResponse = quotes[getRandomIndex(quotes)]; + var imageURL = imageURLs[getRandomIndex(imageURLs)]; - options = { - hostname: 'api.groupme.com', - path: '/v3/bots/post', - method: 'POST' - }; - - body = { - bot_id: botID, - text: botResponse, - attachments: { - type: "image", - url: imageURL - } - }; + body.text = botResponse; + body.attachments.url = imageURL; console.log('sending ' + botResponse + ' to ' + botID); - botReq = HTTPS.request(options, function (res) { + var botReq = HTTPS.request(options, function (res) { if (res.statusCode != 202) { console.log('rejecting bad status code ' + res.statusCode); } @@ -76,5 +76,4 @@ function postMessage() { botReq.end(JSON.stringify(body)); } - -exports.respond = respond; \ No newline at end of file +exports.respond = respond; diff --git a/public/node.svg b/public/node.svg deleted file mode 100644 index 3c7e16136..000000000 --- a/public/node.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - From 3db95607ce3a191f380e7a310f6bb3e77fc8a92a Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Fri, 12 Apr 2024 00:40:48 -0400 Subject: [PATCH 14/49] changed imports and variable declarations --- bot.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bot.js b/bot.js index 93d8b6ec9..6611da6ee 100644 --- a/bot.js +++ b/bot.js @@ -1,4 +1,4 @@ -var HTTPS = require('https'); +import { request as _request } from 'https'; const botID = process.env.BOT_ID; @@ -8,7 +8,7 @@ const options = { method: 'POST' }; -var body = { +let body = { bot_id: botID, text: "", attachments: { @@ -39,7 +39,7 @@ const imageURLs = [ const activationPhrase = "Activate that sucka!"; function respond() { - var request = JSON.parse(this.req.chunks[0]); + let request = JSON.parse(this.req.chunks[0]); if (request.text && request.text === activationPhrase) { this.res.writeHead(200); @@ -53,15 +53,15 @@ function getRandomIndex(arr) { } function postMessage() { - var botResponse = quotes[getRandomIndex(quotes)]; - var imageURL = imageURLs[getRandomIndex(imageURLs)]; + let botResponse = quotes[getRandomIndex(quotes)]; + let imageURL = imageURLs[getRandomIndex(imageURLs)]; body.text = botResponse; body.attachments.url = imageURL; console.log('sending ' + botResponse + ' to ' + botID); - var botReq = HTTPS.request(options, function (res) { + let botReq = _request(options, function (res) { if (res.statusCode != 202) { console.log('rejecting bad status code ' + res.statusCode); } @@ -76,4 +76,5 @@ function postMessage() { botReq.end(JSON.stringify(body)); } -exports.respond = respond; +const _respond = respond; +export { _respond as respond }; From 949917a776749b38b41069c9178d0e9f9c83ef02 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Fri, 12 Apr 2024 00:45:15 -0400 Subject: [PATCH 15/49] Revert "changed imports and variable declarations" This reverts commit 3db95607ce3a191f380e7a310f6bb3e77fc8a92a. --- bot.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/bot.js b/bot.js index 6611da6ee..93d8b6ec9 100644 --- a/bot.js +++ b/bot.js @@ -1,4 +1,4 @@ -import { request as _request } from 'https'; +var HTTPS = require('https'); const botID = process.env.BOT_ID; @@ -8,7 +8,7 @@ const options = { method: 'POST' }; -let body = { +var body = { bot_id: botID, text: "", attachments: { @@ -39,7 +39,7 @@ const imageURLs = [ const activationPhrase = "Activate that sucka!"; function respond() { - let request = JSON.parse(this.req.chunks[0]); + var request = JSON.parse(this.req.chunks[0]); if (request.text && request.text === activationPhrase) { this.res.writeHead(200); @@ -53,15 +53,15 @@ function getRandomIndex(arr) { } function postMessage() { - let botResponse = quotes[getRandomIndex(quotes)]; - let imageURL = imageURLs[getRandomIndex(imageURLs)]; + var botResponse = quotes[getRandomIndex(quotes)]; + var imageURL = imageURLs[getRandomIndex(imageURLs)]; body.text = botResponse; body.attachments.url = imageURL; console.log('sending ' + botResponse + ' to ' + botID); - let botReq = _request(options, function (res) { + var botReq = HTTPS.request(options, function (res) { if (res.statusCode != 202) { console.log('rejecting bad status code ' + res.statusCode); } @@ -76,5 +76,4 @@ function postMessage() { botReq.end(JSON.stringify(body)); } -const _respond = respond; -export { _respond as respond }; +exports.respond = respond; From 8dbf122ea70b2fa61d87d6c8f6b7aece04ed2c6e Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Fri, 12 Apr 2024 00:46:38 -0400 Subject: [PATCH 16/49] Revert "cleaned up, variable declarations" This reverts commit 2e3c49ab57672090e43af0e1898f4cae1e934381. tried to fix import to see what causes the error --- bot.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bot.js b/bot.js index 93d8b6ec9..129d81852 100644 --- a/bot.js +++ b/bot.js @@ -1,4 +1,4 @@ -var HTTPS = require('https'); +import { request as _request } from 'https'; const botID = process.env.BOT_ID; @@ -61,7 +61,7 @@ function postMessage() { console.log('sending ' + botResponse + ' to ' + botID); - var botReq = HTTPS.request(options, function (res) { + var botReq = _request(options, function (res) { if (res.statusCode != 202) { console.log('rejecting bad status code ' + res.statusCode); } @@ -76,4 +76,5 @@ function postMessage() { botReq.end(JSON.stringify(body)); } -exports.respond = respond; +const _respond = respond; +export { _respond as respond }; From 89329710eea8492fd2636a6986a377ab0008ef2f Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Fri, 12 Apr 2024 00:47:15 -0400 Subject: [PATCH 17/49] Reapply "cleaned up, variable declarations" This reverts commit 8dbf122ea70b2fa61d87d6c8f6b7aece04ed2c6e. --- bot.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bot.js b/bot.js index 129d81852..93d8b6ec9 100644 --- a/bot.js +++ b/bot.js @@ -1,4 +1,4 @@ -import { request as _request } from 'https'; +var HTTPS = require('https'); const botID = process.env.BOT_ID; @@ -61,7 +61,7 @@ function postMessage() { console.log('sending ' + botResponse + ' to ' + botID); - var botReq = _request(options, function (res) { + var botReq = HTTPS.request(options, function (res) { if (res.statusCode != 202) { console.log('rejecting bad status code ' + res.statusCode); } @@ -76,5 +76,4 @@ function postMessage() { botReq.end(JSON.stringify(body)); } -const _respond = respond; -export { _respond as respond }; +exports.respond = respond; From 21da7ce3b0334ee11091f0cb4f1c8702a9136386 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Fri, 12 Apr 2024 00:47:52 -0400 Subject: [PATCH 18/49] reverted import fix changed var to let --- bot.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bot.js b/bot.js index 93d8b6ec9..fe1e08218 100644 --- a/bot.js +++ b/bot.js @@ -1,4 +1,4 @@ -var HTTPS = require('https'); +let HTTPS = require('https'); const botID = process.env.BOT_ID; @@ -8,7 +8,7 @@ const options = { method: 'POST' }; -var body = { +let body = { bot_id: botID, text: "", attachments: { @@ -39,7 +39,7 @@ const imageURLs = [ const activationPhrase = "Activate that sucka!"; function respond() { - var request = JSON.parse(this.req.chunks[0]); + let request = JSON.parse(this.req.chunks[0]); if (request.text && request.text === activationPhrase) { this.res.writeHead(200); @@ -53,15 +53,15 @@ function getRandomIndex(arr) { } function postMessage() { - var botResponse = quotes[getRandomIndex(quotes)]; - var imageURL = imageURLs[getRandomIndex(imageURLs)]; + let botResponse = quotes[getRandomIndex(quotes)]; + let imageURL = imageURLs[getRandomIndex(imageURLs)]; body.text = botResponse; body.attachments.url = imageURL; console.log('sending ' + botResponse + ' to ' + botID); - var botReq = HTTPS.request(options, function (res) { + let botReq = HTTPS.request(options, function (res) { if (res.statusCode != 202) { console.log('rejecting bad status code ' + res.statusCode); } From 9ecff2ad4f57612947ef1ccf5aaf9629b9df475e Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Fri, 12 Apr 2024 00:48:32 -0400 Subject: [PATCH 19/49] Revert "reverted import fix" This reverts commit 21da7ce3b0334ee11091f0cb4f1c8702a9136386. --- bot.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bot.js b/bot.js index fe1e08218..93d8b6ec9 100644 --- a/bot.js +++ b/bot.js @@ -1,4 +1,4 @@ -let HTTPS = require('https'); +var HTTPS = require('https'); const botID = process.env.BOT_ID; @@ -8,7 +8,7 @@ const options = { method: 'POST' }; -let body = { +var body = { bot_id: botID, text: "", attachments: { @@ -39,7 +39,7 @@ const imageURLs = [ const activationPhrase = "Activate that sucka!"; function respond() { - let request = JSON.parse(this.req.chunks[0]); + var request = JSON.parse(this.req.chunks[0]); if (request.text && request.text === activationPhrase) { this.res.writeHead(200); @@ -53,15 +53,15 @@ function getRandomIndex(arr) { } function postMessage() { - let botResponse = quotes[getRandomIndex(quotes)]; - let imageURL = imageURLs[getRandomIndex(imageURLs)]; + var botResponse = quotes[getRandomIndex(quotes)]; + var imageURL = imageURLs[getRandomIndex(imageURLs)]; body.text = botResponse; body.attachments.url = imageURL; console.log('sending ' + botResponse + ' to ' + botID); - let botReq = HTTPS.request(options, function (res) { + var botReq = HTTPS.request(options, function (res) { if (res.statusCode != 202) { console.log('rejecting bad status code ' + res.statusCode); } From 5637fda1f574a9607b379a9a91f0e0ef2b8628b2 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Fri, 12 Apr 2024 11:03:59 -0400 Subject: [PATCH 20/49] Update bot.js added more quotes --- bot.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bot.js b/bot.js index 93d8b6ec9..3e3b1a36f 100644 --- a/bot.js +++ b/bot.js @@ -25,6 +25,22 @@ const quotes = [ "In this world you either milk or get milked, and baby, I'm the cow.", "All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit.", "Tavin Reeves likes crotch shots.", + "Uhhhh, yeah", + "That's right!", + "So true!", + "I hardly know her!", + "πŸ’€", + "πŸ—Ώ", + "β˜οΈπŸ€“", + "β˜οΈπŸ€“ Erhm, akshulally", + "You can save by bundling Home & Auto", + "[RΓ‹DÁÇTÊD]", + "Hello, I'm Jake", + "Look at me, I'm Jake, I'm so tall and cool and attractive", + "bruh", + "**VINE BOOM SOUND EFFECT**", + "Otis.png" + "RIP [RΓ‹DÁÇTÊD] Week", ]; const imageURLs = [ From e6826d83be37fe0b54de60b83afe443082b829f8 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Fri, 12 Apr 2024 11:14:13 -0400 Subject: [PATCH 21/49] Update bot.js added missing comma --- bot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.js b/bot.js index 3e3b1a36f..0f368630f 100644 --- a/bot.js +++ b/bot.js @@ -39,7 +39,7 @@ const quotes = [ "Look at me, I'm Jake, I'm so tall and cool and attractive", "bruh", "**VINE BOOM SOUND EFFECT**", - "Otis.png" + "Otis.png", "RIP [RΓ‹DÁÇTÊD] Week", ]; From 02bb2ff2ef97e60ef6cbe4135768fb2081cc4344 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 21:58:51 -0400 Subject: [PATCH 22/49] New branch with more message funcitons I formatted the tabs, and made more message types and if checks --- bot.js | 152 ++++++++++++++++++++++++++++++++----------------------- index.js | 34 ++++++------- 2 files changed, 106 insertions(+), 80 deletions(-) diff --git a/bot.js b/bot.js index 0f368630f..4fee4056b 100644 --- a/bot.js +++ b/bot.js @@ -3,93 +3,119 @@ var HTTPS = require('https'); const botID = process.env.BOT_ID; const options = { - hostname: 'api.groupme.com', - path: '/v3/bots/post', - method: 'POST' + hostname: 'api.groupme.com', + path: '/v3/bots/post', + method: 'POST' }; var body = { - bot_id: botID, - text: "", - attachments: { - type: "image", - url: "" - } + bot_id: botID, + text: "", + attachments: { + type: "image", + url: "" + } }; const quotes = [ - "In this world you either drip or drown, and baby, I brought the life jacket.", - "Ok pal", - "Sure buddy", - "Ok buster", - "In this world you either milk or get milked, and baby, I'm the cow.", - "All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit.", - "Tavin Reeves likes crotch shots.", - "Uhhhh, yeah", - "That's right!", - "So true!", - "I hardly know her!", - "πŸ’€", - "πŸ—Ώ", - "β˜οΈπŸ€“", - "β˜οΈπŸ€“ Erhm, akshulally", - "You can save by bundling Home & Auto", - "[RΓ‹DÁÇTÊD]", - "Hello, I'm Jake", - "Look at me, I'm Jake, I'm so tall and cool and attractive", - "bruh", - "**VINE BOOM SOUND EFFECT**", - "Otis.png", - "RIP [RΓ‹DÁÇTÊD] Week", + "In this world you either drip or drown, and baby, I brought the life jacket.", + "Ok pal", + "Sure buddy", + "Ok buster", + "In this world you either milk or get milked, and baby, I'm the cow.", + "All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit.", + "Tavin Reeves likes crotch shots.", + "Uhhhh, yeah", + "That's right!", + "So true!", + "I hardly know her!", + "πŸ’€", + "πŸ—Ώ", + "β˜οΈπŸ€“", + "β˜οΈπŸ€“ Erhm, akshulally", + "You can save by bundling Home & Auto", + "[RΓ‹DÁÇTÊD]", + "Hello, I'm Jake", + "Look at me, I'm Jake, I'm so tall and cool and attractive", + "bruh", + "**VINE BOOM SOUND EFFECT**", + "Otis.png", + "RIP [RΓ‹DÁÇTÊD] Week", ]; const imageURLs = [ - "https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842.large", - "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d.large", - "https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5.large", - "https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3.large", - "https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77.large", - "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751.large", + "https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842.large", + "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d.large", + "https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5.large", + "https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3.large", + "https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77.large", + "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751.large", ]; const activationPhrase = "Activate that sucka!"; function respond() { - var request = JSON.parse(this.req.chunks[0]); + var request = JSON.parse(this.req.chunks[0]); - if (request.text && request.text === activationPhrase) { - this.res.writeHead(200); - postMessage(); - this.res.end(); - } + if (request.text && request.text === activationPhrase) { + this.res.writeHead(200); + postMessage(quotes[getRandomIndex(quotes)]); + this.res.end(); + } + + if (request.text && request.text.includes("er")) { + var words = request.text.split(' '); + words.forEach(word => { + if (word.includes("er")) { + this.res.writeHead(200); + postMessage(word[0].upper() + word.substring(1, word.length - 2) + "her? I hardly know her!"); + this.res.end(); + } + }); + } + + if (request.text && request.text.includes('"')) { + var words = request.text.split(' '); + var quotifiedString = ""; + words.forEach(word => { + if (Math.random() > 0.25) { + quotifiedString += '"' + word + '" '; + } + else { + quotifiedString += word; + } + }); + this.res.writeHead(200); + postMessage(quotifiedString); + this.res.end(); + } } function getRandomIndex(arr) { - return Math.floor(Math.random() * arr.length); + return Math.floor(Math.random() * arr.length); } -function postMessage() { - var botResponse = quotes[getRandomIndex(quotes)]; - var imageURL = imageURLs[getRandomIndex(imageURLs)]; +function postMessage(text) { + //var imageURL = imageURLs[getRandomIndex(imageURLs)]; - body.text = botResponse; - body.attachments.url = imageURL; + body.text = text; + //body.attachments.url = imageURL; - console.log('sending ' + botResponse + ' to ' + botID); + console.log('sending ' + text + ' to ' + botID); - var botReq = HTTPS.request(options, function (res) { - if (res.statusCode != 202) { - console.log('rejecting bad status code ' + res.statusCode); - } - }); + var botReq = HTTPS.request(options, function (res) { + if (res.statusCode != 202) { + console.log('rejecting bad status code ' + res.statusCode); + } + }); - botReq.on('error', function (err) { - console.log('error posting message ' + JSON.stringify(err)); - }); - botReq.on('timeout', function (err) { - console.log('timeout posting message ' + JSON.stringify(err)); - }); - botReq.end(JSON.stringify(body)); + botReq.on('error', function (err) { + console.log('error posting message ' + JSON.stringify(err)); + }); + botReq.on('timeout', function (err) { + console.log('timeout posting message ' + JSON.stringify(err)); + }); + botReq.end(JSON.stringify(body)); } exports.respond = respond; diff --git a/index.js b/index.js index f1e14b558..569aa2403 100644 --- a/index.js +++ b/index.js @@ -1,32 +1,32 @@ var http, director, bot, router, server, port; -http = require('http'); -director = require('director'); -bot = require('./bot.js'); +http = require('http'); +director = require('director'); +bot = require('./bot.js'); router = new director.http.Router({ - '/' : { - post: bot.respond, - get: ping - } + '/': { + post: bot.respond, + get: ping + } }); server = http.createServer(function (req, res) { - req.chunks = []; - req.on('data', function (chunk) { - req.chunks.push(chunk.toString()); - }); + req.chunks = []; + req.on('data', function (chunk) { + req.chunks.push(chunk.toString()); + }); - router.dispatch(req, res, function(err) { - res.writeHead(err.status, {"Content-Type": "text/plain"}); - res.end(err.message); - }); + router.dispatch(req, res, function (err) { + res.writeHead(err.status, { "Content-Type": "text/plain" }); + res.end(err.message); + }); }); port = Number(process.env.PORT || 5000); server.listen(port); function ping() { - this.res.writeHead(200); - this.res.end('"Jake" Bot'); + this.res.writeHead(200); + this.res.end('"Jake" Bot'); } \ No newline at end of file From 601e51004489e79392fe795f2eceea6293cf8211 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 22:04:50 -0400 Subject: [PATCH 23/49] Revert "Merge pull request #1 from TheBiggestOfBoys/testing" This reverts commit 2647f2718c0b1c6f6a3ef9337a0949ce1ac8a06b, reversing changes made to e6826d83be37fe0b54de60b83afe443082b829f8. --- bot.js | 152 +++++++++++++++++++++++-------------------------------- index.js | 34 ++++++------- 2 files changed, 80 insertions(+), 106 deletions(-) diff --git a/bot.js b/bot.js index 4fee4056b..0f368630f 100644 --- a/bot.js +++ b/bot.js @@ -3,119 +3,93 @@ var HTTPS = require('https'); const botID = process.env.BOT_ID; const options = { - hostname: 'api.groupme.com', - path: '/v3/bots/post', - method: 'POST' + hostname: 'api.groupme.com', + path: '/v3/bots/post', + method: 'POST' }; var body = { - bot_id: botID, - text: "", - attachments: { - type: "image", - url: "" - } + bot_id: botID, + text: "", + attachments: { + type: "image", + url: "" + } }; const quotes = [ - "In this world you either drip or drown, and baby, I brought the life jacket.", - "Ok pal", - "Sure buddy", - "Ok buster", - "In this world you either milk or get milked, and baby, I'm the cow.", - "All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit.", - "Tavin Reeves likes crotch shots.", - "Uhhhh, yeah", - "That's right!", - "So true!", - "I hardly know her!", - "πŸ’€", - "πŸ—Ώ", - "β˜οΈπŸ€“", - "β˜οΈπŸ€“ Erhm, akshulally", - "You can save by bundling Home & Auto", - "[RΓ‹DÁÇTÊD]", - "Hello, I'm Jake", - "Look at me, I'm Jake, I'm so tall and cool and attractive", - "bruh", - "**VINE BOOM SOUND EFFECT**", - "Otis.png", - "RIP [RΓ‹DÁÇTÊD] Week", + "In this world you either drip or drown, and baby, I brought the life jacket.", + "Ok pal", + "Sure buddy", + "Ok buster", + "In this world you either milk or get milked, and baby, I'm the cow.", + "All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit.", + "Tavin Reeves likes crotch shots.", + "Uhhhh, yeah", + "That's right!", + "So true!", + "I hardly know her!", + "πŸ’€", + "πŸ—Ώ", + "β˜οΈπŸ€“", + "β˜οΈπŸ€“ Erhm, akshulally", + "You can save by bundling Home & Auto", + "[RΓ‹DÁÇTÊD]", + "Hello, I'm Jake", + "Look at me, I'm Jake, I'm so tall and cool and attractive", + "bruh", + "**VINE BOOM SOUND EFFECT**", + "Otis.png", + "RIP [RΓ‹DÁÇTÊD] Week", ]; const imageURLs = [ - "https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842.large", - "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d.large", - "https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5.large", - "https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3.large", - "https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77.large", - "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751.large", + "https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842.large", + "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d.large", + "https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5.large", + "https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3.large", + "https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77.large", + "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751.large", ]; const activationPhrase = "Activate that sucka!"; function respond() { - var request = JSON.parse(this.req.chunks[0]); + var request = JSON.parse(this.req.chunks[0]); - if (request.text && request.text === activationPhrase) { - this.res.writeHead(200); - postMessage(quotes[getRandomIndex(quotes)]); - this.res.end(); - } - - if (request.text && request.text.includes("er")) { - var words = request.text.split(' '); - words.forEach(word => { - if (word.includes("er")) { - this.res.writeHead(200); - postMessage(word[0].upper() + word.substring(1, word.length - 2) + "her? I hardly know her!"); - this.res.end(); - } - }); - } - - if (request.text && request.text.includes('"')) { - var words = request.text.split(' '); - var quotifiedString = ""; - words.forEach(word => { - if (Math.random() > 0.25) { - quotifiedString += '"' + word + '" '; - } - else { - quotifiedString += word; - } - }); - this.res.writeHead(200); - postMessage(quotifiedString); - this.res.end(); - } + if (request.text && request.text === activationPhrase) { + this.res.writeHead(200); + postMessage(); + this.res.end(); + } } function getRandomIndex(arr) { - return Math.floor(Math.random() * arr.length); + return Math.floor(Math.random() * arr.length); } -function postMessage(text) { - //var imageURL = imageURLs[getRandomIndex(imageURLs)]; +function postMessage() { + var botResponse = quotes[getRandomIndex(quotes)]; + var imageURL = imageURLs[getRandomIndex(imageURLs)]; - body.text = text; - //body.attachments.url = imageURL; + body.text = botResponse; + body.attachments.url = imageURL; - console.log('sending ' + text + ' to ' + botID); + console.log('sending ' + botResponse + ' to ' + botID); - var botReq = HTTPS.request(options, function (res) { - if (res.statusCode != 202) { - console.log('rejecting bad status code ' + res.statusCode); - } - }); + var botReq = HTTPS.request(options, function (res) { + if (res.statusCode != 202) { + console.log('rejecting bad status code ' + res.statusCode); + } + }); - botReq.on('error', function (err) { - console.log('error posting message ' + JSON.stringify(err)); - }); - botReq.on('timeout', function (err) { - console.log('timeout posting message ' + JSON.stringify(err)); - }); - botReq.end(JSON.stringify(body)); + botReq.on('error', function (err) { + console.log('error posting message ' + JSON.stringify(err)); + }); + botReq.on('timeout', function (err) { + console.log('timeout posting message ' + JSON.stringify(err)); + }); + botReq.end(JSON.stringify(body)); } exports.respond = respond; diff --git a/index.js b/index.js index 569aa2403..f1e14b558 100644 --- a/index.js +++ b/index.js @@ -1,32 +1,32 @@ var http, director, bot, router, server, port; -http = require('http'); -director = require('director'); -bot = require('./bot.js'); +http = require('http'); +director = require('director'); +bot = require('./bot.js'); router = new director.http.Router({ - '/': { - post: bot.respond, - get: ping - } + '/' : { + post: bot.respond, + get: ping + } }); server = http.createServer(function (req, res) { - req.chunks = []; - req.on('data', function (chunk) { - req.chunks.push(chunk.toString()); - }); + req.chunks = []; + req.on('data', function (chunk) { + req.chunks.push(chunk.toString()); + }); - router.dispatch(req, res, function (err) { - res.writeHead(err.status, { "Content-Type": "text/plain" }); - res.end(err.message); - }); + router.dispatch(req, res, function(err) { + res.writeHead(err.status, {"Content-Type": "text/plain"}); + res.end(err.message); + }); }); port = Number(process.env.PORT || 5000); server.listen(port); function ping() { - this.res.writeHead(200); - this.res.end('"Jake" Bot'); + this.res.writeHead(200); + this.res.end('"Jake" Bot'); } \ No newline at end of file From 57d70a7b71769ae05597d9d8e98b27486fbc5fb6 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 22:13:12 -0400 Subject: [PATCH 24/49] Fixed broken ".upper()" method --- bot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.js b/bot.js index 4fee4056b..d54ac234b 100644 --- a/bot.js +++ b/bot.js @@ -68,7 +68,7 @@ function respond() { words.forEach(word => { if (word.includes("er")) { this.res.writeHead(200); - postMessage(word[0].upper() + word.substring(1, word.length - 2) + "her? I hardly know her!"); + postMessage(word[0].toUpperCase() + word.substring(1, word.length - 2) + " her? I hardly know her!"); this.res.end(); } }); From 03db330d61c8590cfb6b5a5017fd5d86537d9a0f Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 22:23:51 -0400 Subject: [PATCH 25/49] removed image functionality --- bot.js | 78 ++++++++++++++++++++++++---------------------------------- 1 file changed, 32 insertions(+), 46 deletions(-) diff --git a/bot.js b/bot.js index d54ac234b..c3b7df92f 100644 --- a/bot.js +++ b/bot.js @@ -10,11 +10,7 @@ const options = { var body = { bot_id: botID, - text: "", - attachments: { - type: "image", - url: "" - } + text: "" }; const quotes = [ @@ -43,51 +39,44 @@ const quotes = [ "RIP [RΓ‹DÁÇTÊD] Week", ]; -const imageURLs = [ - "https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842.large", - "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d.large", - "https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5.large", - "https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3.large", - "https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77.large", - "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751.large", -]; - const activationPhrase = "Activate that sucka!"; function respond() { var request = JSON.parse(this.req.chunks[0]); - if (request.text && request.text === activationPhrase) { - this.res.writeHead(200); - postMessage(quotes[getRandomIndex(quotes)]); - this.res.end(); - } + if (request.text) { + if (request.text === activationPhrase) { + this.res.writeHead(200); + postMessage(quotes[getRandomIndex(quotes)]); + this.res.end(); + } - if (request.text && request.text.includes("er")) { - var words = request.text.split(' '); - words.forEach(word => { - if (word.includes("er")) { - this.res.writeHead(200); - postMessage(word[0].toUpperCase() + word.substring(1, word.length - 2) + " her? I hardly know her!"); - this.res.end(); - } - }); - } + if (request.text.includes("er")) { + var words = request.text.split(); + words.forEach(word => { + if (word.includes("er")) { + this.res.writeHead(200); + postMessage(word[0].toUpperCase() + word.substring(1, word.length - 2) + " her? I hardly know her!"); + this.res.end(); + } + }); + } - if (request.text && request.text.includes('"')) { - var words = request.text.split(' '); - var quotifiedString = ""; - words.forEach(word => { - if (Math.random() > 0.25) { - quotifiedString += '"' + word + '" '; - } - else { - quotifiedString += word; - } - }); - this.res.writeHead(200); - postMessage(quotifiedString); - this.res.end(); + if (request.text.includes('"')) { + var words = request.text.split(); + var quotifiedString = ""; + words.forEach(word => { + if (Math.random() > 0.25) { + quotifiedString += '"' + word + '" '; + } + else { + quotifiedString += word; + } + }); + this.res.writeHead(200); + postMessage(quotifiedString); + this.res.end(); + } } } @@ -96,10 +85,7 @@ function getRandomIndex(arr) { } function postMessage(text) { - //var imageURL = imageURLs[getRandomIndex(imageURLs)]; - body.text = text; - //body.attachments.url = imageURL; console.log('sending ' + text + ' to ' + botID); From d309ec95cc4fbc2b3e786151ff23cb1333422bef Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 22:35:41 -0400 Subject: [PATCH 26/49] fixed variable declarations in index.js --- index.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index 569aa2403..112203642 100644 --- a/index.js +++ b/index.js @@ -1,17 +1,15 @@ -var http, director, bot, router, server, port; +var http = require('http'); +var director = require('director'); +var bot = require('./bot.js'); -http = require('http'); -director = require('director'); -bot = require('./bot.js'); - -router = new director.http.Router({ +var router = new director.http.Router({ '/': { post: bot.respond, get: ping } }); -server = http.createServer(function (req, res) { +var server = http.createServer(function (req, res) { req.chunks = []; req.on('data', function (chunk) { req.chunks.push(chunk.toString()); @@ -23,10 +21,10 @@ server = http.createServer(function (req, res) { }); }); -port = Number(process.env.PORT || 5000); +var port = Number(process.env.PORT || 5000); server.listen(port); function ping() { this.res.writeHead(200); this.res.end('"Jake" Bot'); -} \ No newline at end of file +} From e7ced167f535d66223618174c0f7926e8228010b Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 22:49:28 -0400 Subject: [PATCH 27/49] updated json, removed unecessary package --- app.json | 7 +++++-- package.json | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app.json b/app.json index 2e549818e..ded62b619 100644 --- a/app.json +++ b/app.json @@ -2,6 +2,9 @@ "name": "Jake's Bot", "description": "Jake's AI replacement", "repository": "https://github.com/TheBiggestOfBoys/bot-tutorial-nodejs", - "logo": "http://www.tailgate365.com/wp-content/uploads/2011/06/tom-hanks-906.jpg", - "keywords": [] + "logo": "https://cdn.mos.cms.futurecdn.net/gon65SMMrCEbYAzuZ7opPD.jpg", + "keywords": [ + "groupme", + "chatbot" + ] } diff --git a/package.json b/package.json index 3f18ebf6c..a1b585111 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,7 @@ "start": "node index.js" }, "dependencies": { - "director": "", - "cool-ascii-faces": "~1.3.x" + "director": "" }, "engines": { "node": "0.10.x" From a6fbf09f1f01629ae7731c5617409c8479ea322d Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 22:52:30 -0400 Subject: [PATCH 28/49] removed param from postmessage --- bot.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bot.js b/bot.js index c3b7df92f..3000c0029 100644 --- a/bot.js +++ b/bot.js @@ -46,8 +46,9 @@ function respond() { if (request.text) { if (request.text === activationPhrase) { + body.text = quotes[getRandomIndex(quotes)]; this.res.writeHead(200); - postMessage(quotes[getRandomIndex(quotes)]); + postMessage(); this.res.end(); } @@ -55,8 +56,9 @@ function respond() { var words = request.text.split(); words.forEach(word => { if (word.includes("er")) { + body.text = word[0].toUpperCase() + word.substring(1, word.length - 2) + " her? I hardly know her!"; this.res.writeHead(200); - postMessage(word[0].toUpperCase() + word.substring(1, word.length - 2) + " her? I hardly know her!"); + postMessage(); this.res.end(); } }); @@ -73,8 +75,9 @@ function respond() { quotifiedString += word; } }); + body.text = quotifiedString; this.res.writeHead(200); - postMessage(quotifiedString); + postMessage(); this.res.end(); } } @@ -84,10 +87,8 @@ function getRandomIndex(arr) { return Math.floor(Math.random() * arr.length); } -function postMessage(text) { - body.text = text; - - console.log('sending ' + text + ' to ' + botID); +function postMessage() { + console.log('sending ' + body.text + ' to ' + botID); var botReq = HTTPS.request(options, function (res) { if (res.statusCode != 202) { From 7d0063d76547d5a0ea87b68960497fa77031553b Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 22:59:52 -0400 Subject: [PATCH 29/49] Moved code into functions --- bot.js | 49 +++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/bot.js b/bot.js index 3000c0029..eff22be5e 100644 --- a/bot.js +++ b/bot.js @@ -53,29 +53,14 @@ function respond() { } if (request.text.includes("er")) { - var words = request.text.split(); - words.forEach(word => { - if (word.includes("er")) { - body.text = word[0].toUpperCase() + word.substring(1, word.length - 2) + " her? I hardly know her!"; - this.res.writeHead(200); - postMessage(); - this.res.end(); - } - }); + body.text = hardlyKnowHer(request.text); + this.res.writeHead(200); + postMessage(); + this.res.end(); } if (request.text.includes('"')) { - var words = request.text.split(); - var quotifiedString = ""; - words.forEach(word => { - if (Math.random() > 0.25) { - quotifiedString += '"' + word + '" '; - } - else { - quotifiedString += word; - } - }); - body.text = quotifiedString; + body.text = quotify(request.text); this.res.writeHead(200); postMessage(); this.res.end(); @@ -87,6 +72,30 @@ function getRandomIndex(arr) { return Math.floor(Math.random() * arr.length); } +function quotify(string, amount) { + var words = string.split(); + var quotifiedString = ""; + words.forEach(word => { + if (Math.random() > amount) { + quotifiedString += '"' + word + '" '; + } + else { + quotifiedString += word; + } + }); + return quotifiedString; +} + +function hardlyKnowHer(string) { + var words = string.split(); + words.forEach(word => { + if (word.includes("er")) { + return word[0].toUpperCase() + word.substring(1, word.length - 2) + " her? I hardly know her!"; + } + }); + return ""; +} + function postMessage() { console.log('sending ' + body.text + ' to ' + botID); From 335d0fc79ee4c185d41a9b4be2708b0bf70601ef Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 23:01:20 -0400 Subject: [PATCH 30/49] added features from testing branch (might undo) --- bot.js | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/bot.js b/bot.js index 0f368630f..e4ca4477e 100644 --- a/bot.js +++ b/bot.js @@ -57,11 +57,28 @@ const activationPhrase = "Activate that sucka!"; function respond() { var request = JSON.parse(this.req.chunks[0]); - if (request.text && request.text === activationPhrase) { - this.res.writeHead(200); - postMessage(); - this.res.end(); - } + if (request.text) { + if (request.text === activationPhrase) { + body.text = quotes[getRandomIndex(quotes)]; + this.res.writeHead(200); + postMessage(); + this.res.end(); + } + + if (request.text.includes("er")) { + body.text = hardlyKnowHer(request.text); + this.res.writeHead(200); + postMessage(); + this.res.end(); + } + + if (request.text.includes('"')) { + body.text = quotify(request.text); + this.res.writeHead(200); + postMessage(); + this.res.end(); + } + } } function getRandomIndex(arr) { From d2ee8d755cd31d1fab4eaa64c06ac815d934277c Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 23:03:07 -0400 Subject: [PATCH 31/49] re added nullchecking in each if statement --- bot.js | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/bot.js b/bot.js index e4ca4477e..b76b77e27 100644 --- a/bot.js +++ b/bot.js @@ -57,28 +57,26 @@ const activationPhrase = "Activate that sucka!"; function respond() { var request = JSON.parse(this.req.chunks[0]); - if (request.text) { - if (request.text === activationPhrase) { - body.text = quotes[getRandomIndex(quotes)]; - this.res.writeHead(200); - postMessage(); - this.res.end(); - } - - if (request.text.includes("er")) { - body.text = hardlyKnowHer(request.text); - this.res.writeHead(200); - postMessage(); - this.res.end(); - } - - if (request.text.includes('"')) { - body.text = quotify(request.text); - this.res.writeHead(200); - postMessage(); - this.res.end(); - } - } + if (request.text && request.text === activationPhrase) { + body.text = quotes[getRandomIndex(quotes)]; + this.res.writeHead(200); + postMessage(); + this.res.end(); + } + + if (request.text && request.text.includes("er")) { + body.text = hardlyKnowHer(request.text); + this.res.writeHead(200); + postMessage(); + this.res.end(); + } + + if (request.text && request.text.includes('"')) { + body.text = quotify(request.text); + this.res.writeHead(200); + postMessage(); + this.res.end(); + } } function getRandomIndex(arr) { From 884e9cd7f2aea9ee54e132251f118df5a604affa Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 23:05:12 -0400 Subject: [PATCH 32/49] Revert "re added nullchecking in each if statement" This reverts commit d2ee8d755cd31d1fab4eaa64c06ac815d934277c. --- bot.js | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/bot.js b/bot.js index b76b77e27..e4ca4477e 100644 --- a/bot.js +++ b/bot.js @@ -57,26 +57,28 @@ const activationPhrase = "Activate that sucka!"; function respond() { var request = JSON.parse(this.req.chunks[0]); - if (request.text && request.text === activationPhrase) { - body.text = quotes[getRandomIndex(quotes)]; - this.res.writeHead(200); - postMessage(); - this.res.end(); - } - - if (request.text && request.text.includes("er")) { - body.text = hardlyKnowHer(request.text); - this.res.writeHead(200); - postMessage(); - this.res.end(); - } - - if (request.text && request.text.includes('"')) { - body.text = quotify(request.text); - this.res.writeHead(200); - postMessage(); - this.res.end(); - } + if (request.text) { + if (request.text === activationPhrase) { + body.text = quotes[getRandomIndex(quotes)]; + this.res.writeHead(200); + postMessage(); + this.res.end(); + } + + if (request.text.includes("er")) { + body.text = hardlyKnowHer(request.text); + this.res.writeHead(200); + postMessage(); + this.res.end(); + } + + if (request.text.includes('"')) { + body.text = quotify(request.text); + this.res.writeHead(200); + postMessage(); + this.res.end(); + } + } } function getRandomIndex(arr) { From f170ad0eb3a490ebe2c420f7679e9c0df2c7bf90 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 23:06:26 -0400 Subject: [PATCH 33/49] Revert "added features from testing branch (might undo)" This reverts commit 335d0fc79ee4c185d41a9b4be2708b0bf70601ef. --- bot.js | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/bot.js b/bot.js index e4ca4477e..0f368630f 100644 --- a/bot.js +++ b/bot.js @@ -57,28 +57,11 @@ const activationPhrase = "Activate that sucka!"; function respond() { var request = JSON.parse(this.req.chunks[0]); - if (request.text) { - if (request.text === activationPhrase) { - body.text = quotes[getRandomIndex(quotes)]; - this.res.writeHead(200); - postMessage(); - this.res.end(); - } - - if (request.text.includes("er")) { - body.text = hardlyKnowHer(request.text); - this.res.writeHead(200); - postMessage(); - this.res.end(); - } - - if (request.text.includes('"')) { - body.text = quotify(request.text); - this.res.writeHead(200); - postMessage(); - this.res.end(); - } - } + if (request.text && request.text === activationPhrase) { + this.res.writeHead(200); + postMessage(); + this.res.end(); + } } function getRandomIndex(arr) { From bf4983ecc8c6d6454793956f7727b0fbaad48a25 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 23:18:31 -0400 Subject: [PATCH 34/49] moved message content setting to inside postMessage() --- bot.js | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/bot.js b/bot.js index eff22be5e..b465089b6 100644 --- a/bot.js +++ b/bot.js @@ -39,6 +39,12 @@ const quotes = [ "RIP [RΓ‹DÁÇTÊD] Week", ]; +var randomMessage = false; +var shouldKnowHer = false; +var shouldQuotify = false; + +var requestText; + const activationPhrase = "Activate that sucka!"; function respond() { @@ -46,24 +52,28 @@ function respond() { if (request.text) { if (request.text === activationPhrase) { - body.text = quotes[getRandomIndex(quotes)]; + randomMessage = true; this.res.writeHead(200); postMessage(); this.res.end(); + randomMessage = false; } if (request.text.includes("er")) { - body.text = hardlyKnowHer(request.text); + shouldKnowHer = true; + requestText = request.text; this.res.writeHead(200); postMessage(); this.res.end(); + shouldKnowHer = true; } if (request.text.includes('"')) { - body.text = quotify(request.text); + shouldQuotify = true; this.res.writeHead(200); postMessage(); this.res.end(); + shouldQuotify = false; } } } @@ -97,6 +107,19 @@ function hardlyKnowHer(string) { } function postMessage() { + if (randomMessage) { + body.text = quotes[getRandomIndex(quotes)]; + } + else if (shouldKnowHer) { + body.text = hardlyKnowHer(requestText); + } + else if (shouldQuotify) { + body.text = quotify(requestText); + } + else { + body.text = "PLACEHOLDER MESSAGE"; + } + console.log('sending ' + body.text + ' to ' + botID); var botReq = HTTPS.request(options, function (res) { From b82abfa46f3895a6d01f6830b6cac8ff5487ca39 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 23:21:46 -0400 Subject: [PATCH 35/49] re added null checking again --- bot.js | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/bot.js b/bot.js index b465089b6..62da9ab40 100644 --- a/bot.js +++ b/bot.js @@ -43,38 +43,36 @@ var randomMessage = false; var shouldKnowHer = false; var shouldQuotify = false; -var requestText; +var requestText = ""; const activationPhrase = "Activate that sucka!"; function respond() { var request = JSON.parse(this.req.chunks[0]); - if (request.text) { - if (request.text === activationPhrase) { - randomMessage = true; - this.res.writeHead(200); - postMessage(); - this.res.end(); - randomMessage = false; - } + if (request.text && request.text === activationPhrase) { + randomMessage = true; + this.res.writeHead(200); + postMessage(); + this.res.end(); + randomMessage = false; + } - if (request.text.includes("er")) { - shouldKnowHer = true; - requestText = request.text; - this.res.writeHead(200); - postMessage(); - this.res.end(); - shouldKnowHer = true; - } + if (request.text && request.text.includes("er")) { + shouldKnowHer = true; + requestText = request.text; + this.res.writeHead(200); + postMessage(); + this.res.end(); + shouldKnowHer = true; + } - if (request.text.includes('"')) { - shouldQuotify = true; - this.res.writeHead(200); - postMessage(); - this.res.end(); - shouldQuotify = false; - } + if (request.text && request.text.includes('"')) { + shouldQuotify = true; + this.res.writeHead(200); + postMessage(); + this.res.end(); + shouldQuotify = false; } } From d2a3e148d8a1cfa09f1d4705da394456b58eae0f Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 13 Apr 2024 23:25:13 -0400 Subject: [PATCH 36/49] simplified bot.js by removing unused image stuff, applied tab preferneces to all files --- app.json | 12 +++--- bot.js | 115 ++++++++++++++++++++++----------------------------- index.js | 34 +++++++-------- package.json | 50 +++++++++++----------- 4 files changed, 97 insertions(+), 114 deletions(-) diff --git a/app.json b/app.json index 2e549818e..2db86e583 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { - "name": "Jake's Bot", - "description": "Jake's AI replacement", - "repository": "https://github.com/TheBiggestOfBoys/bot-tutorial-nodejs", - "logo": "http://www.tailgate365.com/wp-content/uploads/2011/06/tom-hanks-906.jpg", - "keywords": [] -} + "name": "Jake's Bot", + "description": "Jake's AI replacement", + "repository": "https://github.com/TheBiggestOfBoys/bot-tutorial-nodejs", + "logo": "http://www.tailgate365.com/wp-content/uploads/2011/06/tom-hanks-906.jpg", + "keywords": [] +} \ No newline at end of file diff --git a/bot.js b/bot.js index 0f368630f..3c08df84c 100644 --- a/bot.js +++ b/bot.js @@ -3,93 +3,76 @@ var HTTPS = require('https'); const botID = process.env.BOT_ID; const options = { - hostname: 'api.groupme.com', - path: '/v3/bots/post', - method: 'POST' + hostname: 'api.groupme.com', + path: '/v3/bots/post', + method: 'POST' }; var body = { - bot_id: botID, - text: "", - attachments: { - type: "image", - url: "" - } + bot_id: botID, + text: "" }; const quotes = [ - "In this world you either drip or drown, and baby, I brought the life jacket.", - "Ok pal", - "Sure buddy", - "Ok buster", - "In this world you either milk or get milked, and baby, I'm the cow.", - "All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit.", - "Tavin Reeves likes crotch shots.", - "Uhhhh, yeah", - "That's right!", - "So true!", - "I hardly know her!", - "πŸ’€", - "πŸ—Ώ", - "β˜οΈπŸ€“", - "β˜οΈπŸ€“ Erhm, akshulally", - "You can save by bundling Home & Auto", - "[RΓ‹DÁÇTÊD]", - "Hello, I'm Jake", - "Look at me, I'm Jake, I'm so tall and cool and attractive", - "bruh", - "**VINE BOOM SOUND EFFECT**", - "Otis.png", - "RIP [RΓ‹DÁÇTÊD] Week", -]; - -const imageURLs = [ - "https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842.large", - "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d.large", - "https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5.large", - "https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3.large", - "https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77.large", - "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751.large", + "In this world you either drip or drown, and baby, I brought the life jacket.", + "Ok pal", + "Sure buddy", + "Ok buster", + "In this world you either milk or get milked, and baby, I'm the cow.", + "All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit.", + "Tavin Reeves likes crotch shots.", + "Uhhhh, yeah", + "That's right!", + "So true!", + "I hardly know her!", + "πŸ’€", + "πŸ—Ώ", + "β˜οΈπŸ€“", + "β˜οΈπŸ€“ Erhm, akshulally", + "You can save by bundling Home & Auto", + "[RΓ‹DÁÇTÊD]", + "Hello, I'm Jake", + "Look at me, I'm Jake, I'm so tall and cool and attractive", + "bruh", + "**VINE BOOM SOUND EFFECT**", + "Otis.png", + "RIP [RΓ‹DÁÇTÊD] Week", ]; const activationPhrase = "Activate that sucka!"; function respond() { - var request = JSON.parse(this.req.chunks[0]); + var request = JSON.parse(this.req.chunks[0]); - if (request.text && request.text === activationPhrase) { - this.res.writeHead(200); - postMessage(); - this.res.end(); - } + if (request.text && request.text === activationPhrase) { + this.res.writeHead(200); + postMessage(); + this.res.end(); + } } function getRandomIndex(arr) { - return Math.floor(Math.random() * arr.length); + return Math.floor(Math.random() * arr.length); } function postMessage() { - var botResponse = quotes[getRandomIndex(quotes)]; - var imageURL = imageURLs[getRandomIndex(imageURLs)]; - - body.text = botResponse; - body.attachments.url = imageURL; + body.text = quotes[getRandomIndex(quotes)]; - console.log('sending ' + botResponse + ' to ' + botID); + console.log('sending ' + body.text + ' to ' + botID); - var botReq = HTTPS.request(options, function (res) { - if (res.statusCode != 202) { - console.log('rejecting bad status code ' + res.statusCode); - } - }); + var botReq = HTTPS.request(options, function (res) { + if (res.statusCode != 202) { + console.log('rejecting bad status code ' + res.statusCode); + } + }); - botReq.on('error', function (err) { - console.log('error posting message ' + JSON.stringify(err)); - }); - botReq.on('timeout', function (err) { - console.log('timeout posting message ' + JSON.stringify(err)); - }); - botReq.end(JSON.stringify(body)); + botReq.on('error', function (err) { + console.log('error posting message ' + JSON.stringify(err)); + }); + botReq.on('timeout', function (err) { + console.log('timeout posting message ' + JSON.stringify(err)); + }); + botReq.end(JSON.stringify(body)); } exports.respond = respond; diff --git a/index.js b/index.js index f1e14b558..569aa2403 100644 --- a/index.js +++ b/index.js @@ -1,32 +1,32 @@ var http, director, bot, router, server, port; -http = require('http'); -director = require('director'); -bot = require('./bot.js'); +http = require('http'); +director = require('director'); +bot = require('./bot.js'); router = new director.http.Router({ - '/' : { - post: bot.respond, - get: ping - } + '/': { + post: bot.respond, + get: ping + } }); server = http.createServer(function (req, res) { - req.chunks = []; - req.on('data', function (chunk) { - req.chunks.push(chunk.toString()); - }); + req.chunks = []; + req.on('data', function (chunk) { + req.chunks.push(chunk.toString()); + }); - router.dispatch(req, res, function(err) { - res.writeHead(err.status, {"Content-Type": "text/plain"}); - res.end(err.message); - }); + router.dispatch(req, res, function (err) { + res.writeHead(err.status, { "Content-Type": "text/plain" }); + res.end(err.message); + }); }); port = Number(process.env.PORT || 5000); server.listen(port); function ping() { - this.res.writeHead(200); - this.res.end('"Jake" Bot'); + this.res.writeHead(200); + this.res.end('"Jake" Bot'); } \ No newline at end of file diff --git a/package.json b/package.json index 3f18ebf6c..b92589381 100644 --- a/package.json +++ b/package.json @@ -1,26 +1,26 @@ { - "name": "node-js-getting-started", - "version": "0.1.2", - "description": "A sample Node.js app using Express 4", - "main": "index.js", - "scripts": { - "start": "node index.js" - }, - "dependencies": { - "director": "", - "cool-ascii-faces": "~1.3.x" - }, - "engines": { - "node": "0.10.x" - }, - "repository": { - "type": "git", - "url": "https://github.com/heroku/node-js-getting-started" - }, - "keywords": [ - "node", - "heroku", - "express" - ], - "license": "MIT" -} + "name": "node-js-getting-started", + "version": "0.1.2", + "description": "A sample Node.js app using Express 4", + "main": "index.js", + "scripts": { + "start": "node index.js" + }, + "dependencies": { + "director": "", + "cool-ascii-faces": "~1.3.x" + }, + "engines": { + "node": "0.10.x" + }, + "repository": { + "type": "git", + "url": "https://github.com/heroku/node-js-getting-started" + }, + "keywords": [ + "node", + "heroku", + "express" + ], + "license": "MIT" +} \ No newline at end of file From a7917a7556c151d0fb795a610b2f7b8d76491483 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sun, 14 Apr 2024 16:06:57 -0400 Subject: [PATCH 37/49] changed to random responses (not activation phrase), and added more quotes --- bot.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/bot.js b/bot.js index 3c08df84c..1a79cead8 100644 --- a/bot.js +++ b/bot.js @@ -37,14 +37,30 @@ const quotes = [ "**VINE BOOM SOUND EFFECT**", "Otis.png", "RIP [RΓ‹DÁÇTÊD] Week", + "Let me get uh...", + "Never forget The Alamo", + "Tavin: (zooms in on crotch)", + "Biggy Mike", + "Let me be clear", + "Let me be Frank", + "Your mind is to creamy in the gutter", + "@Sully..., @Sully...", + "Giga gadee gida gida ooh", + "@Dan Bot, pull up", + "All my homies hate @Dan Bot", + "Sammy 2 Sucks!", + "Owen is the Drizzler", + "Cannibal Sam O'Hare", + "Everywhere I look I see Dorbees!", + "🍺πŸ’ͺ🏼🐢 ROOT BEER!!!", + "Hip-hip!", + "@Tavin Reeves : πŸ©³πŸ“ΈπŸ‘€", ]; -const activationPhrase = "Activate that sucka!"; - function respond() { var request = JSON.parse(this.req.chunks[0]); - if (request.text && request.text === activationPhrase) { + if (request.text && Math.random() > 0.75) { this.res.writeHead(200); postMessage(); this.res.end(); From b049ffc8ae2a1d810e0048ba0e85aae128c04e63 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sun, 14 Apr 2024 22:35:05 -0400 Subject: [PATCH 38/49] Update bot.js changes response percentage to 95%, and added a few more quotes --- bot.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bot.js b/bot.js index 1a79cead8..879d00dba 100644 --- a/bot.js +++ b/bot.js @@ -55,12 +55,16 @@ const quotes = [ "🍺πŸ’ͺ🏼🐢 ROOT BEER!!!", "Hip-hip!", "@Tavin Reeves : πŸ©³πŸ“ΈπŸ‘€", + "[INSERT SPAM MESSAGE]", + "[INSERT MESSAGE]", + "Y'all spam more than me tbh", + "John, Blume & Colin's bots are mid", ]; function respond() { var request = JSON.parse(this.req.chunks[0]); - if (request.text && Math.random() > 0.75) { + if (request.text && Math.random() > 0.95) { this.res.writeHead(200); postMessage(); this.res.end(); From 57a978a58460985c34727b6655c1bda6076e7937 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Wed, 17 Apr 2024 00:33:07 -0400 Subject: [PATCH 39/49] Cleaned up after merge added more quotes, cleaned up var declaration and removed unused package --- bot.js | 25 ++++++++++++++++++++----- index.js | 16 +++++++--------- package.json | 3 +-- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/bot.js b/bot.js index 879d00dba..d56ee957a 100644 --- a/bot.js +++ b/bot.js @@ -55,16 +55,31 @@ const quotes = [ "🍺πŸ’ͺ🏼🐢 ROOT BEER!!!", "Hip-hip!", "@Tavin Reeves : πŸ©³πŸ“ΈπŸ‘€", - "[INSERT SPAM MESSAGE]", - "[INSERT MESSAGE]", - "Y'all spam more than me tbh", - "John, Blume & Colin's bots are mid", + "[INSERT SPAM MESSAGE]", + "[INSERT MESSAGE]", + "Y'all spam more than me tbh", + "John, Blume & Colin's bots are mid", + "@Josh Benson : πŸ‘πŸŒ³πŸ™οΈ", + "@Colin Davis : πŸ–οΈπŸ€ πŸ€š", + "Boy did I open the wrong door...", + "@Jake Scott : πŸ‘¨β€πŸ’»πŸ€½β€β™‚οΈπŸ€“", + "I wanna be grown up, I'm not a kid no more, I was when I was four, but that was long ago!", + "Jake I love you, but your week sucked! - @Elijah Ladd", + "Michelle, uh...", + "Tavin_sphere.png", + "Josh_crying.jpg", + "FBI Leaks.pdf", + "@Sam Mauer : πŸ“°βœοΈπŸ€₯", + "LTB", + "Penthouse... more like... REPENThouse", + "Yeah", + "Mama I'm a criminal", ]; function respond() { var request = JSON.parse(this.req.chunks[0]); - if (request.text && Math.random() > 0.95) { + if (request.text && Math.random() > 0.9) { this.res.writeHead(200); postMessage(); this.res.end(); diff --git a/index.js b/index.js index 569aa2403..112203642 100644 --- a/index.js +++ b/index.js @@ -1,17 +1,15 @@ -var http, director, bot, router, server, port; +var http = require('http'); +var director = require('director'); +var bot = require('./bot.js'); -http = require('http'); -director = require('director'); -bot = require('./bot.js'); - -router = new director.http.Router({ +var router = new director.http.Router({ '/': { post: bot.respond, get: ping } }); -server = http.createServer(function (req, res) { +var server = http.createServer(function (req, res) { req.chunks = []; req.on('data', function (chunk) { req.chunks.push(chunk.toString()); @@ -23,10 +21,10 @@ server = http.createServer(function (req, res) { }); }); -port = Number(process.env.PORT || 5000); +var port = Number(process.env.PORT || 5000); server.listen(port); function ping() { this.res.writeHead(200); this.res.end('"Jake" Bot'); -} \ No newline at end of file +} diff --git a/package.json b/package.json index b92589381..c546fdae3 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,7 @@ "start": "node index.js" }, "dependencies": { - "director": "", - "cool-ascii-faces": "~1.3.x" + "director": "" }, "engines": { "node": "0.10.x" From 0b88c7c0695a1fe84f9750f475aadc26248a2db0 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sat, 20 Apr 2024 16:53:04 -0400 Subject: [PATCH 40/49] added the josh thirst trap link --- bot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.js b/bot.js index d56ee957a..cd0bc28a8 100644 --- a/bot.js +++ b/bot.js @@ -73,7 +73,7 @@ const quotes = [ "LTB", "Penthouse... more like... REPENThouse", "Yeah", - "Mama I'm a criminal", + "Mama I'm a criminal", "https://youtube.com/shorts/lfDdP93GM3k?si=MudB-7tGL1oD0LAL", ]; function respond() { From 4d771e35c3b05251ce1f01a703e6eb2edf0c28a6 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Mon, 22 Apr 2024 19:56:39 -0400 Subject: [PATCH 41/49] Added image capabilities (again) this time i formatted the object correctly, I also fixed tab uniformity and removed an unused bool --- app.json | 18 +++++------ bot.js | 87 +++++++++++++++++++++++++++++++++++++++++++++++++--- package.json | 2 +- 3 files changed, 93 insertions(+), 14 deletions(-) diff --git a/app.json b/app.json index ded62b619..a84f8a2e5 100644 --- a/app.json +++ b/app.json @@ -1,10 +1,10 @@ { - "name": "Jake's Bot", - "description": "Jake's AI replacement", - "repository": "https://github.com/TheBiggestOfBoys/bot-tutorial-nodejs", - "logo": "https://cdn.mos.cms.futurecdn.net/gon65SMMrCEbYAzuZ7opPD.jpg", - "keywords": [ - "groupme", - "chatbot" - ] -} + "name": "Jake's Bot", + "description": "Jake's AI replacement", + "repository": "https://github.com/TheBiggestOfBoys/bot-tutorial-nodejs", + "logo": "https://cdn.mos.cms.futurecdn.net/gon65SMMrCEbYAzuZ7opPD.jpg", + "keywords": [ + "groupme", + "chatbot" + ] +} \ No newline at end of file diff --git a/bot.js b/bot.js index 3e75e9819..7157ba155 100644 --- a/bot.js +++ b/bot.js @@ -10,7 +10,13 @@ const options = { var body = { bot_id: botID, - text: "" + text: "", + attachments: [ + { + type: "image", + url: "" + } + ] }; const quotes = [ @@ -56,7 +62,7 @@ const quotes = [ "Hip-hip!", "@Tavin Reeves : πŸ©³πŸ“ΈπŸ‘€", "[INSERT SPAM MESSAGE]", - "[INSERT MESSAGE]", + "[INSERT MESSAGE]", "Y'all spam more than me tbh", "John, Blume & Colin's bots are mid", "@Josh Benson : πŸ‘πŸŒ³πŸ™οΈ", @@ -73,17 +79,88 @@ const quotes = [ "LTB", "Penthouse... more like... REPENThouse", "Yeah", - "Mama I'm a criminal", "https://youtube.com/shorts/lfDdP93GM3k?si=MudB-7tGL1oD0LAL", + "Mama I'm a criminal", + "https://youtube.com/shorts/lfDdP93GM3k?si=MudB-7tGL1oD0LAL", + "I'm feelin' MAD stuffy rn", ]; +const imageURLs = [ + "https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842", + "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d", + "https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5", + "https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3", + "https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77", + "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751", + "https://i.groupme.com/750x739.jpeg.9f6db6097d7b43ab9c497df4b3dea139", + "https://i.groupme.com/551x699.jpeg.3c182abef6d044dfb218803cf8df828f", + "https://i.groupme.com/148x148.gif.64f227cfbe1f4d1a934eecf98a90d11f", + "https://i.groupme.com/1152x1750.png.764de261289d422b8c13117669700e83", + "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d", + "https://i.groupme.com/480x429.jpeg.5acd54f001864eaaaa1230ba9457ce14", + "https://i.groupme.com/405x720.gif.99b5d82e6e404e7aa230fbeffdf62557", + "https://i.groupme.com/1482x800.png.da55ee91b13d4a9aacdda8fe01b8287c", + "https://i.groupme.com/768x403.jpeg.b130366fed5941fcad9227937db57ddd", + "https://i.groupme.com/957x1258.jpeg.b5d71e7f4a0f4a59ad6275b2712c3458", + "https://i.groupme.com/1500x2000.jpeg.977af0db50804deda9842c7d576650cf", + "https://i.groupme.com/298x167.jpeg.f30bd5f19ccd4a00b31b167a9209911a", + "https://i.groupme.com/320x180.jpeg.aa245952845042fea4f24bd3a0a75cde", + "https://i.groupme.com/243x369.jpeg.7f2af1009dc744d0bd0aaefec59508b6", + "https://i.groupme.com/375x666.jpeg.06b2138cb74e4b6fba392b490743fd18", + "https://i.groupme.com/606x856.png.c072de3871994608839b38a1fff8d179", + "https://i.groupme.com/300x480.png.0acdb46bd00c44acb50f5e83e8c2643b", + "https://i.groupme.com/1500x2000.jpeg.d8eecab63de441e6bfa539af43c8c00c", + "https://i.groupme.com/2000x924.jpeg.a071b3fc04394277a879b0f1d05aa06d", + "https://i.groupme.com/2796x4974.jpeg.fbb3ff2d0da04af09015b10ec709544c", + "https://i.groupme.com/1124x1498.jpeg.ed053252e43d49458f4d209c4e25482d", + "https://i.groupme.com/720x1280.jpeg.83d0c2376fba4779a8d986e736f96d01", + "https://i.groupme.com/720x1280.jpeg.b14b1ccb7dae43a98d23e61bd05f368b", + "https://i.groupme.com/2532x1401.jpeg.3af482e4109d43efadeda614314688bc", + "https://i.groupme.com/720x1280.jpeg.a699c61c19dd498285f54da5df453af1", + "https://i.groupme.com/1080x598.jpeg.3947d092bb6e434893c6d78372847cbd", + "https://i.groupme.com/2532x4494.jpeg.b2b6ebf281e342c0a894c7882c9351c1", + "https://i.groupme.com/225x225.jpeg.284025cd84ed441db9f93c02308f1d78", + "https://i.groupme.com/640x522.gif.102d79b04911443ab791e3194e2764c6", + "https://i.groupme.com/680x653.jpeg.3cf30494de2242f48fae288222bef492", + "https://i.groupme.com/405x720.gif.9273e0313da342399d63fbf29662c32f", + "https://i.groupme.com/220x91.gif.9fdc010e19a54c89b5aaa7d2a4d07556", + "https://i.groupme.com/680x760.png.87e40d892c2b4158ac236deeb5b31ae3", + "https://i.groupme.com/1170x1149.jpeg.334339372c9e47b4a76d1be82b88d5ac", + "https://i.groupme.com/1025x1348.jpeg.e9a4efb4a4ce4300ae48646b30166c98", + "https://i.groupme.com/1334x2372.jpeg.dabcb7a3eaa34d99919d153153aed451", + "https://i.groupme.com/3024x4032.jpeg.b238c4f2a2a041c38dcd5b60c9b6b3da", + "https://i.groupme.com/768x1024.jpeg.178e1a140cc5492880e7cc4fefab0577", + "https://i.groupme.com/2268x4032.jpeg.a864771c5cfb4e1e862bcc4d7cbc878f", + "https://i.groupme.com/2316x3088.jpeg.614b6cc1d5954cb5a81943f693cfe78d", + "https://i.groupme.com/390x480.gif.17bf3bd7d62a48a18739f6b3db0801ac", + "https://i.groupme.com/640x612.gif.79d5b648e1b043edafebc24c3a01250e", + "https://i.groupme.com/2532x4485.jpeg.dfa35d7a1c684acc8ea6a4a65d874830", + "https://i.groupme.com/1170x821.jpeg.f1ed3520ba2e4781a98ac3b3f2fe6636", + "https://i.groupme.com/1920x1280.jpeg.574499bcd88b43a39b6c2a49aaecb30d", + "https://i.groupme.com/2000x1500.jpeg.174deeccab4a406ea4498f0254a60945", + "https://i.groupme.com/195x229.gif.f8d72135257a4db18cef44f487ab4186", + "https://i.groupme.com/480x200.gif.38c3f06228b445b694e0f87ca3220d55", + "https://i.groupme.com/2268x4032.jpeg.dc60909e71c241709330a43abcfe8b27", + "https://i.groupme.com/3024x4032.jpeg.f3654b5d693341399af5512c57c85bef", + "https://i.groupme.com/2532x4494.jpeg.807f615711ae4d429c22bc29a7d131b4", + "https://i.groupme.com/498x498.gif.9ba90b8b11f94d3dbf50370e1176971c", + "https://i.groupme.com/3024x4032.jpeg.68b4bb5e41904268ba3f4461b4c8b307", + "https://i.groupme.com/3024x4032.jpeg.6ac82ac8e5c946ac84b6b0e400fdf75c", + "https://i.groupme.com/1280x720.jpeg.45cf746afbc140c4966e9975216b836e", + "https://i.groupme.com/828x1083.jpeg.f8330161bb074bf2a2730b41ef6037a9", + "https://i.groupme.com/2268x4032.jpeg.b5ea55bd76064a36b7933ffc773194b2", + "https://i.groupme.com/575x800.png.7c7844c11f61465a8714575f66c714fe", + "https://i.groupme.com/1334x2372.jpeg.1c399ed3f89f4ad382b13cb485f4efcd", + "https://i.groupme.com/2259x3048.jpeg.3c8674314f4f4aeeac095238ab5fe65c" +] + function respond() { var request = JSON.parse(this.req.chunks[0]); + console.log(request); if (request.text && Math.random() > 0.9) { this.res.writeHead(200); postMessage(); this.res.end(); - shouldQuotify = false; } } @@ -93,7 +170,9 @@ function getRandomIndex(arr) { function postMessage() { body.text = quotes[getRandomIndex(quotes)]; + body.attachments[0].url = imageURLs[getRandomIndex(imageURLs)]; + console.log(body); console.log('sending ' + body.text + ' to ' + botID); var botReq = HTTPS.request(options, function (res) { diff --git a/package.json b/package.json index ef42c1944..c546fdae3 100644 --- a/package.json +++ b/package.json @@ -22,4 +22,4 @@ "express" ], "license": "MIT" -} +} \ No newline at end of file From a828db725ede9af1a618730aa127c49f0817ff54 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sun, 28 Apr 2024 16:19:57 -0400 Subject: [PATCH 42/49] moved quotes and imageURLs to seperate text files to make it easier for editing --- bot.js | 145 +++++--------------------------------------------- imageURLs.txt | 66 +++++++++++++++++++++++ quotes.txt | 62 +++++++++++++++++++++ 3 files changed, 140 insertions(+), 133 deletions(-) create mode 100644 imageURLs.txt create mode 100644 quotes.txt diff --git a/bot.js b/bot.js index 7157ba155..ec6756e27 100644 --- a/bot.js +++ b/bot.js @@ -19,139 +19,8 @@ var body = { ] }; -const quotes = [ - "In this world you either drip or drown, and baby, I brought the life jacket.", - "Ok pal", - "Sure buddy", - "Ok buster", - "In this world you either milk or get milked, and baby, I'm the cow.", - "All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit.", - "Tavin Reeves likes crotch shots.", - "Uhhhh, yeah", - "That's right!", - "So true!", - "I hardly know her!", - "πŸ’€", - "πŸ—Ώ", - "β˜οΈπŸ€“", - "β˜οΈπŸ€“ Erhm, akshulally", - "You can save by bundling Home & Auto", - "[RΓ‹DÁÇTÊD]", - "Hello, I'm Jake", - "Look at me, I'm Jake, I'm so tall and cool and attractive", - "bruh", - "**VINE BOOM SOUND EFFECT**", - "Otis.png", - "RIP [RΓ‹DÁÇTÊD] Week", - "Let me get uh...", - "Never forget The Alamo", - "Tavin: (zooms in on crotch)", - "Biggy Mike", - "Let me be clear", - "Let me be Frank", - "Your mind is to creamy in the gutter", - "@Sully..., @Sully...", - "Giga gadee gida gida ooh", - "@Dan Bot, pull up", - "All my homies hate @Dan Bot", - "Sammy 2 Sucks!", - "Owen is the Drizzler", - "Cannibal Sam O'Hare", - "Everywhere I look I see Dorbees!", - "🍺πŸ’ͺ🏼🐢 ROOT BEER!!!", - "Hip-hip!", - "@Tavin Reeves : πŸ©³πŸ“ΈπŸ‘€", - "[INSERT SPAM MESSAGE]", - "[INSERT MESSAGE]", - "Y'all spam more than me tbh", - "John, Blume & Colin's bots are mid", - "@Josh Benson : πŸ‘πŸŒ³πŸ™οΈ", - "@Colin Davis : πŸ–οΈπŸ€ πŸ€š", - "Boy did I open the wrong door...", - "@Jake Scott : πŸ‘¨β€πŸ’»πŸ€½β€β™‚οΈπŸ€“", - "I wanna be grown up, I'm not a kid no more, I was when I was four, but that was long ago!", - "Jake I love you, but your week sucked! - @Elijah Ladd", - "Michelle, uh...", - "Tavin_sphere.png", - "Josh_crying.jpg", - "FBI Leaks.pdf", - "@Sam Mauer : πŸ“°βœοΈπŸ€₯", - "LTB", - "Penthouse... more like... REPENThouse", - "Yeah", - "Mama I'm a criminal", - "https://youtube.com/shorts/lfDdP93GM3k?si=MudB-7tGL1oD0LAL", - "I'm feelin' MAD stuffy rn", -]; - -const imageURLs = [ - "https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842", - "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d", - "https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5", - "https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3", - "https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77", - "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751", - "https://i.groupme.com/750x739.jpeg.9f6db6097d7b43ab9c497df4b3dea139", - "https://i.groupme.com/551x699.jpeg.3c182abef6d044dfb218803cf8df828f", - "https://i.groupme.com/148x148.gif.64f227cfbe1f4d1a934eecf98a90d11f", - "https://i.groupme.com/1152x1750.png.764de261289d422b8c13117669700e83", - "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d", - "https://i.groupme.com/480x429.jpeg.5acd54f001864eaaaa1230ba9457ce14", - "https://i.groupme.com/405x720.gif.99b5d82e6e404e7aa230fbeffdf62557", - "https://i.groupme.com/1482x800.png.da55ee91b13d4a9aacdda8fe01b8287c", - "https://i.groupme.com/768x403.jpeg.b130366fed5941fcad9227937db57ddd", - "https://i.groupme.com/957x1258.jpeg.b5d71e7f4a0f4a59ad6275b2712c3458", - "https://i.groupme.com/1500x2000.jpeg.977af0db50804deda9842c7d576650cf", - "https://i.groupme.com/298x167.jpeg.f30bd5f19ccd4a00b31b167a9209911a", - "https://i.groupme.com/320x180.jpeg.aa245952845042fea4f24bd3a0a75cde", - "https://i.groupme.com/243x369.jpeg.7f2af1009dc744d0bd0aaefec59508b6", - "https://i.groupme.com/375x666.jpeg.06b2138cb74e4b6fba392b490743fd18", - "https://i.groupme.com/606x856.png.c072de3871994608839b38a1fff8d179", - "https://i.groupme.com/300x480.png.0acdb46bd00c44acb50f5e83e8c2643b", - "https://i.groupme.com/1500x2000.jpeg.d8eecab63de441e6bfa539af43c8c00c", - "https://i.groupme.com/2000x924.jpeg.a071b3fc04394277a879b0f1d05aa06d", - "https://i.groupme.com/2796x4974.jpeg.fbb3ff2d0da04af09015b10ec709544c", - "https://i.groupme.com/1124x1498.jpeg.ed053252e43d49458f4d209c4e25482d", - "https://i.groupme.com/720x1280.jpeg.83d0c2376fba4779a8d986e736f96d01", - "https://i.groupme.com/720x1280.jpeg.b14b1ccb7dae43a98d23e61bd05f368b", - "https://i.groupme.com/2532x1401.jpeg.3af482e4109d43efadeda614314688bc", - "https://i.groupme.com/720x1280.jpeg.a699c61c19dd498285f54da5df453af1", - "https://i.groupme.com/1080x598.jpeg.3947d092bb6e434893c6d78372847cbd", - "https://i.groupme.com/2532x4494.jpeg.b2b6ebf281e342c0a894c7882c9351c1", - "https://i.groupme.com/225x225.jpeg.284025cd84ed441db9f93c02308f1d78", - "https://i.groupme.com/640x522.gif.102d79b04911443ab791e3194e2764c6", - "https://i.groupme.com/680x653.jpeg.3cf30494de2242f48fae288222bef492", - "https://i.groupme.com/405x720.gif.9273e0313da342399d63fbf29662c32f", - "https://i.groupme.com/220x91.gif.9fdc010e19a54c89b5aaa7d2a4d07556", - "https://i.groupme.com/680x760.png.87e40d892c2b4158ac236deeb5b31ae3", - "https://i.groupme.com/1170x1149.jpeg.334339372c9e47b4a76d1be82b88d5ac", - "https://i.groupme.com/1025x1348.jpeg.e9a4efb4a4ce4300ae48646b30166c98", - "https://i.groupme.com/1334x2372.jpeg.dabcb7a3eaa34d99919d153153aed451", - "https://i.groupme.com/3024x4032.jpeg.b238c4f2a2a041c38dcd5b60c9b6b3da", - "https://i.groupme.com/768x1024.jpeg.178e1a140cc5492880e7cc4fefab0577", - "https://i.groupme.com/2268x4032.jpeg.a864771c5cfb4e1e862bcc4d7cbc878f", - "https://i.groupme.com/2316x3088.jpeg.614b6cc1d5954cb5a81943f693cfe78d", - "https://i.groupme.com/390x480.gif.17bf3bd7d62a48a18739f6b3db0801ac", - "https://i.groupme.com/640x612.gif.79d5b648e1b043edafebc24c3a01250e", - "https://i.groupme.com/2532x4485.jpeg.dfa35d7a1c684acc8ea6a4a65d874830", - "https://i.groupme.com/1170x821.jpeg.f1ed3520ba2e4781a98ac3b3f2fe6636", - "https://i.groupme.com/1920x1280.jpeg.574499bcd88b43a39b6c2a49aaecb30d", - "https://i.groupme.com/2000x1500.jpeg.174deeccab4a406ea4498f0254a60945", - "https://i.groupme.com/195x229.gif.f8d72135257a4db18cef44f487ab4186", - "https://i.groupme.com/480x200.gif.38c3f06228b445b694e0f87ca3220d55", - "https://i.groupme.com/2268x4032.jpeg.dc60909e71c241709330a43abcfe8b27", - "https://i.groupme.com/3024x4032.jpeg.f3654b5d693341399af5512c57c85bef", - "https://i.groupme.com/2532x4494.jpeg.807f615711ae4d429c22bc29a7d131b4", - "https://i.groupme.com/498x498.gif.9ba90b8b11f94d3dbf50370e1176971c", - "https://i.groupme.com/3024x4032.jpeg.68b4bb5e41904268ba3f4461b4c8b307", - "https://i.groupme.com/3024x4032.jpeg.6ac82ac8e5c946ac84b6b0e400fdf75c", - "https://i.groupme.com/1280x720.jpeg.45cf746afbc140c4966e9975216b836e", - "https://i.groupme.com/828x1083.jpeg.f8330161bb074bf2a2730b41ef6037a9", - "https://i.groupme.com/2268x4032.jpeg.b5ea55bd76064a36b7933ffc773194b2", - "https://i.groupme.com/575x800.png.7c7844c11f61465a8714575f66c714fe", - "https://i.groupme.com/1334x2372.jpeg.1c399ed3f89f4ad382b13cb485f4efcd", - "https://i.groupme.com/2259x3048.jpeg.3c8674314f4f4aeeac095238ab5fe65c" -] +const quotes = getLines("quotes.txt"); +const imageURLs = getLines("imageURLs.txt"); function respond() { var request = JSON.parse(this.req.chunks[0]); @@ -164,6 +33,16 @@ function respond() { } } +function getLines(filePath) { + fetch(filePath) + .then((response) => response.text()) + .then((text) => { + const lines = text.split('\n'); // Split by newline character + return lines; + }) + .catch((error) => console.error(error)); +} + function getRandomIndex(arr) { return Math.floor(Math.random() * arr.length); } diff --git a/imageURLs.txt b/imageURLs.txt new file mode 100644 index 000000000..3a9d1df76 --- /dev/null +++ b/imageURLs.txt @@ -0,0 +1,66 @@ +https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842 +https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d +https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5 +https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3 +https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77 +https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751 +https://i.groupme.com/750x739.jpeg.9f6db6097d7b43ab9c497df4b3dea139 +https://i.groupme.com/551x699.jpeg.3c182abef6d044dfb218803cf8df828f +https://i.groupme.com/148x148.gif.64f227cfbe1f4d1a934eecf98a90d11f +https://i.groupme.com/1152x1750.png.764de261289d422b8c13117669700e83 +https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d +https://i.groupme.com/480x429.jpeg.5acd54f001864eaaaa1230ba9457ce14 +https://i.groupme.com/405x720.gif.99b5d82e6e404e7aa230fbeffdf62557 +https://i.groupme.com/1482x800.png.da55ee91b13d4a9aacdda8fe01b8287c +https://i.groupme.com/768x403.jpeg.b130366fed5941fcad9227937db57ddd +https://i.groupme.com/957x1258.jpeg.b5d71e7f4a0f4a59ad6275b2712c3458 +https://i.groupme.com/1500x2000.jpeg.977af0db50804deda9842c7d576650cf +https://i.groupme.com/298x167.jpeg.f30bd5f19ccd4a00b31b167a9209911a +https://i.groupme.com/320x180.jpeg.aa245952845042fea4f24bd3a0a75cde +https://i.groupme.com/243x369.jpeg.7f2af1009dc744d0bd0aaefec59508b6 +https://i.groupme.com/375x666.jpeg.06b2138cb74e4b6fba392b490743fd18 +https://i.groupme.com/606x856.png.c072de3871994608839b38a1fff8d179 +https://i.groupme.com/300x480.png.0acdb46bd00c44acb50f5e83e8c2643b +https://i.groupme.com/1500x2000.jpeg.d8eecab63de441e6bfa539af43c8c00c +https://i.groupme.com/2000x924.jpeg.a071b3fc04394277a879b0f1d05aa06d +https://i.groupme.com/2796x4974.jpeg.fbb3ff2d0da04af09015b10ec709544c +https://i.groupme.com/1124x1498.jpeg.ed053252e43d49458f4d209c4e25482d +https://i.groupme.com/720x1280.jpeg.83d0c2376fba4779a8d986e736f96d01 +https://i.groupme.com/720x1280.jpeg.b14b1ccb7dae43a98d23e61bd05f368b +https://i.groupme.com/2532x1401.jpeg.3af482e4109d43efadeda614314688bc +https://i.groupme.com/720x1280.jpeg.a699c61c19dd498285f54da5df453af1 +https://i.groupme.com/1080x598.jpeg.3947d092bb6e434893c6d78372847cbd +https://i.groupme.com/2532x4494.jpeg.b2b6ebf281e342c0a894c7882c9351c1 +https://i.groupme.com/225x225.jpeg.284025cd84ed441db9f93c02308f1d78 +https://i.groupme.com/640x522.gif.102d79b04911443ab791e3194e2764c6 +https://i.groupme.com/680x653.jpeg.3cf30494de2242f48fae288222bef492 +https://i.groupme.com/405x720.gif.9273e0313da342399d63fbf29662c32f +https://i.groupme.com/220x91.gif.9fdc010e19a54c89b5aaa7d2a4d07556 +https://i.groupme.com/680x760.png.87e40d892c2b4158ac236deeb5b31ae3 +https://i.groupme.com/1170x1149.jpeg.334339372c9e47b4a76d1be82b88d5ac +https://i.groupme.com/1025x1348.jpeg.e9a4efb4a4ce4300ae48646b30166c98 +https://i.groupme.com/1334x2372.jpeg.dabcb7a3eaa34d99919d153153aed451 +https://i.groupme.com/3024x4032.jpeg.b238c4f2a2a041c38dcd5b60c9b6b3da +https://i.groupme.com/768x1024.jpeg.178e1a140cc5492880e7cc4fefab0577 +https://i.groupme.com/2268x4032.jpeg.a864771c5cfb4e1e862bcc4d7cbc878f +https://i.groupme.com/2316x3088.jpeg.614b6cc1d5954cb5a81943f693cfe78d +https://i.groupme.com/390x480.gif.17bf3bd7d62a48a18739f6b3db0801ac +https://i.groupme.com/640x612.gif.79d5b648e1b043edafebc24c3a01250e +https://i.groupme.com/2532x4485.jpeg.dfa35d7a1c684acc8ea6a4a65d874830 +https://i.groupme.com/1170x821.jpeg.f1ed3520ba2e4781a98ac3b3f2fe6636 +https://i.groupme.com/1920x1280.jpeg.574499bcd88b43a39b6c2a49aaecb30d +https://i.groupme.com/2000x1500.jpeg.174deeccab4a406ea4498f0254a60945 +https://i.groupme.com/195x229.gif.f8d72135257a4db18cef44f487ab4186 +https://i.groupme.com/480x200.gif.38c3f06228b445b694e0f87ca3220d55 +https://i.groupme.com/2268x4032.jpeg.dc60909e71c241709330a43abcfe8b27 +https://i.groupme.com/3024x4032.jpeg.f3654b5d693341399af5512c57c85bef +https://i.groupme.com/2532x4494.jpeg.807f615711ae4d429c22bc29a7d131b4 +https://i.groupme.com/498x498.gif.9ba90b8b11f94d3dbf50370e1176971c +https://i.groupme.com/3024x4032.jpeg.68b4bb5e41904268ba3f4461b4c8b307 +https://i.groupme.com/3024x4032.jpeg.6ac82ac8e5c946ac84b6b0e400fdf75c +https://i.groupme.com/1280x720.jpeg.45cf746afbc140c4966e9975216b836e +https://i.groupme.com/828x1083.jpeg.f8330161bb074bf2a2730b41ef6037a9 +https://i.groupme.com/2268x4032.jpeg.b5ea55bd76064a36b7933ffc773194b2 +https://i.groupme.com/575x800.png.7c7844c11f61465a8714575f66c714fe +https://i.groupme.com/1334x2372.jpeg.1c399ed3f89f4ad382b13cb485f4efcd +https://i.groupme.com/2259x3048.jpeg.3c8674314f4f4aeeac095238ab5fe65c \ No newline at end of file diff --git a/quotes.txt b/quotes.txt new file mode 100644 index 000000000..e9bb8c8c6 --- /dev/null +++ b/quotes.txt @@ -0,0 +1,62 @@ +In this world you either drip or drown, and baby, I brought the life jacket. +Ok pal +Sure buddy +Ok buster +In this world you either milk or get milked, and baby, I'm the cow. +All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit. +Tavin Reeves likes crotch shots. +Uhhhh, yeah +That's right! +So true! +I hardly know her! +πŸ’€ +πŸ—Ώ +β˜οΈπŸ€“ +β˜οΈπŸ€“ Erhm, akshulally +You can save by bundling Home & Auto +[RΓ‹DÁÇTÊD] +Hello, I'm Jake +Look at me, I'm Jake, I'm so tall and cool and attractive +bruh +**VINE BOOM SOUND EFFECT** +Otis.png +RIP [RΓ‹DÁÇTÊD] Week +Let me get uh... +Never forget The Alamo +Tavin: (zooms in on crotch) +Biggy Mike +Let me be clear +Let me be Frank +Your mind is to creamy in the gutter +@Sully..., @Sully... +Giga gadee gida gida ooh +@Dan Bot, pull up +All my homies hate @Dan Bot +Sammy 2 Sucks! +Owen is the Drizzler +Cannibal Sam O'Hare +Everywhere I look I see Dorbees! +🍺πŸ’ͺ🏼🐢 ROOT BEER!!! +Hip-hip! +@Tavin Reeves : πŸ©³πŸ“ΈπŸ‘€ +[INSERT SPAM MESSAGE] +[INSERT MESSAGE] +Y'all spam more than me tbh +John, Blume & Colin's bots are mid +@Josh Benson : πŸ‘πŸŒ³πŸ™οΈ +@Colin Davis : πŸ–οΈπŸ€ πŸ€š +Boy did I open the wrong door... +@Jake Scott : πŸ‘¨β€πŸ’»πŸ€½β€β™‚οΈπŸ€“ +I wanna be grown up, I'm not a kid no more, I was when I was four, but that was long ago! +Jake I love you, but your week sucked! - @Elijah Ladd +Michelle, uh... +Tavin_sphere.png +Josh_crying.jpg +FBI Leaks.pdf +@Sam Mauer : πŸ“°βœοΈπŸ€₯ +LTB +Penthouse... more like... REPENThouse +Yeah +Mama I'm a criminal +https://youtube.com/shorts/lfDdP93GM3k?si=MudB-7tGL1oD0LAL +I'm feelin' MAD stuffy rn \ No newline at end of file From 5f508b7a947f68ab2dbe0facc9262bff05b06ebf Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sun, 28 Apr 2024 16:25:41 -0400 Subject: [PATCH 43/49] Revert "moved quotes and imageURLs to seperate text files to make it easier for editing" This reverts commit a828db725ede9af1a618730aa127c49f0817ff54. --- bot.js | 145 +++++++++++++++++++++++++++++++++++++++++++++----- imageURLs.txt | 66 ----------------------- quotes.txt | 62 --------------------- 3 files changed, 133 insertions(+), 140 deletions(-) delete mode 100644 imageURLs.txt delete mode 100644 quotes.txt diff --git a/bot.js b/bot.js index ec6756e27..7157ba155 100644 --- a/bot.js +++ b/bot.js @@ -19,8 +19,139 @@ var body = { ] }; -const quotes = getLines("quotes.txt"); -const imageURLs = getLines("imageURLs.txt"); +const quotes = [ + "In this world you either drip or drown, and baby, I brought the life jacket.", + "Ok pal", + "Sure buddy", + "Ok buster", + "In this world you either milk or get milked, and baby, I'm the cow.", + "All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit.", + "Tavin Reeves likes crotch shots.", + "Uhhhh, yeah", + "That's right!", + "So true!", + "I hardly know her!", + "πŸ’€", + "πŸ—Ώ", + "β˜οΈπŸ€“", + "β˜οΈπŸ€“ Erhm, akshulally", + "You can save by bundling Home & Auto", + "[RΓ‹DÁÇTÊD]", + "Hello, I'm Jake", + "Look at me, I'm Jake, I'm so tall and cool and attractive", + "bruh", + "**VINE BOOM SOUND EFFECT**", + "Otis.png", + "RIP [RΓ‹DÁÇTÊD] Week", + "Let me get uh...", + "Never forget The Alamo", + "Tavin: (zooms in on crotch)", + "Biggy Mike", + "Let me be clear", + "Let me be Frank", + "Your mind is to creamy in the gutter", + "@Sully..., @Sully...", + "Giga gadee gida gida ooh", + "@Dan Bot, pull up", + "All my homies hate @Dan Bot", + "Sammy 2 Sucks!", + "Owen is the Drizzler", + "Cannibal Sam O'Hare", + "Everywhere I look I see Dorbees!", + "🍺πŸ’ͺ🏼🐢 ROOT BEER!!!", + "Hip-hip!", + "@Tavin Reeves : πŸ©³πŸ“ΈπŸ‘€", + "[INSERT SPAM MESSAGE]", + "[INSERT MESSAGE]", + "Y'all spam more than me tbh", + "John, Blume & Colin's bots are mid", + "@Josh Benson : πŸ‘πŸŒ³πŸ™οΈ", + "@Colin Davis : πŸ–οΈπŸ€ πŸ€š", + "Boy did I open the wrong door...", + "@Jake Scott : πŸ‘¨β€πŸ’»πŸ€½β€β™‚οΈπŸ€“", + "I wanna be grown up, I'm not a kid no more, I was when I was four, but that was long ago!", + "Jake I love you, but your week sucked! - @Elijah Ladd", + "Michelle, uh...", + "Tavin_sphere.png", + "Josh_crying.jpg", + "FBI Leaks.pdf", + "@Sam Mauer : πŸ“°βœοΈπŸ€₯", + "LTB", + "Penthouse... more like... REPENThouse", + "Yeah", + "Mama I'm a criminal", + "https://youtube.com/shorts/lfDdP93GM3k?si=MudB-7tGL1oD0LAL", + "I'm feelin' MAD stuffy rn", +]; + +const imageURLs = [ + "https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842", + "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d", + "https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5", + "https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3", + "https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77", + "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751", + "https://i.groupme.com/750x739.jpeg.9f6db6097d7b43ab9c497df4b3dea139", + "https://i.groupme.com/551x699.jpeg.3c182abef6d044dfb218803cf8df828f", + "https://i.groupme.com/148x148.gif.64f227cfbe1f4d1a934eecf98a90d11f", + "https://i.groupme.com/1152x1750.png.764de261289d422b8c13117669700e83", + "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d", + "https://i.groupme.com/480x429.jpeg.5acd54f001864eaaaa1230ba9457ce14", + "https://i.groupme.com/405x720.gif.99b5d82e6e404e7aa230fbeffdf62557", + "https://i.groupme.com/1482x800.png.da55ee91b13d4a9aacdda8fe01b8287c", + "https://i.groupme.com/768x403.jpeg.b130366fed5941fcad9227937db57ddd", + "https://i.groupme.com/957x1258.jpeg.b5d71e7f4a0f4a59ad6275b2712c3458", + "https://i.groupme.com/1500x2000.jpeg.977af0db50804deda9842c7d576650cf", + "https://i.groupme.com/298x167.jpeg.f30bd5f19ccd4a00b31b167a9209911a", + "https://i.groupme.com/320x180.jpeg.aa245952845042fea4f24bd3a0a75cde", + "https://i.groupme.com/243x369.jpeg.7f2af1009dc744d0bd0aaefec59508b6", + "https://i.groupme.com/375x666.jpeg.06b2138cb74e4b6fba392b490743fd18", + "https://i.groupme.com/606x856.png.c072de3871994608839b38a1fff8d179", + "https://i.groupme.com/300x480.png.0acdb46bd00c44acb50f5e83e8c2643b", + "https://i.groupme.com/1500x2000.jpeg.d8eecab63de441e6bfa539af43c8c00c", + "https://i.groupme.com/2000x924.jpeg.a071b3fc04394277a879b0f1d05aa06d", + "https://i.groupme.com/2796x4974.jpeg.fbb3ff2d0da04af09015b10ec709544c", + "https://i.groupme.com/1124x1498.jpeg.ed053252e43d49458f4d209c4e25482d", + "https://i.groupme.com/720x1280.jpeg.83d0c2376fba4779a8d986e736f96d01", + "https://i.groupme.com/720x1280.jpeg.b14b1ccb7dae43a98d23e61bd05f368b", + "https://i.groupme.com/2532x1401.jpeg.3af482e4109d43efadeda614314688bc", + "https://i.groupme.com/720x1280.jpeg.a699c61c19dd498285f54da5df453af1", + "https://i.groupme.com/1080x598.jpeg.3947d092bb6e434893c6d78372847cbd", + "https://i.groupme.com/2532x4494.jpeg.b2b6ebf281e342c0a894c7882c9351c1", + "https://i.groupme.com/225x225.jpeg.284025cd84ed441db9f93c02308f1d78", + "https://i.groupme.com/640x522.gif.102d79b04911443ab791e3194e2764c6", + "https://i.groupme.com/680x653.jpeg.3cf30494de2242f48fae288222bef492", + "https://i.groupme.com/405x720.gif.9273e0313da342399d63fbf29662c32f", + "https://i.groupme.com/220x91.gif.9fdc010e19a54c89b5aaa7d2a4d07556", + "https://i.groupme.com/680x760.png.87e40d892c2b4158ac236deeb5b31ae3", + "https://i.groupme.com/1170x1149.jpeg.334339372c9e47b4a76d1be82b88d5ac", + "https://i.groupme.com/1025x1348.jpeg.e9a4efb4a4ce4300ae48646b30166c98", + "https://i.groupme.com/1334x2372.jpeg.dabcb7a3eaa34d99919d153153aed451", + "https://i.groupme.com/3024x4032.jpeg.b238c4f2a2a041c38dcd5b60c9b6b3da", + "https://i.groupme.com/768x1024.jpeg.178e1a140cc5492880e7cc4fefab0577", + "https://i.groupme.com/2268x4032.jpeg.a864771c5cfb4e1e862bcc4d7cbc878f", + "https://i.groupme.com/2316x3088.jpeg.614b6cc1d5954cb5a81943f693cfe78d", + "https://i.groupme.com/390x480.gif.17bf3bd7d62a48a18739f6b3db0801ac", + "https://i.groupme.com/640x612.gif.79d5b648e1b043edafebc24c3a01250e", + "https://i.groupme.com/2532x4485.jpeg.dfa35d7a1c684acc8ea6a4a65d874830", + "https://i.groupme.com/1170x821.jpeg.f1ed3520ba2e4781a98ac3b3f2fe6636", + "https://i.groupme.com/1920x1280.jpeg.574499bcd88b43a39b6c2a49aaecb30d", + "https://i.groupme.com/2000x1500.jpeg.174deeccab4a406ea4498f0254a60945", + "https://i.groupme.com/195x229.gif.f8d72135257a4db18cef44f487ab4186", + "https://i.groupme.com/480x200.gif.38c3f06228b445b694e0f87ca3220d55", + "https://i.groupme.com/2268x4032.jpeg.dc60909e71c241709330a43abcfe8b27", + "https://i.groupme.com/3024x4032.jpeg.f3654b5d693341399af5512c57c85bef", + "https://i.groupme.com/2532x4494.jpeg.807f615711ae4d429c22bc29a7d131b4", + "https://i.groupme.com/498x498.gif.9ba90b8b11f94d3dbf50370e1176971c", + "https://i.groupme.com/3024x4032.jpeg.68b4bb5e41904268ba3f4461b4c8b307", + "https://i.groupme.com/3024x4032.jpeg.6ac82ac8e5c946ac84b6b0e400fdf75c", + "https://i.groupme.com/1280x720.jpeg.45cf746afbc140c4966e9975216b836e", + "https://i.groupme.com/828x1083.jpeg.f8330161bb074bf2a2730b41ef6037a9", + "https://i.groupme.com/2268x4032.jpeg.b5ea55bd76064a36b7933ffc773194b2", + "https://i.groupme.com/575x800.png.7c7844c11f61465a8714575f66c714fe", + "https://i.groupme.com/1334x2372.jpeg.1c399ed3f89f4ad382b13cb485f4efcd", + "https://i.groupme.com/2259x3048.jpeg.3c8674314f4f4aeeac095238ab5fe65c" +] function respond() { var request = JSON.parse(this.req.chunks[0]); @@ -33,16 +164,6 @@ function respond() { } } -function getLines(filePath) { - fetch(filePath) - .then((response) => response.text()) - .then((text) => { - const lines = text.split('\n'); // Split by newline character - return lines; - }) - .catch((error) => console.error(error)); -} - function getRandomIndex(arr) { return Math.floor(Math.random() * arr.length); } diff --git a/imageURLs.txt b/imageURLs.txt deleted file mode 100644 index 3a9d1df76..000000000 --- a/imageURLs.txt +++ /dev/null @@ -1,66 +0,0 @@ -https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842 -https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d -https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5 -https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3 -https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77 -https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751 -https://i.groupme.com/750x739.jpeg.9f6db6097d7b43ab9c497df4b3dea139 -https://i.groupme.com/551x699.jpeg.3c182abef6d044dfb218803cf8df828f -https://i.groupme.com/148x148.gif.64f227cfbe1f4d1a934eecf98a90d11f -https://i.groupme.com/1152x1750.png.764de261289d422b8c13117669700e83 -https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d -https://i.groupme.com/480x429.jpeg.5acd54f001864eaaaa1230ba9457ce14 -https://i.groupme.com/405x720.gif.99b5d82e6e404e7aa230fbeffdf62557 -https://i.groupme.com/1482x800.png.da55ee91b13d4a9aacdda8fe01b8287c -https://i.groupme.com/768x403.jpeg.b130366fed5941fcad9227937db57ddd -https://i.groupme.com/957x1258.jpeg.b5d71e7f4a0f4a59ad6275b2712c3458 -https://i.groupme.com/1500x2000.jpeg.977af0db50804deda9842c7d576650cf -https://i.groupme.com/298x167.jpeg.f30bd5f19ccd4a00b31b167a9209911a -https://i.groupme.com/320x180.jpeg.aa245952845042fea4f24bd3a0a75cde -https://i.groupme.com/243x369.jpeg.7f2af1009dc744d0bd0aaefec59508b6 -https://i.groupme.com/375x666.jpeg.06b2138cb74e4b6fba392b490743fd18 -https://i.groupme.com/606x856.png.c072de3871994608839b38a1fff8d179 -https://i.groupme.com/300x480.png.0acdb46bd00c44acb50f5e83e8c2643b -https://i.groupme.com/1500x2000.jpeg.d8eecab63de441e6bfa539af43c8c00c -https://i.groupme.com/2000x924.jpeg.a071b3fc04394277a879b0f1d05aa06d -https://i.groupme.com/2796x4974.jpeg.fbb3ff2d0da04af09015b10ec709544c -https://i.groupme.com/1124x1498.jpeg.ed053252e43d49458f4d209c4e25482d -https://i.groupme.com/720x1280.jpeg.83d0c2376fba4779a8d986e736f96d01 -https://i.groupme.com/720x1280.jpeg.b14b1ccb7dae43a98d23e61bd05f368b -https://i.groupme.com/2532x1401.jpeg.3af482e4109d43efadeda614314688bc -https://i.groupme.com/720x1280.jpeg.a699c61c19dd498285f54da5df453af1 -https://i.groupme.com/1080x598.jpeg.3947d092bb6e434893c6d78372847cbd -https://i.groupme.com/2532x4494.jpeg.b2b6ebf281e342c0a894c7882c9351c1 -https://i.groupme.com/225x225.jpeg.284025cd84ed441db9f93c02308f1d78 -https://i.groupme.com/640x522.gif.102d79b04911443ab791e3194e2764c6 -https://i.groupme.com/680x653.jpeg.3cf30494de2242f48fae288222bef492 -https://i.groupme.com/405x720.gif.9273e0313da342399d63fbf29662c32f -https://i.groupme.com/220x91.gif.9fdc010e19a54c89b5aaa7d2a4d07556 -https://i.groupme.com/680x760.png.87e40d892c2b4158ac236deeb5b31ae3 -https://i.groupme.com/1170x1149.jpeg.334339372c9e47b4a76d1be82b88d5ac -https://i.groupme.com/1025x1348.jpeg.e9a4efb4a4ce4300ae48646b30166c98 -https://i.groupme.com/1334x2372.jpeg.dabcb7a3eaa34d99919d153153aed451 -https://i.groupme.com/3024x4032.jpeg.b238c4f2a2a041c38dcd5b60c9b6b3da -https://i.groupme.com/768x1024.jpeg.178e1a140cc5492880e7cc4fefab0577 -https://i.groupme.com/2268x4032.jpeg.a864771c5cfb4e1e862bcc4d7cbc878f -https://i.groupme.com/2316x3088.jpeg.614b6cc1d5954cb5a81943f693cfe78d -https://i.groupme.com/390x480.gif.17bf3bd7d62a48a18739f6b3db0801ac -https://i.groupme.com/640x612.gif.79d5b648e1b043edafebc24c3a01250e -https://i.groupme.com/2532x4485.jpeg.dfa35d7a1c684acc8ea6a4a65d874830 -https://i.groupme.com/1170x821.jpeg.f1ed3520ba2e4781a98ac3b3f2fe6636 -https://i.groupme.com/1920x1280.jpeg.574499bcd88b43a39b6c2a49aaecb30d -https://i.groupme.com/2000x1500.jpeg.174deeccab4a406ea4498f0254a60945 -https://i.groupme.com/195x229.gif.f8d72135257a4db18cef44f487ab4186 -https://i.groupme.com/480x200.gif.38c3f06228b445b694e0f87ca3220d55 -https://i.groupme.com/2268x4032.jpeg.dc60909e71c241709330a43abcfe8b27 -https://i.groupme.com/3024x4032.jpeg.f3654b5d693341399af5512c57c85bef -https://i.groupme.com/2532x4494.jpeg.807f615711ae4d429c22bc29a7d131b4 -https://i.groupme.com/498x498.gif.9ba90b8b11f94d3dbf50370e1176971c -https://i.groupme.com/3024x4032.jpeg.68b4bb5e41904268ba3f4461b4c8b307 -https://i.groupme.com/3024x4032.jpeg.6ac82ac8e5c946ac84b6b0e400fdf75c -https://i.groupme.com/1280x720.jpeg.45cf746afbc140c4966e9975216b836e -https://i.groupme.com/828x1083.jpeg.f8330161bb074bf2a2730b41ef6037a9 -https://i.groupme.com/2268x4032.jpeg.b5ea55bd76064a36b7933ffc773194b2 -https://i.groupme.com/575x800.png.7c7844c11f61465a8714575f66c714fe -https://i.groupme.com/1334x2372.jpeg.1c399ed3f89f4ad382b13cb485f4efcd -https://i.groupme.com/2259x3048.jpeg.3c8674314f4f4aeeac095238ab5fe65c \ No newline at end of file diff --git a/quotes.txt b/quotes.txt deleted file mode 100644 index e9bb8c8c6..000000000 --- a/quotes.txt +++ /dev/null @@ -1,62 +0,0 @@ -In this world you either drip or drown, and baby, I brought the life jacket. -Ok pal -Sure buddy -Ok buster -In this world you either milk or get milked, and baby, I'm the cow. -All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit. -Tavin Reeves likes crotch shots. -Uhhhh, yeah -That's right! -So true! -I hardly know her! -πŸ’€ -πŸ—Ώ -β˜οΈπŸ€“ -β˜οΈπŸ€“ Erhm, akshulally -You can save by bundling Home & Auto -[RΓ‹DÁÇTÊD] -Hello, I'm Jake -Look at me, I'm Jake, I'm so tall and cool and attractive -bruh -**VINE BOOM SOUND EFFECT** -Otis.png -RIP [RΓ‹DÁÇTÊD] Week -Let me get uh... -Never forget The Alamo -Tavin: (zooms in on crotch) -Biggy Mike -Let me be clear -Let me be Frank -Your mind is to creamy in the gutter -@Sully..., @Sully... -Giga gadee gida gida ooh -@Dan Bot, pull up -All my homies hate @Dan Bot -Sammy 2 Sucks! -Owen is the Drizzler -Cannibal Sam O'Hare -Everywhere I look I see Dorbees! -🍺πŸ’ͺ🏼🐢 ROOT BEER!!! -Hip-hip! -@Tavin Reeves : πŸ©³πŸ“ΈπŸ‘€ -[INSERT SPAM MESSAGE] -[INSERT MESSAGE] -Y'all spam more than me tbh -John, Blume & Colin's bots are mid -@Josh Benson : πŸ‘πŸŒ³πŸ™οΈ -@Colin Davis : πŸ–οΈπŸ€ πŸ€š -Boy did I open the wrong door... -@Jake Scott : πŸ‘¨β€πŸ’»πŸ€½β€β™‚οΈπŸ€“ -I wanna be grown up, I'm not a kid no more, I was when I was four, but that was long ago! -Jake I love you, but your week sucked! - @Elijah Ladd -Michelle, uh... -Tavin_sphere.png -Josh_crying.jpg -FBI Leaks.pdf -@Sam Mauer : πŸ“°βœοΈπŸ€₯ -LTB -Penthouse... more like... REPENThouse -Yeah -Mama I'm a criminal -https://youtube.com/shorts/lfDdP93GM3k?si=MudB-7tGL1oD0LAL -I'm feelin' MAD stuffy rn \ No newline at end of file From fad00f1526564ef2cb22b1459bea370a7f886882 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sun, 15 Sep 2024 13:58:28 -0400 Subject: [PATCH 44/49] Update bot.js added secret activation keyword --- bot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.js b/bot.js index 7157ba155..c5d2f8e2e 100644 --- a/bot.js +++ b/bot.js @@ -157,7 +157,7 @@ function respond() { var request = JSON.parse(this.req.chunks[0]); console.log(request); - if (request.text && Math.random() > 0.9) { + if ((request.text && Math.random() > 0.9) || (request.text == '\u200B')) { this.res.writeHead(200); postMessage(); this.res.end(); From 5ee2e2fb2c971e3484061a1ebab0433342769217 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sun, 15 Sep 2024 14:02:29 -0400 Subject: [PATCH 45/49] Update bot.js changed activation phrase again --- bot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.js b/bot.js index c5d2f8e2e..ae5956899 100644 --- a/bot.js +++ b/bot.js @@ -157,7 +157,7 @@ function respond() { var request = JSON.parse(this.req.chunks[0]); console.log(request); - if ((request.text && Math.random() > 0.9) || (request.text == '\u200B')) { + if ((request.text && Math.random() > 0.9) || (request.text == "HeIIo")) { this.res.writeHead(200); postMessage(); this.res.end(); From 2138ec9260abf87582d47f7a2f992fa4ced8877f Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sun, 15 Sep 2024 20:46:00 -0400 Subject: [PATCH 46/49] moved arrays to seperate files as exports, make it send image or text, not both --- .env | 2 +- bot.js | 147 ++++----------------------------------------------- imageURLs.js | 68 ++++++++++++++++++++++++ quotes.js | 64 ++++++++++++++++++++++ 4 files changed, 144 insertions(+), 137 deletions(-) create mode 100644 imageURLs.js create mode 100644 quotes.js diff --git a/.env b/.env index 8e1b0cb5d..d9ba73fb9 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -BOT_ID="de7b9e2d4f6734f3e993ba22d5" \ No newline at end of file +BOT_ID="BOT_ID" \ No newline at end of file diff --git a/bot.js b/bot.js index 7157ba155..4eae18035 100644 --- a/bot.js +++ b/bot.js @@ -1,3 +1,6 @@ +import { quotes } from './quotes'; +import { imageURLs } from './imageURLs'; + var HTTPS = require('https'); const botID = process.env.BOT_ID; @@ -19,140 +22,6 @@ var body = { ] }; -const quotes = [ - "In this world you either drip or drown, and baby, I brought the life jacket.", - "Ok pal", - "Sure buddy", - "Ok buster", - "In this world you either milk or get milked, and baby, I'm the cow.", - "All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit.", - "Tavin Reeves likes crotch shots.", - "Uhhhh, yeah", - "That's right!", - "So true!", - "I hardly know her!", - "πŸ’€", - "πŸ—Ώ", - "β˜οΈπŸ€“", - "β˜οΈπŸ€“ Erhm, akshulally", - "You can save by bundling Home & Auto", - "[RΓ‹DÁÇTÊD]", - "Hello, I'm Jake", - "Look at me, I'm Jake, I'm so tall and cool and attractive", - "bruh", - "**VINE BOOM SOUND EFFECT**", - "Otis.png", - "RIP [RΓ‹DÁÇTÊD] Week", - "Let me get uh...", - "Never forget The Alamo", - "Tavin: (zooms in on crotch)", - "Biggy Mike", - "Let me be clear", - "Let me be Frank", - "Your mind is to creamy in the gutter", - "@Sully..., @Sully...", - "Giga gadee gida gida ooh", - "@Dan Bot, pull up", - "All my homies hate @Dan Bot", - "Sammy 2 Sucks!", - "Owen is the Drizzler", - "Cannibal Sam O'Hare", - "Everywhere I look I see Dorbees!", - "🍺πŸ’ͺ🏼🐢 ROOT BEER!!!", - "Hip-hip!", - "@Tavin Reeves : πŸ©³πŸ“ΈπŸ‘€", - "[INSERT SPAM MESSAGE]", - "[INSERT MESSAGE]", - "Y'all spam more than me tbh", - "John, Blume & Colin's bots are mid", - "@Josh Benson : πŸ‘πŸŒ³πŸ™οΈ", - "@Colin Davis : πŸ–οΈπŸ€ πŸ€š", - "Boy did I open the wrong door...", - "@Jake Scott : πŸ‘¨β€πŸ’»πŸ€½β€β™‚οΈπŸ€“", - "I wanna be grown up, I'm not a kid no more, I was when I was four, but that was long ago!", - "Jake I love you, but your week sucked! - @Elijah Ladd", - "Michelle, uh...", - "Tavin_sphere.png", - "Josh_crying.jpg", - "FBI Leaks.pdf", - "@Sam Mauer : πŸ“°βœοΈπŸ€₯", - "LTB", - "Penthouse... more like... REPENThouse", - "Yeah", - "Mama I'm a criminal", - "https://youtube.com/shorts/lfDdP93GM3k?si=MudB-7tGL1oD0LAL", - "I'm feelin' MAD stuffy rn", -]; - -const imageURLs = [ - "https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842", - "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d", - "https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5", - "https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3", - "https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77", - "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751", - "https://i.groupme.com/750x739.jpeg.9f6db6097d7b43ab9c497df4b3dea139", - "https://i.groupme.com/551x699.jpeg.3c182abef6d044dfb218803cf8df828f", - "https://i.groupme.com/148x148.gif.64f227cfbe1f4d1a934eecf98a90d11f", - "https://i.groupme.com/1152x1750.png.764de261289d422b8c13117669700e83", - "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d", - "https://i.groupme.com/480x429.jpeg.5acd54f001864eaaaa1230ba9457ce14", - "https://i.groupme.com/405x720.gif.99b5d82e6e404e7aa230fbeffdf62557", - "https://i.groupme.com/1482x800.png.da55ee91b13d4a9aacdda8fe01b8287c", - "https://i.groupme.com/768x403.jpeg.b130366fed5941fcad9227937db57ddd", - "https://i.groupme.com/957x1258.jpeg.b5d71e7f4a0f4a59ad6275b2712c3458", - "https://i.groupme.com/1500x2000.jpeg.977af0db50804deda9842c7d576650cf", - "https://i.groupme.com/298x167.jpeg.f30bd5f19ccd4a00b31b167a9209911a", - "https://i.groupme.com/320x180.jpeg.aa245952845042fea4f24bd3a0a75cde", - "https://i.groupme.com/243x369.jpeg.7f2af1009dc744d0bd0aaefec59508b6", - "https://i.groupme.com/375x666.jpeg.06b2138cb74e4b6fba392b490743fd18", - "https://i.groupme.com/606x856.png.c072de3871994608839b38a1fff8d179", - "https://i.groupme.com/300x480.png.0acdb46bd00c44acb50f5e83e8c2643b", - "https://i.groupme.com/1500x2000.jpeg.d8eecab63de441e6bfa539af43c8c00c", - "https://i.groupme.com/2000x924.jpeg.a071b3fc04394277a879b0f1d05aa06d", - "https://i.groupme.com/2796x4974.jpeg.fbb3ff2d0da04af09015b10ec709544c", - "https://i.groupme.com/1124x1498.jpeg.ed053252e43d49458f4d209c4e25482d", - "https://i.groupme.com/720x1280.jpeg.83d0c2376fba4779a8d986e736f96d01", - "https://i.groupme.com/720x1280.jpeg.b14b1ccb7dae43a98d23e61bd05f368b", - "https://i.groupme.com/2532x1401.jpeg.3af482e4109d43efadeda614314688bc", - "https://i.groupme.com/720x1280.jpeg.a699c61c19dd498285f54da5df453af1", - "https://i.groupme.com/1080x598.jpeg.3947d092bb6e434893c6d78372847cbd", - "https://i.groupme.com/2532x4494.jpeg.b2b6ebf281e342c0a894c7882c9351c1", - "https://i.groupme.com/225x225.jpeg.284025cd84ed441db9f93c02308f1d78", - "https://i.groupme.com/640x522.gif.102d79b04911443ab791e3194e2764c6", - "https://i.groupme.com/680x653.jpeg.3cf30494de2242f48fae288222bef492", - "https://i.groupme.com/405x720.gif.9273e0313da342399d63fbf29662c32f", - "https://i.groupme.com/220x91.gif.9fdc010e19a54c89b5aaa7d2a4d07556", - "https://i.groupme.com/680x760.png.87e40d892c2b4158ac236deeb5b31ae3", - "https://i.groupme.com/1170x1149.jpeg.334339372c9e47b4a76d1be82b88d5ac", - "https://i.groupme.com/1025x1348.jpeg.e9a4efb4a4ce4300ae48646b30166c98", - "https://i.groupme.com/1334x2372.jpeg.dabcb7a3eaa34d99919d153153aed451", - "https://i.groupme.com/3024x4032.jpeg.b238c4f2a2a041c38dcd5b60c9b6b3da", - "https://i.groupme.com/768x1024.jpeg.178e1a140cc5492880e7cc4fefab0577", - "https://i.groupme.com/2268x4032.jpeg.a864771c5cfb4e1e862bcc4d7cbc878f", - "https://i.groupme.com/2316x3088.jpeg.614b6cc1d5954cb5a81943f693cfe78d", - "https://i.groupme.com/390x480.gif.17bf3bd7d62a48a18739f6b3db0801ac", - "https://i.groupme.com/640x612.gif.79d5b648e1b043edafebc24c3a01250e", - "https://i.groupme.com/2532x4485.jpeg.dfa35d7a1c684acc8ea6a4a65d874830", - "https://i.groupme.com/1170x821.jpeg.f1ed3520ba2e4781a98ac3b3f2fe6636", - "https://i.groupme.com/1920x1280.jpeg.574499bcd88b43a39b6c2a49aaecb30d", - "https://i.groupme.com/2000x1500.jpeg.174deeccab4a406ea4498f0254a60945", - "https://i.groupme.com/195x229.gif.f8d72135257a4db18cef44f487ab4186", - "https://i.groupme.com/480x200.gif.38c3f06228b445b694e0f87ca3220d55", - "https://i.groupme.com/2268x4032.jpeg.dc60909e71c241709330a43abcfe8b27", - "https://i.groupme.com/3024x4032.jpeg.f3654b5d693341399af5512c57c85bef", - "https://i.groupme.com/2532x4494.jpeg.807f615711ae4d429c22bc29a7d131b4", - "https://i.groupme.com/498x498.gif.9ba90b8b11f94d3dbf50370e1176971c", - "https://i.groupme.com/3024x4032.jpeg.68b4bb5e41904268ba3f4461b4c8b307", - "https://i.groupme.com/3024x4032.jpeg.6ac82ac8e5c946ac84b6b0e400fdf75c", - "https://i.groupme.com/1280x720.jpeg.45cf746afbc140c4966e9975216b836e", - "https://i.groupme.com/828x1083.jpeg.f8330161bb074bf2a2730b41ef6037a9", - "https://i.groupme.com/2268x4032.jpeg.b5ea55bd76064a36b7933ffc773194b2", - "https://i.groupme.com/575x800.png.7c7844c11f61465a8714575f66c714fe", - "https://i.groupme.com/1334x2372.jpeg.1c399ed3f89f4ad382b13cb485f4efcd", - "https://i.groupme.com/2259x3048.jpeg.3c8674314f4f4aeeac095238ab5fe65c" -] - function respond() { var request = JSON.parse(this.req.chunks[0]); console.log(request); @@ -169,8 +38,14 @@ function getRandomIndex(arr) { } function postMessage() { - body.text = quotes[getRandomIndex(quotes)]; - body.attachments[0].url = imageURLs[getRandomIndex(imageURLs)]; + var randomValue = Math.random(); + + if (randomValue <= 0.5) { + body.text = quotes[getRandomIndex(quotes)]; + } + else { + body.attachments[0].url = imageURLs[getRandomIndex(imageURLs)]; + } console.log(body); console.log('sending ' + body.text + ' to ' + botID); diff --git a/imageURLs.js b/imageURLs.js new file mode 100644 index 000000000..4e4b3515d --- /dev/null +++ b/imageURLs.js @@ -0,0 +1,68 @@ +export const imageURLs = [ + "https://i.groupme.com/1080x1079.jpeg.e08faeb0a4bb4068b458a3f63994a842", + "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d", + "https://i.groupme.com/375x666.jpeg.6bef1d29066e4ace89ad056a551eceb5", + "https://i.groupme.com/720x1280.jpeg.017a0936855f4703b73bb28cc2d974a3", + "https://i.groupme.com/433x577.jpeg.6347f72c4ce0467998beb54f9460bd77", + "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751", + "https://i.groupme.com/750x739.jpeg.9f6db6097d7b43ab9c497df4b3dea139", + "https://i.groupme.com/551x699.jpeg.3c182abef6d044dfb218803cf8df828f", + "https://i.groupme.com/148x148.gif.64f227cfbe1f4d1a934eecf98a90d11f", + "https://i.groupme.com/1152x1750.png.764de261289d422b8c13117669700e83", + "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d", + "https://i.groupme.com/480x429.jpeg.5acd54f001864eaaaa1230ba9457ce14", + "https://i.groupme.com/405x720.gif.99b5d82e6e404e7aa230fbeffdf62557", + "https://i.groupme.com/1482x800.png.da55ee91b13d4a9aacdda8fe01b8287c", + "https://i.groupme.com/768x403.jpeg.b130366fed5941fcad9227937db57ddd", + "https://i.groupme.com/957x1258.jpeg.b5d71e7f4a0f4a59ad6275b2712c3458", + "https://i.groupme.com/1500x2000.jpeg.977af0db50804deda9842c7d576650cf", + "https://i.groupme.com/298x167.jpeg.f30bd5f19ccd4a00b31b167a9209911a", + "https://i.groupme.com/320x180.jpeg.aa245952845042fea4f24bd3a0a75cde", + "https://i.groupme.com/243x369.jpeg.7f2af1009dc744d0bd0aaefec59508b6", + "https://i.groupme.com/375x666.jpeg.06b2138cb74e4b6fba392b490743fd18", + "https://i.groupme.com/606x856.png.c072de3871994608839b38a1fff8d179", + "https://i.groupme.com/300x480.png.0acdb46bd00c44acb50f5e83e8c2643b", + "https://i.groupme.com/1500x2000.jpeg.d8eecab63de441e6bfa539af43c8c00c", + "https://i.groupme.com/2000x924.jpeg.a071b3fc04394277a879b0f1d05aa06d", + "https://i.groupme.com/2796x4974.jpeg.fbb3ff2d0da04af09015b10ec709544c", + "https://i.groupme.com/1124x1498.jpeg.ed053252e43d49458f4d209c4e25482d", + "https://i.groupme.com/720x1280.jpeg.83d0c2376fba4779a8d986e736f96d01", + "https://i.groupme.com/720x1280.jpeg.b14b1ccb7dae43a98d23e61bd05f368b", + "https://i.groupme.com/2532x1401.jpeg.3af482e4109d43efadeda614314688bc", + "https://i.groupme.com/720x1280.jpeg.a699c61c19dd498285f54da5df453af1", + "https://i.groupme.com/1080x598.jpeg.3947d092bb6e434893c6d78372847cbd", + "https://i.groupme.com/2532x4494.jpeg.b2b6ebf281e342c0a894c7882c9351c1", + "https://i.groupme.com/225x225.jpeg.284025cd84ed441db9f93c02308f1d78", + "https://i.groupme.com/640x522.gif.102d79b04911443ab791e3194e2764c6", + "https://i.groupme.com/680x653.jpeg.3cf30494de2242f48fae288222bef492", + "https://i.groupme.com/405x720.gif.9273e0313da342399d63fbf29662c32f", + "https://i.groupme.com/220x91.gif.9fdc010e19a54c89b5aaa7d2a4d07556", + "https://i.groupme.com/680x760.png.87e40d892c2b4158ac236deeb5b31ae3", + "https://i.groupme.com/1170x1149.jpeg.334339372c9e47b4a76d1be82b88d5ac", + "https://i.groupme.com/1025x1348.jpeg.e9a4efb4a4ce4300ae48646b30166c98", + "https://i.groupme.com/1334x2372.jpeg.dabcb7a3eaa34d99919d153153aed451", + "https://i.groupme.com/3024x4032.jpeg.b238c4f2a2a041c38dcd5b60c9b6b3da", + "https://i.groupme.com/768x1024.jpeg.178e1a140cc5492880e7cc4fefab0577", + "https://i.groupme.com/2268x4032.jpeg.a864771c5cfb4e1e862bcc4d7cbc878f", + "https://i.groupme.com/2316x3088.jpeg.614b6cc1d5954cb5a81943f693cfe78d", + "https://i.groupme.com/390x480.gif.17bf3bd7d62a48a18739f6b3db0801ac", + "https://i.groupme.com/640x612.gif.79d5b648e1b043edafebc24c3a01250e", + "https://i.groupme.com/2532x4485.jpeg.dfa35d7a1c684acc8ea6a4a65d874830", + "https://i.groupme.com/1170x821.jpeg.f1ed3520ba2e4781a98ac3b3f2fe6636", + "https://i.groupme.com/1920x1280.jpeg.574499bcd88b43a39b6c2a49aaecb30d", + "https://i.groupme.com/2000x1500.jpeg.174deeccab4a406ea4498f0254a60945", + "https://i.groupme.com/195x229.gif.f8d72135257a4db18cef44f487ab4186", + "https://i.groupme.com/480x200.gif.38c3f06228b445b694e0f87ca3220d55", + "https://i.groupme.com/2268x4032.jpeg.dc60909e71c241709330a43abcfe8b27", + "https://i.groupme.com/3024x4032.jpeg.f3654b5d693341399af5512c57c85bef", + "https://i.groupme.com/2532x4494.jpeg.807f615711ae4d429c22bc29a7d131b4", + "https://i.groupme.com/498x498.gif.9ba90b8b11f94d3dbf50370e1176971c", + "https://i.groupme.com/3024x4032.jpeg.68b4bb5e41904268ba3f4461b4c8b307", + "https://i.groupme.com/3024x4032.jpeg.6ac82ac8e5c946ac84b6b0e400fdf75c", + "https://i.groupme.com/1280x720.jpeg.45cf746afbc140c4966e9975216b836e", + "https://i.groupme.com/828x1083.jpeg.f8330161bb074bf2a2730b41ef6037a9", + "https://i.groupme.com/2268x4032.jpeg.b5ea55bd76064a36b7933ffc773194b2", + "https://i.groupme.com/575x800.png.7c7844c11f61465a8714575f66c714fe", + "https://i.groupme.com/1334x2372.jpeg.1c399ed3f89f4ad382b13cb485f4efcd", + "https://i.groupme.com/2259x3048.jpeg.3c8674314f4f4aeeac095238ab5fe65c" +]; \ No newline at end of file diff --git a/quotes.js b/quotes.js new file mode 100644 index 000000000..bf3f55da9 --- /dev/null +++ b/quotes.js @@ -0,0 +1,64 @@ +export const quotes = [ + "In this world you either drip or drown, and baby, I brought the life jacket.", + "Ok pal", + "Sure buddy", + "Ok buster", + "In this world you either milk or get milked, and baby, I'm the cow.", + "All [REDACTED] Week ever was, was me sitting in the DC drinking milk, in a funny outfit.", + "Tavin Reeves likes crotch shots.", + "Uhhhh, yeah", + "That's right!", + "So true!", + "I hardly know her!", + "πŸ’€", + "πŸ—Ώ", + "β˜οΈπŸ€“", + "β˜οΈπŸ€“ Erhm, akshulally", + "You can save by bundling Home & Auto", + "[RΓ‹DÁÇTÊD]", + "Hello, I'm Jake", + "Look at me, I'm Jake, I'm so tall and cool and attractive", + "bruh", + "**VINE BOOM SOUND EFFECT**", + "Otis.png", + "RIP [RΓ‹DÁÇTÊD] Week", + "Let me get uh...", + "Never forget The Alamo", + "Tavin: (zooms in on crotch)", + "Biggy Mike", + "Let me be clear", + "Let me be Frank", + "Your mind is to creamy in the gutter", + "@Sully..., @Sully...", + "Giga gadee gida gida ooh", + "@Dan Bot, pull up", + "All my homies hate @Dan Bot", + "Sammy 2 Sucks!", + "Owen is the Drizzler", + "Cannibal Sam O'Hare", + "Everywhere I look I see Dorbees!", + "🍺πŸ’ͺ🏼🐢 ROOT BEER!!!", + "Hip-hip!", + "@Tavin Reeves : πŸ©³πŸ“ΈπŸ‘€", + "[INSERT SPAM MESSAGE]", + "[INSERT MESSAGE]", + "Y'all spam more than me tbh", + "John, Blume & Colin's bots are mid", + "@Josh Benson : πŸ‘πŸŒ³πŸ™οΈ", + "@Colin Davis : πŸ–οΈπŸ€ πŸ€š", + "Boy did I open the wrong door...", + "@Jake Scott : πŸ‘¨β€πŸ’»πŸ€½β€β™‚οΈπŸ€“", + "I wanna be grown up, I'm not a kid no more, I was when I was four, but that was long ago!", + "Jake I love you, but your week sucked! - @Elijah Ladd", + "Michelle, uh...", + "Tavin_sphere.png", + "Josh_crying.jpg", + "FBI Leaks.pdf", + "@Sam Mauer : πŸ“°βœοΈπŸ€₯", + "LTB", + "Penthouse... more like... REPENThouse", + "Yeah", + "Mama I'm a criminal", + "https://youtube.com/shorts/lfDdP93GM3k?si=MudB-7tGL1oD0LAL", + "I'm feelin' MAD stuffy rn", +]; \ No newline at end of file From 356eb2bcc5dc704923866a4033aeeadcab1f45da Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sun, 15 Sep 2024 21:05:53 -0400 Subject: [PATCH 47/49] added gif and video options --- bot.js | 18 ++++++++++++++---- gifURLs.js | 23 +++++++++++++++++++++++ imageURLs.js | 39 ++++++++++++++++++++++++++++----------- videoURLs.js | 5 +++++ 4 files changed, 70 insertions(+), 15 deletions(-) create mode 100644 gifURLs.js create mode 100644 videoURLs.js diff --git a/bot.js b/bot.js index dcf9acbec..3366de42f 100644 --- a/bot.js +++ b/bot.js @@ -1,5 +1,7 @@ -import { quotes } from './quotes'; -import { imageURLs } from './imageURLs'; +import quotes from './quotes'; +import imageURLs from './imageURLs'; +import gifURLs from './gifURLs'; +import videoURLs from './videoURLs'; var HTTPS = require('https'); @@ -26,7 +28,7 @@ function respond() { var request = JSON.parse(this.req.chunks[0]); console.log(request); - if ((request.text && Math.random() > 0.9) || (request.text == "HeIIo")) { + if ((request.text && Math.random() > 0.95) || (request.text == "HeIIo")) { this.res.writeHead(200); postMessage(); this.res.end(); @@ -44,7 +46,15 @@ function postMessage() { body.text = quotes[getRandomIndex(quotes)]; } else { - body.attachments[0].url = imageURLs[getRandomIndex(imageURLs)]; + if (randomValue < 0.7) { + body.attachments[0].url = imageURLs[getRandomIndex(imageURLs)]; + } + else if (randomValue < 0.85) { + body.attachments[0].url = gifURLs[getRandomIndex(gifURLs)]; + } + else { + body.attachments[0].url = videoURLs[getRandomIndex(videoURLs)]; + } } console.log(body); diff --git a/gifURLs.js b/gifURLs.js new file mode 100644 index 000000000..d21d42d2a --- /dev/null +++ b/gifURLs.js @@ -0,0 +1,23 @@ +export const gifURLs = [ + + "https://i.groupme.com/148x148.gif.64f227cfbe1f4d1a934eecf98a90d11f", + "https://i.groupme.com/405x720.gif.99b5d82e6e404e7aa230fbeffdf62557", + "https://i.groupme.com/640x522.gif.102d79b04911443ab791e3194e2764c6", + "https://i.groupme.com/405x720.gif.9273e0313da342399d63fbf29662c32f", + "https://i.groupme.com/220x91.gif.9fdc010e19a54c89b5aaa7d2a4d07556", + "https://i.groupme.com/390x480.gif.17bf3bd7d62a48a18739f6b3db0801ac", + "https://i.groupme.com/640x612.gif.79d5b648e1b043edafebc24c3a01250e", + "https://i.groupme.com/195x229.gif.f8d72135257a4db18cef44f487ab4186", + "https://i.groupme.com/480x200.gif.38c3f06228b445b694e0f87ca3220d55", + "https://i.groupme.com/498x498.gif.9ba90b8b11f94d3dbf50370e1176971c", + "https://i.groupme.com/480x206.gif.3e04bcc558c345b5ac2a2d42f67bbcc3", + "https://i.groupme.com/220x181.gif.132aca3241874b6fb5611751ceef1525", + "https://i.groupme.com/500x375.gif.6f44868e1a01423abf02966310ff11be", + "https://i.groupme.com/540x224.gif.6130682e337d4bb9b0d2ee51523f7bf7", + "https://i.groupme.com/382x470.gif.84d33a9a20b9416eb80fec8a685a312f", + "https://i.groupme.com/390x480.gif.621af73028224623aab6c2a03c14a9d0", + "https://i.groupme.com/220x162.gif.5b78feafbdb94b9da927cab4c9ae3bc6", + "https://i.groupme.com/220x159.gif.6885716a001243d6b3f117821b4de53f", + "https://i.groupme.com/245x220.gif.c91f05b6e02343d2bcbb3ddb25c3ee4c", + "https://i.groupme.com/220x165.gif.fe288553b30e43e3a4c38b1c9303527f" +]; \ No newline at end of file diff --git a/imageURLs.js b/imageURLs.js index 4e4b3515d..ee4d6671f 100644 --- a/imageURLs.js +++ b/imageURLs.js @@ -7,11 +7,9 @@ export const imageURLs = [ "https://i.groupme.com/3024x4032.jpeg.c6f14d8fa5b44c30b0bbb031b3634751", "https://i.groupme.com/750x739.jpeg.9f6db6097d7b43ab9c497df4b3dea139", "https://i.groupme.com/551x699.jpeg.3c182abef6d044dfb218803cf8df828f", - "https://i.groupme.com/148x148.gif.64f227cfbe1f4d1a934eecf98a90d11f", "https://i.groupme.com/1152x1750.png.764de261289d422b8c13117669700e83", "https://i.groupme.com/750x650.png.8874165939864b6b9d26ad5e918dcd0d", "https://i.groupme.com/480x429.jpeg.5acd54f001864eaaaa1230ba9457ce14", - "https://i.groupme.com/405x720.gif.99b5d82e6e404e7aa230fbeffdf62557", "https://i.groupme.com/1482x800.png.da55ee91b13d4a9aacdda8fe01b8287c", "https://i.groupme.com/768x403.jpeg.b130366fed5941fcad9227937db57ddd", "https://i.groupme.com/957x1258.jpeg.b5d71e7f4a0f4a59ad6275b2712c3458", @@ -33,10 +31,7 @@ export const imageURLs = [ "https://i.groupme.com/1080x598.jpeg.3947d092bb6e434893c6d78372847cbd", "https://i.groupme.com/2532x4494.jpeg.b2b6ebf281e342c0a894c7882c9351c1", "https://i.groupme.com/225x225.jpeg.284025cd84ed441db9f93c02308f1d78", - "https://i.groupme.com/640x522.gif.102d79b04911443ab791e3194e2764c6", "https://i.groupme.com/680x653.jpeg.3cf30494de2242f48fae288222bef492", - "https://i.groupme.com/405x720.gif.9273e0313da342399d63fbf29662c32f", - "https://i.groupme.com/220x91.gif.9fdc010e19a54c89b5aaa7d2a4d07556", "https://i.groupme.com/680x760.png.87e40d892c2b4158ac236deeb5b31ae3", "https://i.groupme.com/1170x1149.jpeg.334339372c9e47b4a76d1be82b88d5ac", "https://i.groupme.com/1025x1348.jpeg.e9a4efb4a4ce4300ae48646b30166c98", @@ -45,18 +40,13 @@ export const imageURLs = [ "https://i.groupme.com/768x1024.jpeg.178e1a140cc5492880e7cc4fefab0577", "https://i.groupme.com/2268x4032.jpeg.a864771c5cfb4e1e862bcc4d7cbc878f", "https://i.groupme.com/2316x3088.jpeg.614b6cc1d5954cb5a81943f693cfe78d", - "https://i.groupme.com/390x480.gif.17bf3bd7d62a48a18739f6b3db0801ac", - "https://i.groupme.com/640x612.gif.79d5b648e1b043edafebc24c3a01250e", "https://i.groupme.com/2532x4485.jpeg.dfa35d7a1c684acc8ea6a4a65d874830", "https://i.groupme.com/1170x821.jpeg.f1ed3520ba2e4781a98ac3b3f2fe6636", "https://i.groupme.com/1920x1280.jpeg.574499bcd88b43a39b6c2a49aaecb30d", "https://i.groupme.com/2000x1500.jpeg.174deeccab4a406ea4498f0254a60945", - "https://i.groupme.com/195x229.gif.f8d72135257a4db18cef44f487ab4186", - "https://i.groupme.com/480x200.gif.38c3f06228b445b694e0f87ca3220d55", "https://i.groupme.com/2268x4032.jpeg.dc60909e71c241709330a43abcfe8b27", "https://i.groupme.com/3024x4032.jpeg.f3654b5d693341399af5512c57c85bef", "https://i.groupme.com/2532x4494.jpeg.807f615711ae4d429c22bc29a7d131b4", - "https://i.groupme.com/498x498.gif.9ba90b8b11f94d3dbf50370e1176971c", "https://i.groupme.com/3024x4032.jpeg.68b4bb5e41904268ba3f4461b4c8b307", "https://i.groupme.com/3024x4032.jpeg.6ac82ac8e5c946ac84b6b0e400fdf75c", "https://i.groupme.com/1280x720.jpeg.45cf746afbc140c4966e9975216b836e", @@ -64,5 +54,32 @@ export const imageURLs = [ "https://i.groupme.com/2268x4032.jpeg.b5ea55bd76064a36b7933ffc773194b2", "https://i.groupme.com/575x800.png.7c7844c11f61465a8714575f66c714fe", "https://i.groupme.com/1334x2372.jpeg.1c399ed3f89f4ad382b13cb485f4efcd", - "https://i.groupme.com/2259x3048.jpeg.3c8674314f4f4aeeac095238ab5fe65c" + "https://i.groupme.com/2259x3048.jpeg.3c8674314f4f4aeeac095238ab5fe65c", + "https://i.groupme.com/1600x900.jpeg.44ae6265a13b49b7a3a15f22418a54d4", + "https://i.groupme.com/161x250.jpeg.627cc972bd534f8d9562b91ff0853718", + "https://i.groupme.com/1467x2016.jpeg.372c9674c125466a98d7e699d004245e", + "https://i.groupme.com/894x1078.jpeg.984cead0bd94400cba766bd8e6a3abb6", + "https://i.groupme.com/1165x874.jpeg.00444f2970424617983b4282be7a90d4", + "https://i.groupme.com/1165x874.jpeg.0824d5badfe84a5e86be2a8cf80c30a2", + "https://i.groupme.com/1224x1632.jpeg.c4c525901e334578854274a8499d6f9a", + "https://i.groupme.com/1165x874.jpeg.68647a2cdec040958db888a2f75d82a9", + "https://i.groupme.com/1917x2556.jpeg.0455cf6283d84306be1ec3b5281bad07", + "https://i.groupme.com/1333x1000.jpeg.2e06800e9a4b41c9ba5801b386a325a4", + "https://i.groupme.com/1536x2048.jpeg.55d5227b3d914d06a65f6a68c540c058", + "https://i.groupme.com/433x577.jpeg.5deb4e3370a24fa39cfdf49599b3e6e7", + "https://i.groupme.com/1827x2436.jpeg.96f4c5089f1a49afbb1c5c6a51322997", + "https://i.groupme.com/1917x2556.jpeg.847cbe1456f9411d8b47b40b2dfadce6", + "https://i.groupme.com/224x224.jpeg.ed1bd0080936486c9de30aeed796993f", + "https://i.groupme.com/182x274.jpeg.3dbad591aadd449d9ebc619e9d3a8d6a", + "https://i.groupme.com/2040x1530.jpeg.1043bb6112434022a89eec0a490f0770", + "https://i.groupme.com/1333x616.jpeg.cbc8073acea94c8eb4c9acae52b27ab1", + "https://i.groupme.com/220x213.jpeg.33ffba4f75034a24a61cd9cec26c4f8d", + "https://i.groupme.com/2436x3246.jpeg.9f3cd8c6c93042d3adac298f8a4e5ae4", + "https://i.groupme.com/2340x3816.jpeg.4c0ab73d8f73472985b090b82a1a24d0", + "https://i.groupme.com/160x144.jpeg.eb9a1bf53eb74e2bac2e545362425a62", + "https://i.groupme.com/955x765.png.55d445ce7dcf4b8ea9d7a0224712c675", + "https://i.groupme.com/551x699.jpeg.a9a384d7b0e54fa887a3d76c69ff17ef", + "https://i.groupme.com/2097x2796.jpeg.0e656e5ff70447b1904cbae8a68b3709", + "https://i.groupme.com/800x450.jpeg.78bae4e7e4d349a6aca6438477208c2b", + "https://i.groupme.com/388x392.jpeg.5501575e561d4ef5a13694c372c14b96" ]; \ No newline at end of file diff --git a/videoURLs.js b/videoURLs.js new file mode 100644 index 000000000..445b01d79 --- /dev/null +++ b/videoURLs.js @@ -0,0 +1,5 @@ +export const videoURLs = [ + "https://v.groupme.com/25731142/2024-09-09T22:32:48Z/4030dabb.1080x1918r0.mp4", + "https://v.groupme.com/25731142/2024-06-08T00:35:31Z/648f309e.586x540r0.mp4", + "https://v.groupme.com/25731142/2024-09-12T01:42:44Z/435e05c0.114x126r0.mp4" +]; \ No newline at end of file From de0b9fdd1aae21066101b8e36a79352ae1a9e504 Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sun, 15 Sep 2024 21:09:17 -0400 Subject: [PATCH 48/49] added bot token back --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index d9ba73fb9..8e1b0cb5d 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -BOT_ID="BOT_ID" \ No newline at end of file +BOT_ID="de7b9e2d4f6734f3e993ba22d5" \ No newline at end of file From 7b89c6401c0484102d613759abb0c3decf13455e Mon Sep 17 00:00:00 2001 From: Jake Scott <69864859+TheBiggestOfBoys@users.noreply.github.com> Date: Sun, 15 Sep 2024 21:20:30 -0400 Subject: [PATCH 49/49] added error handling --- bot.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bot.js b/bot.js index 3366de42f..d13da786a 100644 --- a/bot.js +++ b/bot.js @@ -25,12 +25,19 @@ var body = { }; function respond() { - var request = JSON.parse(this.req.chunks[0]); - console.log(request); + try { + var request = JSON.parse(this.req.chunks[0]); + console.log(request); - if ((request.text && Math.random() > 0.95) || (request.text == "HeIIo")) { - this.res.writeHead(200); - postMessage(); + if ((request.text && Math.random() > 0.95) || (request.text == "HeIIo")) { + this.res.writeHead(200); + postMessage(); + this.res.end(); + } + } + catch (error) { + console.error('Error parsing request:', error); + this.res.writeHead(400); this.res.end(); } }