diff --git a/ .prettierignore b/.prettierignore similarity index 100% rename from .prettierignore rename to .prettierignore diff --git a/README.md b/README.md index b81c74e..2fabee9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Demoncord + [![Discord](https://img.shields.io/discord/928470798887452692?color=%23ab8eda&label=Discord&logo=Discord&logoColor=%23ffffff)](https://discord.gg/GQajVzaxvY) A discord client mod by satanists for satanists (if your definition of satanist is a member of the Hazbin Hotel fandom) @@ -40,8 +41,7 @@ Because it's - Will break at the slightest poke or prod (related to the first one) # Screenshots -![Image of the Demoncord plugins menu](screenshots/1.png) - - - \ No newline at end of file +![Image of the Demoncord plugins menu](screenshots/1.png) + + diff --git a/rollup.config.js b/rollup.config.js index 8c44baf..dbd7a08 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -11,14 +11,14 @@ import { readFileSync as readFile, existsSync as fileExists } from "fs"; const projectRootDir = resolvePath(__dirname); -let data +let data; if (fileExists("options.toml")) { - data = readFile("options.toml") + data = readFile("options.toml"); } else if (fileExists("options.default.toml")) { - data = readFile("options.default.toml") + data = readFile("options.default.toml"); } else { - throw new Error("Could not find options file") + throw new Error("Could not find options file"); } export default defineConfig({ diff --git a/src/api/ritual.js b/src/api/ritual.js index b28cefb..515d34a 100644 --- a/src/api/ritual.js +++ b/src/api/ritual.js @@ -1,138 +1,156 @@ -import webpack from "./webpack.js" -import { instead } from "./patcher.js" -import { leak } from "./utils/memory.js" +import webpack from "./webpack.js"; +import { instead } from "./patcher.js"; +import { leak } from "./utils/memory.js"; const sins = { - "Lust": null, - "Pride": null, - "Greed": null, - "Wrath": null, - "Envy": null, - "Gluttony": () => { - //slowly memory leak to make the app notably slower (perhaps even slothier) - setInterval(() => { - leak(6.66) - }, 500) - }, - "Sloth": () => { - //replace some influencial functions to make them wait time - instead(webpack.findByProps("_actionHandlers").__proto__, "dispatch", (args, orig) => { - let res; - setTimeout(() => { - res = orig(...args) - }, 500) - while (!res) {} - return res - }) - } -} + Lust: null, + Pride: null, + Greed: null, + Wrath: null, + Envy: null, + Gluttony: () => { + //slowly memory leak to make the app notably slower (perhaps even slothier) + setInterval(() => { + leak(6.66); + }, 500); + }, + Sloth: () => { + //replace some influencial functions to make them wait time + instead( + webpack.findByProps("_actionHandlers").__proto__, + "dispatch", + (args, orig) => { + let res; + setTimeout(() => { + res = orig(...args); + }, 500); + while (!res) {} + return res; + } + ); + } +}; const rulers = { - "Asmodeus": "Lust", - "Lucifer": "Pride", - "Mammon": "Greed", - "Satan": "Wrath", - "Leviathan": "Envy", - "Beelzebub": "Gluttony", - "Belphegor": "Sloth" -} + Asmodeus: "Lust", + Lucifer: "Pride", + Mammon: "Greed", + Satan: "Wrath", + Leviathan: "Envy", + Beelzebub: "Gluttony", + Belphegor: "Sloth" +}; function ritualFail(sin) { - if (Math.random() > 0.5) { - //use generic failstates - //TODO: add nerd moxxie image and make it play the MLG clip on top of the screen and also make it patch sendMessage and replace every message with something funny idk i'll figure it out later - throw `Illegal Invocation of a sin!` - } else { - if (sin in sins) { - if (!sins[sin]) { - throw `Illegal Invocation of a sin!` - } else { - sins[sin]() - } - } else { - console.log("WTF did you do") - console.log(sin) - //window.location.reload() - } - } + if (Math.random() > 0.5) { + //use generic failstates + //TODO: add nerd moxxie image and make it play the MLG clip on top of the screen and also make it patch sendMessage and replace every message with something funny idk i'll figure it out later + throw `Illegal Invocation of a sin!`; + } else { + if (sin in sins) { + if (!sins[sin]) { + throw `Illegal Invocation of a sin!`; + } else { + sins[sin](); + } + } else { + console.log("WTF did you do"); + console.log(sin); + //window.location.reload() + } + } } function findByRitual(incantation) { - // I call upon the ___ of ___, ___, to ___ the ___ ___ with a ___ of name ___! - // I call upon the embodiment of lust, Asmodeus, to bring forth the imposing object with a property of name FluxDispatcher! - //TODO: should we do "I call upon the [great/almighty/etc].." instead of just "the"? - const args = incantation.split(" ") - if (args.shift() !== "I" || args.shift() !== "call" || args.shift() !== "upon" || args.shift() !== "the") { - ritualFail(sins[Math.floor(Math.random() * sins.length)]) - return - } - const embodiment = args.shift() - if (!(embodiment === "embodiment" || (embodiment === "king" && args.shift() === "sin"))) { //absolutely no clue where i heard them referred to as "king sin of X" before, but i think it sounds cool so i'll keep it - //how did you even fuck this one up - ritualFail(sins[Math.floor(Math.random() * sins.length)]) - return - } - if (args.shift() !== "of") { - ritualFail(sin) - } - const sin = args.shift().replace(",", "") - if (!(sin in sins)) { - //invalid sin, so we can't use it - ritualFail(sins[Math.floor(Math.random() * sins.length)]) - return - } - const ruler = args.shift().replace(",", "") - if (!(ruler in rulers)) { - //invalid ruler, so we still can't use it - //use the sin punishment - ritualFail(sin) - } - if (rulers[ruler] !== sin) { - //sin/ruler mismatch - //i feel it's more fitting to call the sin of the demon, instead of the sin you provided, as you would've angered the ruler for calling them for the wrong sin - ritualFail(rulers[ruler]) - } - if (args.shift() !== "to") { - ritualFail(sin) - } - if (args.shift() !== "summon") { //TODO: we want to accept either "summon" or "bring forth" here but i cbf rn - ritualFail(sin) - } - if (args.shift() !== "the") { - ritualFail(sin) - } - const adjective = args.shift() - if (adjective !== "imposing" && adjective !== "foreboding") { //TODO: sin-specific adjectives - ritualFail(sin) - } - const descriptor = args.shift() - if (descriptor !== "object" && descriptor !== "element") { //TODO: typecheck this shit - ritualFail(sin) - } - if (args.shift() !== "with" || args.shift() !== "a") { - ritualFail(sin) - } - const filter = args.shift() - if (filter !== "display" && filter !== "property") { - ritualFail(sin) - } - if (args.shift() !== "of" || args.shift() !== "name") { - ritualFail(sin) - } - //TODO: HOW THE FUCK ARE WE SUPPOSED TO DO MULTIPLE PROPS? - const prop = args.shift().slice(0,-1) - switch (filter) { - case "display": - return webpack.findByDisplayName(prop) - break - case "property": - return webpack.findByProps(prop) - break - default: - // the only way you can get here is with cosmic rays or divine intervention - ritualFail(sin) - break - } + // I call upon the ___ of ___, ___, to ___ the ___ ___ with a ___ of name ___! + // I call upon the embodiment of lust, Asmodeus, to bring forth the imposing object with a property of name FluxDispatcher! + //TODO: should we do "I call upon the [great/almighty/etc].." instead of just "the"? + const args = incantation.split(" "); + if ( + args.shift() !== "I" || + args.shift() !== "call" || + args.shift() !== "upon" || + args.shift() !== "the" + ) { + ritualFail(sins[Math.floor(Math.random() * sins.length)]); + return; + } + const embodiment = args.shift(); + if ( + !( + embodiment === "embodiment" || + (embodiment === "king" && args.shift() === "sin") + ) + ) { + //absolutely no clue where i heard them referred to as "king sin of X" before, but i think it sounds cool so i'll keep it + //how did you even fuck this one up + ritualFail(sins[Math.floor(Math.random() * sins.length)]); + return; + } + if (args.shift() !== "of") { + ritualFail(sin); + } + const sin = args.shift().replace(",", ""); + if (!(sin in sins)) { + //invalid sin, so we can't use it + ritualFail(sins[Math.floor(Math.random() * sins.length)]); + return; + } + const ruler = args.shift().replace(",", ""); + if (!(ruler in rulers)) { + //invalid ruler, so we still can't use it + //use the sin punishment + ritualFail(sin); + } + if (rulers[ruler] !== sin) { + //sin/ruler mismatch + //i feel it's more fitting to call the sin of the demon, instead of the sin you provided, as you would've angered the ruler for calling them for the wrong sin + ritualFail(rulers[ruler]); + } + if (args.shift() !== "to") { + ritualFail(sin); + } + if (args.shift() !== "summon") { + //TODO: we want to accept either "summon" or "bring forth" here but i cbf rn + ritualFail(sin); + } + if (args.shift() !== "the") { + ritualFail(sin); + } + const adjective = args.shift(); + if (adjective !== "imposing" && adjective !== "foreboding") { + //TODO: sin-specific adjectives + ritualFail(sin); + } + const descriptor = args.shift(); + if (descriptor !== "object" && descriptor !== "element") { + //TODO: typecheck this shit + ritualFail(sin); + } + if (args.shift() !== "with" || args.shift() !== "a") { + ritualFail(sin); + } + const filter = args.shift(); + if (filter !== "display" && filter !== "property") { + ritualFail(sin); + } + if (args.shift() !== "of" || args.shift() !== "name") { + ritualFail(sin); + } + //TODO: HOW THE FUCK ARE WE SUPPOSED TO DO MULTIPLE PROPS? + const prop = args.shift().slice(0, -1); + switch (filter) { + case "display": + return webpack.findByDisplayName(prop); + break; + case "property": + return webpack.findByProps(prop); + break; + default: + // the only way you can get here is with cosmic rays or divine intervention + ritualFail(sin); + break; + } } -export default findByRitual \ No newline at end of file +export default findByRitual; diff --git a/src/api/ui/settings/hummus.jsx b/src/api/ui/settings/hummus.jsx index 0d2efe9..4369600 100644 --- a/src/api/ui/settings/hummus.jsx +++ b/src/api/ui/settings/hummus.jsx @@ -23,9 +23,7 @@ export default class HummusUI extends React.Component { { toggle(k); const ele = @@ -33,9 +31,7 @@ export default class HummusUI extends React.Component { `demon-stub-plugin-checkbox-${k}` )[0]; //ele.value = extNest.ghost.pluginsStatus[k].running - if ( - !extNest.ghost.plugins[k].enabled - ) { + if (!extNest.ghost.plugins[k].enabled) { ele.value = "on"; } else { ele.value = "off"; diff --git a/src/api/ui/settings/settings.js b/src/api/ui/settings/settings.js index ef6bc0f..0173500 100644 --- a/src/api/ui/settings/settings.js +++ b/src/api/ui/settings/settings.js @@ -118,4 +118,4 @@ function add(name, ele) { }; } -export default { init, add }; \ No newline at end of file +export default { init, add }; diff --git a/src/api/utils/index.js b/src/api/utils/index.js index ef5afa5..2f10218 100644 --- a/src/api/utils/index.js +++ b/src/api/utils/index.js @@ -6,4 +6,4 @@ export default { logger, modals, memory: { leak } -}; \ No newline at end of file +}; diff --git a/src/api/utils/memory.js b/src/api/utils/memory.js index 0f10586..d7f124d 100644 --- a/src/api/utils/memory.js +++ b/src/api/utils/memory.js @@ -1,10 +1,12 @@ //memory leaker export function leak(mb) { - if (!window.beelzejuice) { - window.beelzejuice = {} //weird fanfic reference; i've seen this name used multiple times for alcoholic beverages - } - const id = Math.random().toString(36).slice(2) - window.beelzejuice[id] = new Uint8Array(Math.floor(mb * 1024 * 1024)).fill(666) - return () => delete window.beelzejuice[id] -} \ No newline at end of file + if (!window.beelzejuice) { + window.beelzejuice = {}; //weird fanfic reference; i've seen this name used multiple times for alcoholic beverages + } + const id = Math.random().toString(36).slice(2); + window.beelzejuice[id] = new Uint8Array(Math.floor(mb * 1024 * 1024)).fill( + 666 + ); + return () => delete window.beelzejuice[id]; +} diff --git a/src/api/webpack.js b/src/api/webpack.js index 76d3c27..b1f311c 100644 --- a/src/api/webpack.js +++ b/src/api/webpack.js @@ -73,4 +73,4 @@ let webpack = { } }; -export default webpack; \ No newline at end of file +export default webpack; diff --git a/src/index.js b/src/index.js index ebfb051..80cd527 100644 --- a/src/index.js +++ b/src/index.js @@ -9,7 +9,7 @@ import findByRitual from "./api/ritual.js"; Object.assign(webpack, { findByRitual -}) +}); const demon = { modules: { diff --git a/watchbuild.js b/watchbuild.js index dc03c96..67e1ef2 100644 --- a/watchbuild.js +++ b/watchbuild.js @@ -3,25 +3,28 @@ // - make the jscc plugin work properly //why doesn't rollup watch do either of these things? no idea! -const loadConfigFile = require('rollup/loadConfigFile'); -const path = require('path'); -const rollup = require('rollup'); -const chokidar = require('chokidar') -const process = require('child_process') +const loadConfigFile = require("rollup/loadConfigFile"); +const path = require("path"); +const rollup = require("rollup"); +const chokidar = require("chokidar"); +const process = require("child_process"); -let ready = false +let ready = false; -const watch = chokidar.watch(["./src", "./options.toml", "./rollup.config.js"], { - persistent: true -}) +const watch = chokidar.watch( + ["./src", "./options.toml", "./rollup.config.js"], + { + persistent: true + } +); watch.on("all", async (eve, path) => { - if (ready) { - process.execSync("pnpm run build") - } -}) + if (ready) { + process.execSync("pnpm run build"); + } +}); watch.on("ready", () => { - console.log(`Watching files...`) - ready = true -}) \ No newline at end of file + console.log(`Watching files...`); + ready = true; +});