Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mrepol742 committed Jun 17, 2023
1 parent d804a2b commit d041347
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 70 deletions.
66 changes: 1 addition & 65 deletions appstate.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
[[]]
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -48,28 +48,28 @@ login({ appState: JSON.parse(fs.readFileSync("appstate.json", "utf8")) }, (err,

api.setOptions({
listenEvents: true,
selfListen: false,
selfListen: true,
autoMarkRead: false,
autoMarkDelivery: false,
online: true,
forceLogin: true
});

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));

const stopListening = api.listenMqtt(async (err, event) => {
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) {
Expand Down

0 comments on commit d041347

Please sign in to comment.