From d041347be77cb3c893a303698c8c65730092d073 Mon Sep 17 00:00:00 2001 From: Melvin Jones Repol Date: Sat, 17 Jun 2023 14:18:27 +0800 Subject: [PATCH] Initial Commit --- appstate.json | 66 +-------------------------------------------------- index.js | 10 ++++---- 2 files changed, 6 insertions(+), 70 deletions(-) diff --git a/appstate.json b/appstate.json index 0bcd8b8..00a55f0 100644 --- a/appstate.json +++ b/appstate.json @@ -1,65 +1 @@ -[ - { - "key": "sb", - "value": "T3OoYxBs6E23jJvXAJjX7iM7", - "domain": "facebook.com", - "path": "/", - "hostOnly": false, - "creation": "2023-03-16T15:29:56.423Z", - "lastAccessed": "2023-03-16T15:29:56.424Z" - }, - { - "key": "datr", - "value": "MXENZK7UNLTcWMkRSBSM3NSJ", - "domain": "facebook.com", - "path": "/", - "hostOnly": false, - "creation": "2023-03-16T15:29:56.424Z", - "lastAccessed": "2023-03-16T15:29:56.424Z" - }, - { - "key": "dpr", - "value": "0.8999999761581421", - "domain": "facebook.com", - "path": "/", - "hostOnly": false, - "creation": "2023-03-16T15:29:56.424Z", - "lastAccessed": "2023-03-16T15:29:56.424Z" - }, - { - "key": "c_user", - "value": "100071743848974", - "domain": "facebook.com", - "path": "/", - "hostOnly": false, - "creation": "2023-03-16T15:29:56.424Z", - "lastAccessed": "2023-03-16T15:29:56.424Z" - }, - { - "key": "wd", - "value": "1474x644", - "domain": "facebook.com", - "path": "/", - "hostOnly": false, - "creation": "2023-03-16T15:29:56.424Z", - "lastAccessed": "2023-03-16T15:29:56.424Z" - }, - { - "key": "xs", - "value": "16%3Ae6s0LMBJ1xIFYw%3A2%3A1678602650%3A-1%3A3222%3A%3AAcVS14-tRV2JH3ec6twyv56AqWuwUMZ26UjdubZ-4iI", - "domain": "facebook.com", - "path": "/", - "hostOnly": false, - "creation": "2023-03-16T15:29:56.424Z", - "lastAccessed": "2023-03-16T15:29:56.424Z" - }, - { - "key": "fr", - "value": "0tCm83SXUgvPiiaKo.AWUH4zzMpiJa3X8YtnvyBLo5VcI.BkEFsO.B3.AAA.0.0.BkEFsO.AWV6DEolPeU", - "domain": "facebook.com", - "path": "/", - "hostOnly": false, - "creation": "2023-03-16T15:29:56.424Z", - "lastAccessed": "2023-03-16T15:29:56.424Z" - } -] \ No newline at end of file +[[]] \ No newline at end of file diff --git a/index.js b/index.js index ef4181e..eaa4be9 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,7 @@ const { Configuration, OpenAIApi } = require("openai"); log.info("bot", "online"); const PORT = 8080; -const isAppState = true; +let isAppState = true; const openAiKey = ""; http.createServer(function (req, res) { @@ -48,7 +48,7 @@ login({ appState: JSON.parse(fs.readFileSync("appstate.json", "utf8")) }, (err, api.setOptions({ listenEvents: true, - selfListen: false, + selfListen: true, autoMarkRead: false, autoMarkDelivery: false, online: true, @@ -56,12 +56,12 @@ login({ appState: JSON.parse(fs.readFileSync("appstate.json", "utf8")) }, (err, }); process.on("exit", (code) => { - fs.writeFileSync(__dirname + "/appstate.json", api.getAppState(), "utf8"); + fs.writeFileSync(__dirname + "/appstate.json", JSON.stringify(api.getAppState()), "utf8"); log.info("bot", "offline"); }); setInterval(function () { - fs.writeFileSync(__dirname + "/appstate.json", api.getAppState(), "utf8"); + fs.writeFileSync(__dirname + "/appstate.json", JSON.stringify(api.getAppState()), "utf8"); log.info("app_state", "refresh"); }, Math.floor(1800000 * Math.random() + 1200000)); @@ -69,7 +69,7 @@ login({ appState: JSON.parse(fs.readFileSync("appstate.json", "utf8")) }, (err, if (err) return log.error(err); if (isAppState) { - fs.writeFileSync(__dirname + "/appstate.json", api.getAppState(), "utf8"); + fs.writeFileSync(__dirname + "/appstate.json", JSON.stringify(api.getAppState()), "utf8"); isAppState = false; } switch (event.type) {