This repository has been archived by the owner on Sep 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb063f3
commit 776ad30
Showing
14 changed files
with
164 additions
and
152 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 [email protected]", (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('') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"users": { "702073622059155466": { "uy": "undefined796790351083339816" } }, | ||
"guilds": {}, | ||
"members": {}, | ||
"channels": {}, | ||
"lists": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ''} | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ const fs = require("fs"); | |
const { exec } = require("child_process"); | ||
const os = require("os"); | ||
|
||
exec("node -v", async (error, stdout, stderr) => { | ||
exec("node -v", (error, stdout, stderr) => { | ||
if (error) { | ||
consoleLog( | ||
"Node.js is not installed. Downloading now... (This will take a while..)", | ||
|
@@ -48,12 +48,14 @@ exec("node -v", async (error, stdout, stderr) => { | |
); | ||
} | ||
} else { | ||
consoleLog(`Node.JS is already installed, jumping directly to Startup.`); | ||
consoleLog(`Node.JS ${stdout} is already installed, jumping directly to Startup.`); | ||
consoleLog(`Checking NPM modules.. This might take a bit`); | ||
|
||
exec("npm i [email protected]"); | ||
|
||
runBot(); | ||
exec("npm i [email protected]", (err) => { | ||
runBot() | ||
}); | ||
exec("npm i @oceanicjs/builders"); | ||
exec("npm i discord-api-types"); | ||
} | ||
}); | ||
|
||
|
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.