Panama Red Preperation Update

-spaced out usernames
-added a few moar tokes
-added more solotoke images
-repeats !toke command used by user
This commit is contained in:
rainbownapkin 2022-02-03 02:47:03 +00:00
parent 81936946b6
commit 27259feede
2 changed files with 32 additions and 14 deletions

View file

@ -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;

View file

@ -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
}