From 27259feedef738e8725122dd231ae40a15e3c64f Mon Sep 17 00:00:00 2001 From: rainbownapkin Date: Thu, 3 Feb 2022 02:47:03 +0000 Subject: [PATCH] Panama Red Preperation Update -spaced out usernames -added a few moar tokes -added more solotoke images -repeats !toke command used by user --- lib/bot.js | 16 ++++++++-------- lib/customchatcommands-toke.js | 30 ++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/lib/bot.js b/lib/bot.js index a832055..83e4406 100644 --- a/lib/bot.js +++ b/lib/bot.js @@ -258,13 +258,13 @@ function Bot(config, readline, ROOT) { this.logger.warn("sameDomainSocketOnly is disabled!"); } var fn = (()=>{ - if (this.cfg.connection.sameDomainSocketOnly && utils.getHostname(server.url).toLowerCase() !== config.connection.hostname.toLowerCase()) { + /*if (this.cfg.connection.sameDomainSocketOnly && utils.getHostname(server.url).toLowerCase() !== config.connection.hostname.toLowerCase()) { this.logger.error(strings.format(this, "SERVER_BAD_HOSTNAME", [config.connection.hostname])); this.kill("bad server hostname"); - } else { + } else {*/ this.socket = sio(server.url, {secure: server.secure}); EventHandlers.setHandlers(this, this.socket, config); - } + //} }); this.actionQueue.enqueue([this, fn, []]); } @@ -777,19 +777,19 @@ Bot.prototype.getSocketConfig = function(room, secure, callback) { this.logger.warn(strings.format(this, "SERVER_INSECURE")) } var fn = (()=>{ - fetch("https://"+this.cfg.connection.hostname+"/socketconfig/" + room + ".json") + fetch(""+this.cfg.connection.hostname+"/socketconfig/" + room + ".json") .then((res)=>{ - if (!res.ok) { + /*(if (!res.ok) { this.logger.error(strings.format(this, "SERVER_ROOM_NOT_FOUND", [room])); this.logger.warn("The server may be having issues, or the room was not found."); this.logger.info("Retrying connection in 60 seconds. Use CTRL+C to exit."); setTimeout(()=>{ - this.getSocketConfig(room, secure, callback); + this.getSocketConfig(room, false, callback); }, 60000); throw new Error(res.statusText); - } else { + } else {*/ return res.json(); - } + //} }) .then((json)=>{ var servers = json.servers; diff --git a/lib/customchatcommands-toke.js b/lib/customchatcommands-toke.js index d18fae5..9a64df8 100644 --- a/lib/customchatcommands-toke.js +++ b/lib/customchatcommands-toke.js @@ -27,6 +27,7 @@ let tokers = []; let cdown = 3; let cdel = 120; let ctime = cdel; +let solotokes = ["", "https://ourfore.st/img/femotes/onetoker.jpg","https://ourfore.st/img/femotes/solotoke.jpg","https://ourfore.st/img/femotes/1toker.gif"]; function getCommands(bot) { var commands = { @@ -42,7 +43,7 @@ function getCommands(bot) { allowRankChange: true, canBeUsedInPM: false }, function (cmd, user, message, opts) { - toke(user.name, bot); + toke(user.name, bot, cmd); }) @@ -109,6 +110,9 @@ function getCommands(bot) { vapem: "420blazeit", fire: "420blazeit", firemup: "420blazeit", + 710: "420blazeit", + roast: "420blazeit", + roastem: "420blazeit" } @@ -120,14 +124,14 @@ module.exports = { getCommands:getCommands } -function toke(name, bot){ +function toke(name, bot, message){ /*if(name === "Ten"){//use in case of anger bot.sendChatMsg(">:^("); return; }*/ switch (toking){ case 0://ready to start toke - bot.sendChatMsg("A group toke has been started by " + name + "! We'll be taking a toke in 60 seconds - join in by posting !toke"); + bot.sendChatMsg("A group toke has been started by " + name + "! We'll be taking a toke in 60 seconds - join in by posting !" + message); cdown = 3; toking = 1; tokers.push(name); @@ -137,7 +141,7 @@ function toke(name, bot){ if(tokers.includes(name)){ bot.sendPM(name, ("You're already taking part in this toke!")); }else{ - bot.sendChatMsg(name + " joined the toke! Post !toke to take part!"); + bot.sendChatMsg(name + " joined the toke! Post !" + message + " to take part!"); tokers.push(name); cdown = 3; } @@ -168,9 +172,17 @@ function endToke(bot){ return; } if(tokers.length > 1){ - bot.sendChatMsg("Take a toke " + tokers.toString() + "! " + tokers.length + " tokers!"); + let callstring = ''; + + for(let i = 0; i < tokers.length - 1; i++){ + callstring += tokers[i] + ', '; + } + + callstring += tokers[tokers.length - 1]; + + bot.sendChatMsg("Take a toke " + callstring + "! " + tokers.length + " tokers!"); }else{ - bot.sendChatMsg("Take a toke " + tokers.toString() + ". https://ourfore.st/img/femotes/onetoker.jpg"); + bot.sendChatMsg("Take a toke " + tokers.toString() + ". " + (solotokes[getRandomInt(0,solotokes.length)])); } tokers = []; toking = 2;//reset toking mode @@ -189,3 +201,9 @@ function cooldown(){ } } + +function getRandomInt(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive +}