From 7f01482a6ee848fdb0eb048a1413b26aa02d9bb0 Mon Sep 17 00:00:00 2001 From: lolcat Date: Sun, 3 Nov 2024 16:59:48 -0500 Subject: [PATCH] yeaa --- client.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client.js b/client.js index e280296..e585573 100644 --- a/client.js +++ b/client.js @@ -8,6 +8,8 @@ const ddg = require("duckduckgo-images-api"); var mmm = require("mmmagic"); var Magic = mmm.Magic; +var ws_logged_in = false; + const mineflayer = require("mineflayer"); const mc_bridge_enabled = true; @@ -200,6 +202,8 @@ async function serveddg(msg, results, page){ */ async function send(channel, text, file = null, forcemime = null){ + if(ws_logged_in === false){ return; } + if(typeof channel == "object"){ channel = channel.channel; @@ -252,6 +256,7 @@ async function send(channel, text, file = null, forcemime = null){ /* Handshake */ + async function handshake(name, password){ /* @@ -319,6 +324,7 @@ async function handshake(name, password){ ws.once("open", function(){ + ws_logged_in = true; deek.emit("login"); const keep_alive = setInterval(function(){ @@ -342,6 +348,7 @@ async function handshake(name, password){ ws.once("close", function(){ + ws_logged_in = false; deek.emit("close"); }); @@ -436,6 +443,7 @@ async function handshake(name, password){ ws.on("error", function(code, reason){ + ws_logged_in = false; deek.emit("error", "code=" + code + " reason=" + reason); }); }