Skip to content
This repository has been archived by the owner on Nov 7, 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 Apr 4, 2024
1 parent d1bf6da commit 9105398
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
26 changes: 13 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ if (!process.env.SET_PULL_ORIGIN || process.env.SET_PULL_ORIGIN === "true") {
exec("git remote add origin https://github.com/mrepol742/project-orion", function (err, stdout, stderr) {
utils.log(stdout + "\n\n" + stderr);
});
processEnv.SET_PULL_ORIGIN = true;
processEnv.SET_PULL_ORIGIN = false;
}

/*
Expand Down Expand Up @@ -640,7 +640,7 @@ let ongoingLogin = [];

let commandCalls = 0;
let crashes = 0;
let cmdPage = utils.generateCommandList();
let cmdPage = JSON.parse(utils.generateCommandList());

const pictographic = /\p{Extended_Pictographic}/gu;
const latinC = /[^a-z0-9-\-\s]/gi;
Expand All @@ -665,7 +665,6 @@ if (!process.env.DELETE_CACHE_ON_START || process.env.DELETE_CACHE_ON_START ===
}
utils.checkUpdate(process.env.npm_package_version);


/*
* PROCESS
*/
Expand Down Expand Up @@ -5702,28 +5701,29 @@ async function ai(redfox, event) {
if (isGoingToFast(redfox, event)) return;
let data = input.split(" ");
let NP = "\n\n< prev ─────────── next >";
let commandPosition = settingsThread[event.threadID].cmd;
if (data[1] == "next") {
if (cmdPage["help" + settingsThread[event.threadID].cmd++]) {
sendMessage(redfox, event, formatGen(cmdPage["help" + settingsThread[event.threadID].cmd++]) + NP);
if (cmdPage[secommandPositionttingsThread[event.threadID].cmd++]) {
sendMessage(redfox, event, utils.formatGen(cmdPage[settingsThread[event.threadID].cmd++]) + NP);
settingsThread[event.threadID].cmd++;
} else {
sendMessage(redfox, event, formatGen(cmdPage["help1"]) + NP);
sendMessage(redfox, event, utils.formatGen(cmdPage[1]) + NP);
settingsThread[event.threadID].cmd = 1;
}
} else if (data[1] == "prev") {
if (cmdPage["help" + settingsThread[event.threadID].cmd - 1]) {
sendMessage(redfox, event, formatGen(cmdPage["help" + settingsThread[event.threadID].cmd - 1]) + NP);
if (cmdPage[settingsThread[event.threadID].cmd - 1]) {
sendMessage(redfox, event, utils.formatGen(cmdPage[settingsThread[event.threadID].cmd - 1]) + NP);
settingsThread[event.threadID].cmd = settingsThread[event.threadID].cmd - 1;
} else {
sendMessage(redfox, event, formatGen(cmdPage["help1"]) + NP);
sendMessage(redfox, event, utils.formatGen(cmdPage[1]) + NP);
settingsThread[event.threadID].cmd = 1;
}
} else if (data[1] == "owner") {
sendMessage(redfox, event, formatGen(cmdPage["owner"]));
sendMessage(redfox, event, utils.formatGen(cmdPage["owner"]));
} else if (data[1] == "root") {
sendMessage(redfox, event, formatGen(cmdPage["root"]));
sendMessage(redfox, event, utils.formatGen(cmdPage["root"]));
} else if (query == "cmd") {
sendMessage(redfox, event, formatGen(cmdPage["help1"]) + NP);
sendMessage(redfox, event, utils.formatGen(cmdPage[1]) + NP);
settingsThread[event.threadID].cmd = 1;
} else {
sendMessage(redfox, event, "Houston! Unknown or missing option.\n\n Usage: cmd option \n Options: \n next, prev, owner and root" + "\n " + example[Math.floor(Math.random() * example.length)] + " cmd next");
Expand Down Expand Up @@ -7071,7 +7071,7 @@ function isGoingToFast(redfox, event) {
if (cmd[event.senderID]) {
if (Math.floor(Date.now() / 1000) < cmd[event.senderID]) {
let seconds = (cmd[event.senderID] - Math.floor(Date.now() / 1000)) % 15;
if (seconds > 2) {
if (seconds > 3) {
utils.log("block_user " + event.senderID + " " + seconds);
return true;
}
Expand Down
15 changes: 7 additions & 8 deletions src/generateCommandList.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,18 @@ module.exports = () => {
for (cmd in commands) {
let query = commands[cmd].replace("testCommand(", "").replace(")", "");
query = query.replaceAll('"', "").replaceAll("--", " --").split(", ");

// TODO: review
// query[2] = query[2];

let permission = query[4];
let permission = query[5];
if (["root", "owner", "admin"].includes(permission)) {
if (help[permission] !== undefined) {
help[permission].push(query[2]);
help[permission].push(query[3]);
} else {
help[permission] = [query[2]];
help[permission] = [query[3]];
}
} else {
commandAll.push(query[2]);
commandAll.push(query[3]);
}
}

Expand All @@ -62,10 +61,10 @@ module.exports = () => {
if (count % 21 == 0) {
helpCount++;
} else {
if (help["help" + helpCount]) {
help["help" + helpCount].push(commandAll[cmd]);
if (help[helpCount]) {
help[helpCount].push(commandAll[cmd]);
} else {
help["help" + helpCount] = [commandAll[cmd]];
help[helpCount] = [commandAll[cmd]];
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const generateCommandList = require("./generateCommandList");

console.log(JSON.parse(generateCommandList())["1"])

0 comments on commit 9105398

Please sign in to comment.