This repository has been archived by the owner on Oct 13, 2024. 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
Showing
17 changed files
with
7,070 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -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() | ||
}; |
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
// don't ask what this is |
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 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('') | ||
} |
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": { }, | ||
"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 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,2 @@ | ||
var Convert = require("ansi-to-html"); | ||
var convert = new Convert(); |
Oops, something went wrong.