Skip to content

Commit

Permalink
the script now rechecks the token
Browse files Browse the repository at this point in the history
  • Loading branch information
LukachoLombardi committed Jun 7, 2023
1 parent 7a1721b commit 1987fd6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
23 changes: 16 additions & 7 deletions FelizJueves/FelizCheck/FelizCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const discord = require("discord-user-bots");

let tokenPath = __dirname + "/token.txt";
let settingsPath = __dirname + "/settings.json";
let userToken = "token"


function seekMidnight(days) {
Expand Down Expand Up @@ -40,11 +41,6 @@ function setStatus(userToken, status, statusEmoji, days, callback) {
};
}

let userToken = "token"
if (fs.existsSync(tokenPath) === true) {
userToken = fs.readFileSync(tokenPath, "utf8");
}

function checkFeliz() {
const settings = JSON.parse(fs.readFileSync(settingsPath, "utf8"));

Expand Down Expand Up @@ -132,5 +128,18 @@ function recursiveFeliz() {
scheduleRecFeliz();
}

checkFeliz();
scheduleRecFeliz();
main();
async function main(){
while(fs.existsSync(tokenPath) === false){
await new Promise(resolve => setTimeout(resolve, 5000));
}
console.log("found token file");
userToken = fs.readFileSync(tokenPath, "utf8");
while(userToken === undefined || userToken.length === 0){
userToken = fs.readFileSync(tokenPath, "utf8");
await new Promise(resolve => setTimeout(resolve, 5000));
}
console.log("found token value");
checkFeliz();
scheduleRecFeliz();
}
4 changes: 2 additions & 2 deletions FelizJueves/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const fs = require("fs");
console.log("starting checker");

onOpenCallback();
nw.Window.get(undefined).close();
nw.Window.get(undefined).hide();

// configuring the tray
try {
Expand All @@ -16,7 +16,7 @@ try {
}
if (userToken === undefined || userToken === "") {
console.error("token.txt is empty or missing");
trayTooltip = "token.txt is empty or missing. Add it and restart.";
trayTooltip = "userToken may be empty or missing. Add it and check if it works.";
} else {
trayTooltip = "Feliz Jueves is running🎉";
}
Expand Down
2 changes: 1 addition & 1 deletion FelizJueves/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"blacklist": "",
"custom_script": "",
"download_dir": "",
"export_dir": "output",
"export_dir": "C:/Users/lulll/WebstormProjects/feliz_jueves/build/0.2.0",
"force_download": false,
"nw_compression_level": 0,
"nw_version": "0.76.1",
Expand Down
5 changes: 3 additions & 2 deletions FelizJueves/web2exe.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
"blacklist": "",
"custom_script": "",
"download_dir": "",
"export_dir": "C:/Users/lulll/WebstormProjects/feliz_jueves/build/0.2.0",
"export_dir": "C:/Users/lulll/WebstormProjects/feliz_jueves/build/0.2.1",
"force_download": false,
"linux-x64": true,
"nw_compression_level": 0,
"nw_version": "0.76.1",
"output_pattern": "",
"sdk_build": false,
"uncompressed_folder": true,
"whitelist": "",
"windows-x32": false,
"windows-x64": true
"windows-x64": false
}
}

0 comments on commit 1987fd6

Please sign in to comment.