Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
beta
Browse files Browse the repository at this point in the history
  • Loading branch information
RatWasHere committed Aug 6, 2023
1 parent c9828d9 commit edae9b2
Show file tree
Hide file tree
Showing 18 changed files with 546 additions and 142 deletions.
Binary file modified AppData.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion AppData/Actions/createList.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
let transferVariables = require(`../Toolkit/variableTools.js`).transf;

const transf = (value) => {
transferVariables(value, bridge.variables);
return transferVariables(value, bridge.variables);
};

bridge.variables[transf(values.listName)] = [];
Expand Down
47 changes: 47 additions & 0 deletions AppData/Actions/deleteChannel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
module.exports = {
data: {
name: "Delete Channel",
channel: "",
channelFrom: "Command channel",
threadName: "",
autoArchive: "",
storeAs: "",
},
UI: {
compatibleWith: ["Text", "Slash"],
text: "Delete Channel",
sepbar:"",

btext: "Get Channel Via",
menuBar: {choices: ["Command Channel", "Variable*", "ID*"], storeAs: "channelFrom", extraField: "channel"},

variableSettings: {
channel: {
"Variable*": "direct"
}
}
},
subtitle: "Get Channel Via: $[channelFrom]$",
async run(values, message, client, bridge) {
let transferVariables = require(`../Toolkit/variableTools.js`).transf;

const transf = (value) => {
return transferVariables(value, bridge.variables);
};

let channel;

if (values.channelFrom == 'Command Channel') {
channel = message.channel;
}
if (values.channelFrom == 'Variable*') {
let chan = bridge.variables[transf(values.channel)]
channel = chan.channel || client.getChannel(chan.id)
}
if (values.channelFrom == 'ID*') {
channel = client.getChannel(transf(values.channel))
}

channel.delete()
},
};
44 changes: 44 additions & 0 deletions AppData/Actions/deleteChannel_event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
module.exports = {
data: {
name: "Delete Channel",
channel: "",
channelFrom: "Variable*",
threadName: "",
autoArchive: "",
storeAs: "",
},
UI: {
compatibleWith: ["Text", "Slash"],
text: "Delete Channel",
sepbar:"",

btext: "Get Channel Via",
menuBar: {choices: ["Variable*", "ID*"], storeAs: "channelFrom", extraField: "channel"},

variableSettings: {
channel: {
"Variable*": "direct"
}
}
},
subtitle: "Get Channel Via: $[channelFrom]$",
async run(values, message, client, bridge) {
let transferVariables = require(`../Toolkit/variableTools.js`).transf;

const transf = (value) => {
return transferVariables(value, bridge.variables);
};

let channel;

if (values.channelFrom == 'Variable*') {
let chan = bridge.variables[transf(values.channel)]
channel = chan.channel || client.getChannel(chan.id)
}
if (values.channelFrom == 'ID*') {
channel = client.getChannel(transf(values.channel))
}

channel.delete()
},
};
5 changes: 2 additions & 3 deletions AppData/Actions/sendmessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,8 @@ module.exports = {
channel = DMchannel;
}
if (values.sendTo == "Channel Variable*") {
channel = client.getChannel(
bridge.variables[varTools.transf(values.to, bridge.variables)].id,
);
let chan = bridge.variables[varTools.transf(values.to, bridge.variables)]
channel = chan.channel || client.getChannel(chan.id)
}
if (values.sendTo == "Channel ID*") {
channel = client.getChannel(varTools.transf(values.to, bridge.variables));
Expand Down
5 changes: 2 additions & 3 deletions AppData/Actions/sendmessage_event.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,8 @@ module.exports = {

let channel;
if (values.sendTo == "Channel Variable*") {
channel = client.getChannel(
bridge.variables[varTools.transf(values.to, bridge.variables)].id,
);
let chan = bridge.variables[varTools.transf(values.to, bridge.variables)]
channel = chan.channel || client.getChannel(chan.id)
}
if (values.sendTo == "Channel ID*") {
channel = client.getChannel(varTools.transf(values.to, bridge.variables));
Expand Down
79 changes: 79 additions & 0 deletions AppData/Actions/startThread.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
module.exports = {
data: {
name: "Start Thread",
message: "",
messageFrom: "Command Message",
threadName: "",
autoArchive: "",
storeAs: "",
},
UI: {
compatibleWith: ["Text"],
text: "Start Thread",
sepbar:"",
btext: "Get Thread Parent Message Via",
menuBar: {choices: ["Command Message", "Variable*"], storeAs: "messageFrom", extraField: "message"},

sepbar0:"",

btext0: "Thread Name",
input: "threadName",

sepbar1: "",

btext1: "Thread Auto-Archive Duration",
menuBar0: {choices: ["1 Hour", "24 Hours", "3 Days", "1 Week"], storeAs: "autoArchive"},

sepbar2:"",

btext2: "Store Thread As",
"input!":"storeAs",

variableSettings: {
message: {
"Variable*": "direct"
}
}
},
subtitle: "Message: $[messageFrom]$ - Archive After: $[autoArchive]$",
async run(values, message, client, bridge) {
let transferVariables = require(`../Toolkit/variableTools.js`).transf;

const transf = (value) => {
return transferVariables(value, bridge.variables);
};


let threadName = transf(values.threadName)

let autoArchive;

switch(values.autoArchive) {
case '1 Hour':
autoArchive = 60;
break
case '24 Hours':
autoArchive = 1440
break
case '3 Days':
autoArchive = 4320
break
case '1 Week':
autoArchive = 10080
break
}

let msg;

if (values.messageFrom == 'Command Message') {
msg = message
} else {
msg = bridge.variables[transf(values.message)]
}
let thread = await msg.startThread({
name: threadName,
autoArchiveDuration: autoArchive
})
bridge.variables[transf(values.storeAs)] = thread
},
};
73 changes: 73 additions & 0 deletions AppData/Actions/startThread_event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
module.exports = {
data: {
name: "Start Thread",
message: "",
threadName: "",
autoArchive: "",
storeAs: "",
},
UI: {
compatibleWith: ["Slash", "Event"],
text: "Start Thread",
sepbar:"",
btext: "Parent Message Variable",
"input_direct": "message",

sepbar0:"",

btext0: "Thread Name",
input: "threadName",

sepbar1: "",

btext1: "Thread Auto-Archive Duration",
menuBar0: {choices: ["1 Hour", "24 Hours", "3 Days", "1 Week"], storeAs: "autoArchive"},

sepbar2:"",

btext2: "Store Thread As",
"input!":"storeAs",

variableSettings: {
message: {
"Variable*": "direct"
}
}
},
subtitle: "Message: $[messageFrom]$ - Archive After: $[autoArchive]$",
async run(values, message, client, bridge) {
let transferVariables = require(`../Toolkit/variableTools.js`).transf;

const transf = (value) => {
return transferVariables(value, bridge.variables);
};


let threadName = transf(values.threadName)

let autoArchive;

switch(values.autoArchive) {
case '1 Hour':
autoArchive = 60;
break
case '24 Hours':
autoArchive = 1440
break
case '3 Days':
autoArchive = 4320
break
case '1 Week':
autoArchive = 10080
break
}

let msg = bridge.variables[transf(values.message)]

let thread = await msg.startThread({
name: threadName,
autoArchiveDuration: autoArchive
})
bridge.variables[transf(values.storeAs)] = thread
},
};
52 changes: 31 additions & 21 deletions AppData/Kits/EditorBones.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,35 @@ const { app, ipcRenderer } = require("electron");
let selectedGroupType = "text";
let copiedAction;

const { Worker } = require('worker_threads');

function runInWorker(method) {
return new Promise((resolve, reject) => {
const worker = new Worker(`
const { parentPort } = require('worker_threads');
parentPort.on('message', (method) => {
try {
method();
parentPort.postMessage('Code execution completed.');
} catch (error) {
parentPort.postMessage({ error: error.message });
}
});
`);

worker.on('message', (message) => {
if (typeof message === 'string') {
resolve(message);
} else {
reject(new Error(message.error));
}
worker.terminate();
});

worker.postMessage(method.toString());
});
}

function editAction() {
let variables = [];
let actionType = "text";
Expand Down Expand Up @@ -82,6 +111,7 @@ const fs = require("fs");
const processPath = require("process").cwd();
const path = require("path");
var botData = JSON.parse(fs.readFileSync(processPath + "/AppData/data.json"));
document.getElementById('titlebar').innerText = `Studio Bot Maker - Editing ${botData.name}`
let lastType = 0; // 0 = Command; 1 = Actions;
let lastObj = "1";
let lastAct = "1";
Expand Down Expand Up @@ -739,27 +769,7 @@ function modcolor() {
sidebar.style.width = "40vw";
sidebar.innerHTML = `
<br>
<div class="sidebartext" style="font-size: 20px;">Editor Theme & Colors</div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #000000;"><div class="colorTileText">Lights Off</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #0b0014;"><div class="colorTileText">Ultraviolet</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #170011;"><div class="colorTileText">Soothing Cherry</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #170006;"><div class="colorTileText">Strawberry</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #170000;"><div class="colorTileText">Bloodshot Pink</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #170701;"><div class="colorTileText">Wood</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #361d1d;"><div class="colorTileText">Salmon</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #170f00;"><div class="colorTileText">Golden Apple</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #262626;"><div class="colorTileText">Smoke</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #24121d;"><div class="colorTileText">Lilac</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #122324;"><div class="colorTileText">Shiny Forest</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #000814;"><div class="colorTileText">Navy Blue</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #071314;"><div class="colorTileText">Forest Green</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #001417;"><div class="colorTileText">Aquamarine</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #000f17;"><div class="colorTileText">Moody Blue</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #141414;"><div class="colorTileText">Gray</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #12241e;"><div class="colorTileText">Mint</div></div>
<div class="colorTile" onclick="setColor(this)" style="background-color: #241212;"><div class="colorTileText">Anger</div></div>
</div>
`;
sidebar.onmouseleave = () => {
sidebar.style.width = "0vw";
Expand Down
Loading

0 comments on commit edae9b2

Please sign in to comment.