From 47c14852f49a7bb87208d21ce90bcb28b140a50f Mon Sep 17 00:00:00 2001 From: mrepol742 Date: Mon, 15 Jan 2024 21:22:33 +0800 Subject: [PATCH] Initial Commit --- index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 539fa4d9..d1617719 100644 --- a/index.js +++ b/index.js @@ -441,20 +441,32 @@ function redfox_fb(fca_state, login, cb) { } } + // check if thread lock exists and is not equal to current bot id + // then return + if (settingsThread[event.threadID].lock && settingsThread[event.threadID].lock != api.getCurrentUserID()) { + return; + } + + // if the current bot id is not the root user if (!isMyId(api.getCurrentUserID())) { + // if the settings thread is undefined if (!settingsThread[event.threadID]) { + // set the defaults settingsThread[event.threadID] = settingsThread.default; + // mute the threads api.muteThread(event.threadID, -1, (err) => { if (err) utils.logged(err); }); } + // check if thread lock didnt exists if (!settingsThread[event.threadID].lock) { + // apply thread lock from the first bot settingsThread[event.threadID]["lock"] = api.getCurrentUserID(); utils.logged("thread_lock " + event.threadID + " to " + api.getCurrentUserID()); } - if (settingsThread[event.threadID].lock && settingsThread[event.threadID].lock != api.getCurrentUserID()) { + if (settingsThread[event.threadID].lock != api.getCurrentUserID()) { return; } }