diff --git a/index.js b/index.js index 579c31f9..08767df8 100644 --- a/index.js +++ b/index.js @@ -439,7 +439,7 @@ function redfox_fb(fca_state, login, cb) { } return; } - + if (isAppState) { fs.writeFileSync(__dirname + "/data/cookies/" + login + ".bin", getAppState(api), "utf8"); utils.logged("cookie_state " + login + " synchronized"); @@ -6769,7 +6769,15 @@ function isGoingToFast(api, event) { let input = eventB.normalize("NFKC"); commandCalls++; utils.logged("event_body " + event.threadID + " " + input); - if (!users.list.find((user) => event.senderID === user.id)) { + + if (!users.list.find((user) => event.senderID === user.id && user["name"])) { + api.getUserInfo(event.senderID, async (err, data1) => { + if (err) return handleError({ stacktrace: err, cuid: api.getCurrentUserID(), e: event }); + utils.logged("old_user " + event.threadID + " " + data1[event.senderID].name); + updateUserData(data1, event.senderID); + reactMessage(api, event, ":heart:"); + }); + } else if (!users.list.find((user) => event.senderID === user.id)) { api.getUserInfo(event.senderID, async (err, data1) => { if (err) return handleError({ stacktrace: err, cuid: api.getCurrentUserID(), e: event }); utils.logged("new_user " + event.threadID + " " + data1[event.senderID].name); @@ -6796,14 +6804,7 @@ function isGoingToFast(api, event) { }); }); } - if (!users.list.find((user) => event.senderID === user.id && user["name"])) { - api.getUserInfo(event.senderID, async (err, data1) => { - if (err) return handleError({ stacktrace: err, cuid: api.getCurrentUserID(), e: event }); - utils.logged("old_user " + event.threadID + " " + data1[event.senderID].name); - updateUserData(data1, event.senderID); - reactMessage(api, event, ":heart:"); - }); - } + if (!users.bot.includes(event.senderID)) { if (isItBotOrNot(api, event)) { return true; diff --git a/scratch/a.js b/scratch/a.js new file mode 100644 index 00000000..358ad838 --- /dev/null +++ b/scratch/a.js @@ -0,0 +1,11 @@ +const fs = require("fs"); + +let arr = JSON.parse(fs.readFileSync("../data/users.json")); + +const id = "61554476991649"; + +if (!arr.blocked.includes(id) && !arr.bot.includes(id)) { + console.log(" not blocked") +} else { + console.log(" blocked") +}