From e3fef4f097d30df5008dd64986a2d28fc7456101 Mon Sep 17 00:00:00 2001 From: MrGeorgen Date: Sun, 28 Jun 2020 13:03:51 +0200 Subject: [PATCH] fixed reconnecting crashes --- README.md | 12 ++++++------ config.json | 4 ++-- src/main.js | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f84df5d..0f32e32 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ A fork of the popular proxy to wait out 2b2t.org's way too long queue. [2lazy2wa # How to use 1. Read the code to ensure i'm not stealing your credentials. i'm not, but you shouldn't take my word for it. If you don't know how to read it, downloading stuff off the internet and giving it your password is probably a bad idea anyway. -2. Run 'npm start' +2. Run `npm start` 3. Your bot should be online now, in discord it should show up with "Queue stopped." 4. See below for commands on how to start the queue. 5. You can access the original 2bored2wait web interface from http://localhost @@ -30,11 +30,11 @@ A fork of the popular proxy to wait out 2b2t.org's way too long queue. [2lazy2wa # Commands All commands can be used through discord or the cli. -- 'start' will start the queue. It takes between 15-30 seconds for the bot to update with the queue position. -- 'start 14:00' will start at 2pm. -- 'play 8:00' will try to calculate the right time to join so you can at 8:00 -- 'update' will send an update to the current channel with your position and ETA. -- 'stop' will stop the queue. +- `start` will start the queue. It takes between 15-30 seconds for the bot to update with the queue position. +- `start 14:00` will start at 2pm. +- `play 8:00` will try to calculate the right time to join so you can at 8:00 +- `update` will send an update to the current channel with your position and ETA. +- `stop` will stop the queue. # Forewarning Do not give your secrets.json file to anyone under any circumstances. diff --git a/config.json b/config.json index a3f26a7..2dce1bc 100644 --- a/config.json +++ b/config.json @@ -14,11 +14,11 @@ "notConnectedQueueEnd": true // restart the queue if you are not connect at the end of it }, "minecraftserver": { // the server you want to connect. Make not much sense to change it, was just added for development purpose - "hostname": "2b2t.org", + "hostname": "localhost", "port": 25565, "renderDistance": 8, "version": "1.12.2", - "onlinemode": true, // chunk caching does not work correctly if set to false + "onlinemode": false, // chunk caching does not work correctly if set to false "username": "lol" // the username to use if onlinemode is false }, "notification": { // sends a message via discord if the place in the queue reaches the specified number diff --git a/src/main.js b/src/main.js index 996ebd8..110c81f 100644 --- a/src/main.js +++ b/src/main.js @@ -119,7 +119,6 @@ function join() { let headermessage = JSON.parse(data.header); let positioninqueue = headermessage.text.split("\n")[5].substring(25); webserver.queuePlace = positioninqueue; // update info on the web page - console.log(positioninqueue); if (webserver.queuePlace !== "None" && lastQueuePlace !== webserver.queuePlace) { if (!totalWaitTime) { totalWaitTime = Math.pow(positioninqueue / 35.4, 2 / 3); @@ -392,6 +391,7 @@ function userInput(cmd, DiscordOrigin, discordMsg) { sendDiscordMsg(discordMsg.channel, "Timer", "Queue is starting at " + starttimestring); } else console.log("Queue is starting at " + starttimestring); } else if (/^play (\d|[0-1]\d|2[0-3]):[0-5]\d$/.test(cmd)) { + timeStringtoDateTime(cmd); calcTime(cmd); let output = "The perfect time to start the will be calculated, so you play at " + starttimestring; if (DiscordOrigin) sendDiscordMsg(discordMsg.channel, "time calculator", output); @@ -475,4 +475,4 @@ module.exports = { stop: function () { stop(); } -}; \ No newline at end of file +};