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

Commit

Permalink
Release 36 kits
Browse files Browse the repository at this point in the history
  • Loading branch information
devvyyxyz committed Aug 11, 2024
1 parent 54c4952 commit 59fc4e2
Show file tree
Hide file tree
Showing 17 changed files with 7,070 additions and 0 deletions.
Empty file added kits/ActionEditorModal.js
Empty file.
586 changes: 586 additions & 0 deletions kits/ActionModules.js

Large diffs are not rendered by default.

1,909 changes: 1,909 additions & 0 deletions kits/EditorBones.js

Large diffs are not rendered by default.

836 changes: 836 additions & 0 deletions kits/EditorComponents.js

Large diffs are not rendered by default.

538 changes: 538 additions & 0 deletions kits/EditorScripts.js

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions kits/Loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var fs = require("fs");
let lastButton;
let menu;

function closeContextmenu() {
if (menu && !mOpened) {
menu.style.scale = "0";
setTimeout(() => {
menu.remove();
menu = undefined;
}, 200);
}
}

document.onclick = () => {
closeContextmenu()
};
1,080 changes: 1,080 additions & 0 deletions kits/MiscScripts.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions kits/PopupModalHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// don't ask what this is
78 changes: 78 additions & 0 deletions kits/Toolkit/botInit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
const runCmd = require("node-run-cmd");
const customFs = require("fs");

const filePath = "./bot.js";
function consoleLog(log) {
document.getElementById(
"console",
).innerHTML += `<div class="fade" style="margin: auto; margin-top: 6px;">${ansiToHtml(
log,
)}</div>`;
}

let ranbot = false;

const fs = require("fs");
const { exec } = require("child_process");
const os = require("os");

exec("node -v", (error, stdout, stderr) => {
if (error) {
consoleLog(
"Node.js is not installed. Downloading now... (This will take a while..)",
);
const platform = os.platform();

if (platform === "win32") {
exec(
"winget install --accept-source-agreements --accept-package-agreements nodeJS",
(error, stdout, stderr) => {
if (error) {
consoleLog(
`Error occured whilst downloading Node.JS, please visit the support guild or download Node.JS manually`,
);
return;
}
consoleLog(
`Finished downloading Node.js! Studio Bot Maker will close in order to comply with the new changes. Please reopen it afterwards!`,
);

setTimeout(() => {
require("electron").ipcRenderer.send("restart", true);
}, 7500);
},
);
} else {
consoleLog(
"winget is only available on Windows. Please download it manually",
);
}
} else {
consoleLog(`Node.JS ${stdout} is already installed, jumping directly to Startup.`);
consoleLog(`Checking NPM modules.. This might take a bit`);

exec("npm i oceanic.js@1.8.0", (err) => {
runBot()
});
exec("npm i @oceanicjs/builders");
exec("npm i discord-api-types");
}
});

async function runBot() {
if (ranbot == true) return;
ranbot = true;
customFs.writeFileSync(
"bot.js",
customFs.readFileSync("./AppData/bot.js", "utf8"),
);
runCmd
.run(`node ${filePath}`, { onData: consoleLog, onError: consoleLog, oncancel: cancelWindow })
.catch((error) => {
consoleLog(`Error executing bot.js: ${error}`);
});
}

let cancelWindow = () => {
ipcRenderer.send('')
}
22 changes: 22 additions & 0 deletions kits/Toolkit/interactionTools.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
stopExecution(uID) {
var tempVars = JSON.parse(fs.readFileSync("./tempVars.json", "utf8"));

tempVars[uID][`${uID}_stop`] = true;
fs.writeFileSync("./tempVars.json", JSON.stringify(tempVars));
},
async runCommand(id, actionRunner, uID, client, message) {
const datjson = require("../data.json");
for (let command in datjson.commands) {
if (datjson.commands[command].customId == id) {
await actionRunner(command, message, client, uID);
}
}
},
preventDeletion(uID) {
return;
},
leak(uID, customTimestamp) {
return;
},
};
7 changes: 7 additions & 0 deletions kits/Toolkit/storedData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"users": { },
"guilds": {},
"members": {},
"channels": {},
"lists": {}
}
31 changes: 31 additions & 0 deletions kits/Toolkit/variableTools.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
transf(text, variables) {
try {
const tempVars = (variable) => {
if (typeof variables[variable] == 'string' || variables[variable] == undefined || typeof variables[variable] == 'number') {
return variables[variable];
} else {
try {
if (variables[variable].userID) {
return `<@${variables[variable].user.id}>`
} else if (variables[variable].topic && variables[variable].guildID) {
return `<#${variables[variable].id}>`
} else if (variables[variable].publicFlags) {
return `<@${variables[variable].id}>`
} else if (typeof variables[variable].hoist == "boolean") {
return `<@&${variables[variable].id}>`
}
} catch (err) {return variables[variable]}
}
};

let formattedText = text;
if (formattedText.includes("`")) {
formattedText = formattedText.replace(/`/g, "/`");
}

const evaluatedText = eval("`" + formattedText + "`");
return evaluatedText;
} catch (err) {return ''}
},
};
2 changes: 2 additions & 0 deletions kits/botLoader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var Convert = require("ansi-to-html");
var convert = new Convert();
Loading

0 comments on commit 59fc4e2

Please sign in to comment.