From b5edbd91c759c91a1354b0e03e29175701a3a590 Mon Sep 17 00:00:00 2001 From: Enraa Date: Sun, 14 Jun 2026 22:10:45 -0700 Subject: [PATCH 01/44] Convert getters/gag functions to use server ID The first of many --- commands/gag.js | 14 ++++---- commands/headpat.js | 2 +- commands/mitten.js | 4 +-- commands/struggle.js | 8 ++--- commands/ungag.js | 18 +++++----- commands/unmitten.js | 2 +- contextcommands/message/Headpat.js | 2 +- contextcommands/user/Headpat.js | 2 +- disabledCommands/inspectold.js | 4 +-- eventfunctions/collar/collar_struggle.js | 6 ++-- eventfunctions/gags/chocolate.js | 8 ++--- eventfunctions/gags/gummy.js | 8 ++--- eventfunctions/gags/jawbreaker.js | 8 ++--- eventfunctions/heavy/capture_sphere.js | 4 +-- eventfunctions/heavy/costumer_mimic.js | 4 +-- eventfunctions/heavy/costumer_mimic_chaos.js | 4 +-- eventfunctions/heavy/costumer_mimic_latex.js | 4 +-- functions/delvefunctions.js | 8 ++--- functions/dollfunctions.js | 2 +- functions/eventhandling.js | 7 ++-- functions/gagfunctions.js | 10 +++--- functions/getters/gag/getGag.js | 14 +++++--- functions/getters/gag/getGagBinder.js | 5 +-- functions/getters/gag/getGagIntensity.js | 5 +-- functions/getters/gag/getGagLast.js | 13 ++++--- functions/getters/gag/getGags.js | 8 +++-- functions/interactivefunctions.js | 8 ++--- functions/messagefunctions.js | 14 ++++---- functions/outfitfunctions.js | 18 +++++----- functions/setters/config/restoreOutfit.js | 3 +- functions/setters/gag/assignGag.js | 23 +++++++------ functions/setters/gag/removeGag.js | 36 ++++++++++---------- functions/textfunctions.js | 10 +++--- functions/timefunctions.js | 16 +++++---- functions/touchfunctions.js | 5 +-- headwear/gagharness.js | 2 +- 36 files changed, 165 insertions(+), 144 deletions(-) diff --git a/commands/gag.js b/commands/gag.js index 90c61fec..98cf7589 100644 --- a/commands/gag.js +++ b/commands/gag.js @@ -74,9 +74,9 @@ module.exports = { let interactionuser = interaction.user; let gagtype = interaction.options.getString("gag") ? interaction.options.getString("gag") : "ball"; let gagintensity = interaction.options.getNumber("intensity") ? interaction.options.getNumber("intensity") : 5; - let currentgag = getGag(gaggeduser.id, gagtype); + let currentgag = getGag(interaction.guildId, gaggeduser.id, gagtype); let gagname = process.gagtypes[gagtype]?.choicename; - let oldgagname = process.gagtypes[getGagLast(gaggeduser.id)]?.choicename; + let oldgagname = process.gagtypes[getGagLast(interaction.guildId, gaggeduser.id)]?.choicename; let intensitytext = "loosely"; if (intensitytext == "loosely") { if (gagintensity > 2) { @@ -137,7 +137,7 @@ module.exports = { if (interactionuser == gaggeduser) { // gagging self data.self = true; - if (getGag(interactionuser.id)) { + if (getGag(interaction.guildId, interactionuser.id)) { // has a gag already data.gag = true; interaction.reply(getText(data)); @@ -149,7 +149,7 @@ module.exports = { } else { // gagging another data.other = true; - if (getGag(gaggeduser.id)) { + if (getGag(interaction.guildId, gaggeduser.id)) { // has a gag already data.gag = true; interaction.reply(getText(data)); @@ -165,7 +165,7 @@ module.exports = { data.mitten = true; if (interactionuser.id != gaggeduser.id) { data.other = true; // yes, this is backwards, sorry. - if (getGag(gaggeduser.id)) { + if (getGag(interaction.guildId, gaggeduser.id)) { data.gag = true; interaction.reply(getText(data)); } else { @@ -183,7 +183,7 @@ module.exports = { if (interactionuser.id == gaggeduser.id) { // Gagging ourself data.self = true; - if (getGag(gaggeduser.id)) { + if (getGag(interaction.guildId, gaggeduser.id)) { // We are already gagged! data.gag = true; if (currentgag) { @@ -244,7 +244,7 @@ module.exports = { } else { // Gagging others data.other = true; - if (getGag(gaggeduser.id)) { + if (getGag(interaction.guildId, gaggeduser.id)) { // They are already gagged, so we want to change gags // Note, we should check if we're allowed in this case, since it may interfere. data.gag = true; diff --git a/commands/headpat.js b/commands/headpat.js index 8616a13f..91706eee 100644 --- a/commands/headpat.js +++ b/commands/headpat.js @@ -38,7 +38,7 @@ module.exports = { await handleTouchEvent(interaction.user, targetuser, "headpat").then( async (success) => { await interaction.followUp({ content: `Headpatting ${targetuser}`, flags: MessageFlags.Ephemeral }) - let headpatattempt = rollPatChance(interaction.user.id, targetuser.id) + let headpatattempt = rollPatChance(interaction.user.id, targetuser.id, interaction.guildId) data.headpat = true; if (interaction.user.id == targetuser.id) { diff --git a/commands/mitten.js b/commands/mitten.js index 9dfce3dc..82d30695 100644 --- a/commands/mitten.js +++ b/commands/mitten.js @@ -115,7 +115,7 @@ module.exports = { data.nomitten = true; if (interaction.user.id == targetuser.id) { data.self = true; - if (getGag(interaction.user.id)) { + if (getGag(interaction.guildId, interaction.user.id)) { // Wearing a gag already. data.gag = true; interaction.reply(getText(data)); @@ -133,7 +133,7 @@ module.exports = { await handleMajorRestraint(interaction.user, targetuser, "mitten", chosenmittens).then(async () => { await handleExtremeRestraint(interaction.user, targetuser, "mitten", chosenmittens).then( async (success) => { - if (getGag(targetuser.id)) { + if (getGag(interaction.guildId, targetuser.id)) { data.gag = true; } else { diff --git a/commands/struggle.js b/commands/struggle.js index d382714c..d1b9af9b 100644 --- a/commands/struggle.js +++ b/commands/struggle.js @@ -27,7 +27,7 @@ module.exports = { const focusedValue = interaction.options.getFocused(); try { let heavybondage = getHeavy(interaction.user.id); - let gagbondage = getGagLast(interaction.user.id); + let gagbondage = getGagLast(interaction.guildId, interaction.user.id); let mittenbondage = getMitten(interaction.user.id); let chastitybondage = getChastity(interaction.user.id); let chastitybrabondage = getChastityBra(interaction.user.id) @@ -40,7 +40,7 @@ module.exports = { outopts.push({ name: `Heavy Bondage: ${getHeavy(interaction.user.id).displayname}`, value: "heavy" }); } if (gagbondage) { - outopts.push({ name: `Gag: ${convertGagText(getGagLast(interaction.user.id))}`, value: "gag" }); + outopts.push({ name: `Gag: ${convertGagText(getGagLast(interaction.guildId, interaction.user.id))}`, value: "gag" }); } if (mittenbondage) { outopts.push({ name: `Mittens${mittenbondage.mittenname ? `: ${getMittenName(interaction.user.id)}` : ""}`, value: "mitten" }); @@ -79,7 +79,7 @@ module.exports = { return; } let heavybondage = getHeavy(interaction.user.id)?.displayname; - let gagbondage = getGagLast(interaction.user.id); + let gagbondage = getGagLast(interaction.guildId, interaction.user.id); let mittenbondage = getMitten(interaction.user.id); let chastitybondage = getChastity(interaction.user.id); let chastitybrabondage = getChastityBra(interaction.user.id) @@ -94,7 +94,7 @@ module.exports = { interactionuser: interaction.user, targetuser: interaction.user, // Doesn't really matter but we're adding to avoid a crash c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type - c2: convertGagText(getGagLast(interaction.user.id)), + c2: convertGagText(interaction.guildId, getGagLast(interaction.guildId, interaction.user.id)), c3: getMittenName(interaction.user.id) ?? "mittens", c4: getChastityName(interaction.user.id) ?? "chastity belt", c5: getCollarName(interaction.user.id) ?? "collar", diff --git a/commands/ungag.js b/commands/ungag.js index a4b2548a..3afb70dc 100644 --- a/commands/ungag.js +++ b/commands/ungag.js @@ -21,7 +21,7 @@ module.exports = { try { const focusedValue = interaction.options.getFocused(); let chosenuserid = interaction.options.get("user")?.value ?? interaction.user.id; // Note we can only retrieve the user ID here! - let worngags = getGags(chosenuserid).map((g) => { + let worngags = getGags(interaction.guildId, chosenuserid).map((g) => { if (process.autocompletes.gag.find((t) => t.value == g.gagtype)) { return { name: process.autocompletes.gag.find((t) => t.value == g.gagtype).name, value: g.gagtype }; } @@ -56,8 +56,8 @@ module.exports = { try { let gaggeduser = interaction.options.getUser("user") ? interaction.options.getUser("user") : interaction.user; let gagtoremove = interaction.options.getString("gag"); - if (getGags(gaggeduser.id).length == 1) { - gagtoremove = getGags(gaggeduser.id)[0].gagtype; + if (getGags(interaction.guildId, gaggeduser.id).length == 1) { + gagtoremove = getGags(interaction.guildId, gaggeduser.id)[0].gagtype; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT if (!getConsent(interaction.user.id)?.mainconsent) { @@ -81,7 +81,7 @@ module.exports = { if (gaggeduser == interaction.user) { // Trying to ungag ourselves. data.self = true; - if (getGag(gaggeduser.id)) { + if (getGag(interaction.guildId, gaggeduser.id)) { // We are wearing a gag data.gag = true; interaction.reply(getText(data)); @@ -93,7 +93,7 @@ module.exports = { } else { // We are trying to ungag someone else data.other = true; - if (getGag(gaggeduser.id)) { + if (getGag(interaction.guildId, gaggeduser.id)) { // They are wearing a gag data.gag = true; interaction.reply(getText(data)); @@ -112,7 +112,7 @@ module.exports = { if (gaggeduser == interaction.user) { // Trying to ungag ourselves. data.self = true; - if (getGag(gaggeduser.id)) { + if (getGag(interaction.guildId, gaggeduser.id)) { // We are wearing a gag data.gag = true; interaction.reply(getText(data)); @@ -124,7 +124,7 @@ module.exports = { } else { // We are trying to ungag someone else data.other = true; - if (getGag(gaggeduser.id)) { + if (getGag(interaction.guildId, gaggeduser.id)) { // They are wearing a gag data.gag = true; interaction.reply(getText(data)); @@ -140,7 +140,7 @@ module.exports = { if (gaggeduser == interaction.user) { // Trying to ungag ourselves. data.self = true; - if (getGag(gaggeduser.id)) { + if (getGag(interaction.guildId, gaggeduser.id)) { // We are wearing a gag data.gag = true; // Now check if we have any gags that are locked on! @@ -171,7 +171,7 @@ module.exports = { } else { // We are trying to ungag someone else data.other = true; - if (getGag(gaggeduser.id)) { + if (getGag(interaction.guildId, gaggeduser.id)) { // They are wearing a gag data.gag = true; // Now check if we have any gags that are locked on! diff --git a/commands/unmitten.js b/commands/unmitten.js index 2ffcfc9a..e4fc6967 100644 --- a/commands/unmitten.js +++ b/commands/unmitten.js @@ -45,7 +45,7 @@ module.exports = { data.noheavy = true; if (mitteneduser != interaction.user) { data.other = true; - if (getGag(mitteneduser.id)) { + if (getGag(interaction.guildId, mitteneduser.id)) { data.gag = true; // Now lets make sure the wearer wants that. if (checkBondageRemoval(interaction.user.id, mitteneduser.id, "mitten") == true) { diff --git a/contextcommands/message/Headpat.js b/contextcommands/message/Headpat.js index 074f28be..4cdc3f3a 100644 --- a/contextcommands/message/Headpat.js +++ b/contextcommands/message/Headpat.js @@ -103,7 +103,7 @@ module.exports = { await handleTouchEvent(interaction.user, targetuser, "headpat").then( async (success) => { await interaction.followUp({ content: `Headpatting ${targetuser}`, flags: MessageFlags.Ephemeral }) - let headpatattempt = rollPatChance(interaction.user.id, targetuser.id) + let headpatattempt = rollPatChance(interaction.user.id, targetuser.id, interaction.guildId) data.headpat = true; if (interaction.user.id == targetuser.id) { diff --git a/contextcommands/user/Headpat.js b/contextcommands/user/Headpat.js index 693174cd..6708611e 100644 --- a/contextcommands/user/Headpat.js +++ b/contextcommands/user/Headpat.js @@ -37,7 +37,7 @@ module.exports = { await handleTouchEvent(interaction.user, targetuser, "headpat").then( async (success) => { await interaction.followUp({ content: `Headpatting ${targetuser}`, flags: MessageFlags.Ephemeral }) - let headpatattempt = rollPatChance(interaction.user.id, targetuser.id) + let headpatattempt = rollPatChance(interaction.user.id, targetuser.id, interaction.guildId) data.headpat = true; if (interaction.user.id == targetuser.id) { diff --git a/disabledCommands/inspectold.js b/disabledCommands/inspectold.js index 64fe3528..e918a90e 100644 --- a/disabledCommands/inspectold.js +++ b/disabledCommands/inspectold.js @@ -23,9 +23,9 @@ module.exports = { } // Gag status // You can easily feel if you're gagged, so no restrictions here - if (getGag(inspectuser.id)) { + if (getGag(interaction.guildId, inspectuser.id)) { let inspecttext = `${process.emojis.gag} Gag: **`; - getGags(inspectuser.id).forEach((g) => { + getGags(interaction.guildId, inspectuser.id).forEach((g) => { inspecttext = `${inspecttext}${convertGagText(g.gagtype)} (${g.intensity}), `; }); inspecttext = `${inspecttext.slice(0, -2)}**`; diff --git a/eventfunctions/collar/collar_struggle.js b/eventfunctions/collar/collar_struggle.js index e9de0897..de0f2ef9 100644 --- a/eventfunctions/collar/collar_struggle.js +++ b/eventfunctions/collar/collar_struggle.js @@ -16,14 +16,14 @@ const { messageSendChannel } = require("../../functions/messagefunctions"); const { setUserVar } = require("../../functions/setters/config/setUserVar"); const { getText } = require("../../functions/textfunctions"); -exports.tick = async (userID, data) => { +exports.tick = async (serverID, userID, data) => { try { // Cancel until the user has said AT LEAST three things or has waited long enough. if (getUserVar(userID, "struggleCollarMsgs") < 5) { return } if (getUserVar(userID, "struggleCollarDelay") >= Date.now()) { return } let heavybondage = getHeavy(userID)?.displayname; - let gagbondage = getGagLast(userID); + let gagbondage = getGagLast(serverID, userID); let mittenbondage = getMitten(userID); let chastitybondage = getChastity(userID); let chastitybrabondage = getChastityBra(userID) @@ -48,7 +48,7 @@ exports.tick = async (userID, data) => { interactionuser: { id: userID }, targetuser: { id: userID }, // Doesn't really matter but we're adding to avoid a crash c1: getHeavy(userID)?.displayname, // heavy bondage type - c2: convertGagText(getGagLast(userID)), + c2: convertGagText(getGagLast(interaction.guildId, userID)), c3: getMittenName(userID) ?? "mittens", c4: getChastityName(userID) ?? "chastity belt", c5: getCollarName(userID) ?? "collar", diff --git a/eventfunctions/gags/chocolate.js b/eventfunctions/gags/chocolate.js index b4fd78dc..e3f1be37 100644 --- a/eventfunctions/gags/chocolate.js +++ b/eventfunctions/gags/chocolate.js @@ -8,18 +8,18 @@ const { removeGag } = require("../../functions/setters/gag/removeGag"); const DISSOLVE_RATE_MS = 60000; -async function tick(userID, data) { +async function tick(serverID, userID, data) { // Init Countdown Variable on First Run if not already present if (getUserVar(userID, "confectionaryDissolveTimer") == undefined) { setUserVar(userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) } // Decrement Intensity every timer interval - if (getUserVar(userID, "confectionaryDissolveTimer") < Date.now() && getGag(userID, "chocolate") && process.recentmessages[userID]) { - if(getGag(userID, "chocolate").intensity > 1){ + if (getUserVar(userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "chocolate") && process.recentmessages[userID]) { + if(getGag(serverID, userID, "chocolate").intensity > 1){ setUserVar(userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) // Get Intensity and push decremented version - let oldIntensity = getGag(userID, "chocolate").intensity + let oldIntensity = getGag(serverID, userID, "chocolate").intensity assignGag(userID, "chocolate", oldIntensity - 1) messageSendChannel(`<@${userID}>'s licking has shrunk ${getPronouns(userID, "possessiveDeterminer")} Chocolate Gag a little bit!`, process.recentmessages[userID]) } diff --git a/eventfunctions/gags/gummy.js b/eventfunctions/gags/gummy.js index 2d9fd32e..ccaf1d0a 100644 --- a/eventfunctions/gags/gummy.js +++ b/eventfunctions/gags/gummy.js @@ -8,18 +8,18 @@ const { removeGag } = require("../../functions/setters/gag/removeGag"); const DISSOLVE_RATE_MS = 300000; -async function tick(userID, data) { +async function tick(serverID, userID, data) { // Init Countdown Variable on First Run if not already present if (getUserVar(userID, "confectionaryDissolveTimer") == undefined) { setUserVar(userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) } // Decrement Intensity every timer interval - if (getUserVar(userID, "confectionaryDissolveTimer") < Date.now() && getGag(userID, "gummy") && process.recentmessages[userID]) { - if(getGag(userID, "gummy").intensity > 1){ + if (getUserVar(userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "gummy") && process.recentmessages[userID]) { + if(getGag(serverID, userID, "gummy").intensity > 1){ setUserVar(userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) // Get Intensity and push decremented version - let oldIntensity = getGag(userID, "gummy").intensity + let oldIntensity = getGag(serverID, userID, "gummy").intensity assignGag(userID, "gummy", oldIntensity - 1) messageSendChannel(`<@${userID}>'s licking has shrunk ${getPronouns(userID, "possessiveDeterminer")} Gummy Gag a little bit!`, process.recentmessages[userID]) } diff --git a/eventfunctions/gags/jawbreaker.js b/eventfunctions/gags/jawbreaker.js index a794cb65..c2e6d239 100644 --- a/eventfunctions/gags/jawbreaker.js +++ b/eventfunctions/gags/jawbreaker.js @@ -8,18 +8,18 @@ const { removeGag } = require("../../functions/setters/gag/removeGag"); const DISSOLVE_RATE_MS = 1200000; -async function tick(userID, data) { +async function tick(serverID, userID, data) { // Init Countdown Variable on First Run if not already present if (getUserVar(userID, "confectionaryDissolveTimer") == undefined) { setUserVar(userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) } // Decrement Intensity every timer interval - if (getUserVar(userID, "confectionaryDissolveTimer") < Date.now() && getGag(userID, "jawbreaker") && process.recentmessages[userID]) { - if(getGag(userID, "jawbreaker").intensity > 1){ + if (getUserVar(userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "jawbreaker") && process.recentmessages[userID]) { + if(getGag(serverID, userID, "jawbreaker").intensity > 1){ setUserVar(userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) // Get Intensity and push decremented version - let oldIntensity = getGag(userID, "jawbreaker").intensity + let oldIntensity = getGag(serverID, userID, "jawbreaker").intensity assignGag(userID, "jawbreaker", oldIntensity - 1) messageSendChannel(`<@${userID}>'s licking has shrunk ${getPronouns(userID, "possessiveDeterminer")} Jawbreaker Gag a little bit!`, process.recentmessages[userID]) } diff --git a/eventfunctions/heavy/capture_sphere.js b/eventfunctions/heavy/capture_sphere.js index 15f80830..b79929b3 100644 --- a/eventfunctions/heavy/capture_sphere.js +++ b/eventfunctions/heavy/capture_sphere.js @@ -22,7 +22,7 @@ const { getText } = require("../../functions/textfunctions") // Inputs a capture strength and params, outputs an array of 3 values depending on catch. // This heavy is all calculated in one go at the beginning of the function // Implements catch formula described here: https://bulbapedia.bulbagarden.net/wiki/Catch_rate#Capture_method_(Generation_V) -function calculatecapture(userid, ballbonusnum = 1.0) { +function calculatecapture(serverID, userid, ballbonusnum = 1.0) { // The user's "health" will be based off of 50 arousal. let maxhealth = 50 let currhealth = Math.max(50 - getArousal(userid), 0.5) // Always clamp to 0.5 hp left - false swipe range if you will. @@ -41,7 +41,7 @@ function calculatecapture(userid, ballbonusnum = 1.0) { if (getMitten(userid) || !getHeadwearRestrictions(userid).canInspect || getCorset(userid)) { statusbonus = 2.5; } - else if (getGag(userid) || getChastity(userid) || getChastityBra(userid) || getCollar(userid)) { + else if (getGag(serverID, userid) || getChastity(userid) || getChastityBra(userid) || getCollar(userid)) { statusbonus = 1.5; } console.log(`Status Multiplier: ${statusbonus}`) diff --git a/eventfunctions/heavy/costumer_mimic.js b/eventfunctions/heavy/costumer_mimic.js index 68b5c0b8..799694ec 100644 --- a/eventfunctions/heavy/costumer_mimic.js +++ b/eventfunctions/heavy/costumer_mimic.js @@ -376,7 +376,7 @@ function shuffleWearables(inputArray) { // Then it will slowly apply a random outfit and set of restraints! // Then it will spit them out and apply a new heavy item at the end! -let tick = async (userID, datain) => { +let tick = async (serverID, userID, datain) => { if (process.userevents == undefined) { process.userevents = {} } if (process.userevents[userID] == undefined) { process.userevents[userID] = {} } if (process.userevents[userID].costumermimic == undefined) { process.userevents[userID].costumermimic = { stage: 0 } } @@ -547,7 +547,7 @@ let tick = async (userID, datain) => { break; case "gag": - if (!getGag(userID) || (getGag(userID) && (getGag(userID).getGagName != nextitem.itemtowear))) { + if (!getGag(serverID, userID) || (getGag(serverID, userID) && (getGag(serverID, userID).getGagName != nextitem.itemtowear))) { data.gag = true; data.textdata.c1 = convertGagText(nextitem.itemtowear), // gag name // Apply the gag diff --git a/eventfunctions/heavy/costumer_mimic_chaos.js b/eventfunctions/heavy/costumer_mimic_chaos.js index ee69169f..fdca64b9 100644 --- a/eventfunctions/heavy/costumer_mimic_chaos.js +++ b/eventfunctions/heavy/costumer_mimic_chaos.js @@ -50,7 +50,7 @@ function shuffleWearables(inputArray) { // Then it will slowly apply a random outfit and set of restraints! // Then it will spit them out and apply a new heavy item at the end! -let tick = async (userID, datain) => { +let tick = async (serverID, userID, datain) => { if (process.userevents == undefined) { process.userevents = {} } if (process.userevents[userID] == undefined) { process.userevents[userID] = {} } if (process.userevents[userID].costumermimic == undefined) { process.userevents[userID].costumermimic = { stage: 0 } } @@ -436,7 +436,7 @@ let tick = async (userID, datain) => { break; case "gag": - if (!getGag(userID) || (getGag(userID) && (getGag(userID).getGagName != nextitem.itemtowear))) { + if (!getGag(serverID, userID) || (getGag(serverID, userID) && (getGag(userID).getGagName != nextitem.itemtowear))) { data.gag = true; data.textdata.c1 = convertGagText(nextitem.itemtowear), // gag name // Apply the gag diff --git a/eventfunctions/heavy/costumer_mimic_latex.js b/eventfunctions/heavy/costumer_mimic_latex.js index 9bfcc255..67f853f1 100644 --- a/eventfunctions/heavy/costumer_mimic_latex.js +++ b/eventfunctions/heavy/costumer_mimic_latex.js @@ -126,7 +126,7 @@ function shuffleWearables(inputArray) { // Then it will slowly apply a random outfit and set of restraints! // Then it will spit them out and apply a new heavy item at the end! -let tick = async (userID, datain) => { +let tick = async (serverID, userID, datain) => { if (process.userevents == undefined) { process.userevents = {} } if (process.userevents[userID] == undefined) { process.userevents[userID] = {} } if (process.userevents[userID].costumermimic == undefined) { process.userevents[userID].costumermimic = { stage: 0 } } @@ -290,7 +290,7 @@ let tick = async (userID, datain) => { break; case "gag": - if (!getGag(userID) || (getGag(userID) && (getGag(userID).getGagName != nextitem.itemtowear))) { + if (!getGag(serverID, userID) || (getGag(serverID, userID) && (getGag(serverID, userID).getGagName != nextitem.itemtowear))) { data.gag = true; data.textdata.c1 = convertGagText(nextitem.itemtowear), // gag name // Apply the gag diff --git a/functions/delvefunctions.js b/functions/delvefunctions.js index 4f455a0b..ef5ba1f9 100644 --- a/functions/delvefunctions.js +++ b/functions/delvefunctions.js @@ -229,17 +229,17 @@ const delveroomchoices = { longoutcome_failure: "Despite a 100% success rate, you somehow failed. (This is a bug, please report!)", statweight: {}, statspecial: (userID, delvedata, resolve) => { return delvedata.stats }, - successfunction: (userID, delvedata, resolve) => { + successfunction: (serverID, userID, delvedata, resolve) => { let extratextt = "You take 3 damage!" // Decide on a restraint to equip on the player let eligiblerestraints = []; - if (!getGag(userID, "ball")) { + if (!getGag(serverID, userID, "ball")) { eligiblerestraints.push("ball") } - if (!getGag(userID, "stuff")) { + if (!getGag(serverID, userID, "stuff")) { eligiblerestraints.push("stuff") } - if (!getGag(userID, "tape")) { + if (!getGag(serverID, userID, "tape")) { eligiblerestraints.push("tape") } if (!getChastity(userID) && !getUserTags(userID).includes("chastity")) { diff --git a/functions/dollfunctions.js b/functions/dollfunctions.js index 7ebf5af5..0b5442fd 100644 --- a/functions/dollfunctions.js +++ b/functions/dollfunctions.js @@ -261,7 +261,7 @@ async function textGarbleDOLL(msg, modifiedmessage, outtextin) { let dollPunishThresh = getOption(msg.author.id, "dollpunishthresh"); let dollmaker = getHeadwear(msg.member.id).find((headwear) => headwear === "dollmaker_visor"); // This creates a circular, so, access the variable directly. Oh well. - let eldritchcorrupted = (process.gags && process.gags[msg.member.id] && process.gags[msg.member.id].find((g) => g.gagtype === "eldritch")) + let eldritchcorrupted = getGags(msg.guild.id, msg.member.id).find((gag) => gag === "eldritch"); let dollProtocolViolations = 0; let dollProtocolVioType = undefined; if (dollified) { diff --git a/functions/eventhandling.js b/functions/eventhandling.js index d6ea5a3f..d1245a83 100644 --- a/functions/eventhandling.js +++ b/functions/eventhandling.js @@ -12,10 +12,11 @@ const { getCollar } = require("./getters/collar/getCollar"); * * - (string) type - The specific eventID being emitted * - (user id) userid - The user causing this event + * - (server id) server - The server this event is occurring in * - (object any) data - Additional details, sufficient to reconstruct the event * - (integer) delay? - Delay, if any to run this event. *********/ -async function emitEvent(type, userid, data, delay = 0) { +async function emitEvent(type, userid, serverid, data, delay = 0) { // All of this because I had the lack of foresight to see that events would eventually evolve and need a better approach. // Note, this access process vars directly due to potential circular dependencies. In the future, these should be resolved. // Notable circulars include the messaging system which lives heavily in gagfunctions.js. @@ -24,8 +25,8 @@ async function emitEvent(type, userid, data, delay = 0) { if (delay) { await new Promise(res => setTimeout(res, delay)) } // Gags - if (process.gags && process.gags[userid]) { - process.gags[userid].forEach((g) => { + if (process.gags && process.gags[serverid] && process.gags[serverid][userid]) { + process.gags[serverid][userid].forEach((g) => { if (process.eventfunctions && process.eventfunctions.gags && process.eventfunctions.gags[g.gagtype] && process.eventfunctions.gags[g.gagtype][type]) { process.eventfunctions.gags[g.gagtype][type](userid, data); } diff --git a/functions/gagfunctions.js b/functions/gagfunctions.js index 2da93b14..bb3fec5b 100644 --- a/functions/gagfunctions.js +++ b/functions/gagfunctions.js @@ -242,7 +242,7 @@ const modifymessage = async (msg, threadId, messageonly) => { if (appendcollar.msgTreeMods) { msgTreeMods = appendcollar.msgTreeMods } // Iterate through any speech events in process.msgfunctions - emitEvent("msgfunction", msg.author.id, { msg: msg, msgcontent: msg.content, outtext: outtext }) + emitEvent("msgfunction", msg.author.id, msg.guildId, { msg: msg, msgcontent: msg.content, outtext: outtext }) // If we only wanted to edit the message, just return it at this point and do NOT proceed. if (messageonly) { @@ -336,9 +336,9 @@ async function textGarbleGag(msg, msgTree, msgTreeMods) { if (process.gags == undefined) { process.gags = {}; } - if (process.gags[msg.author.id] && process.gags[msg.author.id].length > 0) { + if (process.gags[msg.guildId] && process.gags[msg.guildId][msg.author.id] && process.gags[msg.guildId][msg.author.id].length > 0) { // Go over each gag and if there's a gag file loaded for it, run the messagebegin, garbletext and messageend functions if they exist. - process.gags[msg.author.id].forEach((gag) => { + process.gags[msg.guildId][msg.author.id].forEach((gag) => { if (process.gagtypes && process.gagtypes[gag.gagtype]) { if (process.gagtypes[gag.gagtype].messagebegin) { let out = process.gagtypes[gag.gagtype].messagebegin(msg, msgTree, msgTreeMods, gag.intensity ?? 5); @@ -368,10 +368,10 @@ async function processPregarbleGags(msg, msgTree, msgTreeMods) { if (process.gags == undefined) { process.gags = {}; } - if (process.gags[msg.author.id] && process.gags[msg.author.id].length > 0) { + if (process.gags[msg.guildId] && process.gags[msg.guildId][msg.author.id] && process.gags[msg.guildId][msg.author.id].length > 0) { let origcontent = msg.content; // Go over each gag and if there's a gag file loaded for it, run the messagebegin, garbletext and messageend functions if they exist. - process.gags[msg.author.id].forEach(async (gag) => { + process.gags[msg.guildId][msg.author.id].forEach(async (gag) => { if (process.gagtypes && process.gagtypes[gag.gagtype]) { if (process.gagtypes[gag.gagtype].pregarble) { await msgTree.callFunc(process.gagtypes[gag.gagtype].pregarble,true,"rawText",[gag.intensity ?? 5, msg]) // Run garble on all IC segments. diff --git a/functions/getters/gag/getGag.js b/functions/getters/gag/getGag.js index c8ed85ca..63fa43b9 100644 --- a/functions/getters/gag/getGag.js +++ b/functions/getters/gag/getGag.js @@ -1,6 +1,7 @@ /********** * Gets the first worn gag for the user ID, or the specific gag by type if specified * + * - (server ID) serverID - The server this is on * - (user ID) userID - The user ID to retrieve a gag for * - (string) gagbyname? - The string ID of the gag to get. If undefined, returns first gag * --- @@ -9,19 +10,22 @@ * - intensity: How tight the gag is (1-10) * - origbinder: Who put the gag on the user **********/ -function getGag(userID, gagbyname) { +function getGag(serverID, userID, gagbyname) { if (process.gags == undefined) { process.gags = {}; } - if (process.gags[userID] == undefined) { + if (process.gags[serverID] == undefined) { + process.gags[serverID] = {}; + } + if (process.gags[serverID][userID] == undefined) { return undefined; } if (gagbyname) { - let foundgag = process.gags[userID].find((s) => s.gagtype == gagbyname); + let foundgag = process.gags[serverID][userID].find((s) => s.gagtype == gagbyname); return foundgag; } - else if (process.gags[userID].length > 0) { - return process.gags[userID][0].gagtype; + else if (process.gags[serverID][userID].length > 0) { + return process.gags[serverID][userID][0].gagtype; } return undefined; } diff --git a/functions/getters/gag/getGagBinder.js b/functions/getters/gag/getGagBinder.js index 751d8057..2b112081 100644 --- a/functions/getters/gag/getGagBinder.js +++ b/functions/getters/gag/getGagBinder.js @@ -3,13 +3,14 @@ const { getGag } = require("./getGag"); /***** * Gets the original binder for a gag by ID * + * - (server ID) serverID - The server this is running on * - (user ID) userID - The user ID to retrieve a gag for * - (string) item - The string ID of the gag to get. * --- * ##### Returns the user ID who put the gag on them *****/ -function getGagBinder(userID, item) { - return getGag(userID, item)?.origbinder; +function getGagBinder(serverID, userID, item) { + return getGag(serverID, userID, item)?.origbinder; } exports.getGagBinder = getGagBinder; \ No newline at end of file diff --git a/functions/getters/gag/getGagIntensity.js b/functions/getters/gag/getGagIntensity.js index cedf66db..a21dcdf1 100644 --- a/functions/getters/gag/getGagIntensity.js +++ b/functions/getters/gag/getGagIntensity.js @@ -3,12 +3,13 @@ const { getGag } = require("./getGag"); /******** * Gets the intensity of the first worn gag. This function isn't used at all and should be removed. * + * - (server ID) serverID - The server this is running on * - (user ID) userID - The user ID to retrieve the first gag for * --- * ##### Returns the intensity of the first gag ********/ -function getGagIntensity(userID) { - return getGag(userID)?.intensity; +function getGagIntensity(serverID, userID) { + return getGag(serverID, userID)?.intensity; } exports.getGagIntensity = getGagIntensity; \ No newline at end of file diff --git a/functions/getters/gag/getGagLast.js b/functions/getters/gag/getGagLast.js index 4f032cc7..81810648 100644 --- a/functions/getters/gag/getGagLast.js +++ b/functions/getters/gag/getGagLast.js @@ -1,6 +1,7 @@ /******** * Gets the last worn (top most) gag for a user. * + * - (server ID) serverID - The server this is on * - (user ID) userID - The user ID to retrieve a gag for * --- * ##### Returns the top most gag object for the user. All gags have: @@ -8,16 +9,18 @@ * - intensity: How tight the gag is (1-10) * - origbinder: Who put the gag on the user ********/ -function getGagLast(userID) { +function getGagLast(serverID, userID) { if (process.gags == undefined) { process.gags = {}; } - if (process.gags[userID] == undefined) { + if (process.gags[serverID] == undefined) { + process.gags[serverID] = {}; + } + if (process.gags[serverID][userID] == undefined) { return undefined; } - - if (process.gags[userID].length > 0) { - return process.gags[userID][process.gags[userID].length - 1].gagtype; + if (process.gags[serverID][userID].length > 0) { + return process.gags[serverID][userID][process.gags[serverID][userID].length - 1].gagtype; } else { return undefined; } diff --git a/functions/getters/gag/getGags.js b/functions/getters/gag/getGags.js index 05ee367c..738a9870 100644 --- a/functions/getters/gag/getGags.js +++ b/functions/getters/gag/getGags.js @@ -1,15 +1,19 @@ /******* * Get all of the gags worn by the user ID * + * - (server ID) serverID - The server this is on * - (user id) userID - The person wearing the gags * --- * ##### Returns an array of gag objects *******/ -function getGags(userID) { +function getGags(serverID, userID) { if (process.gags == undefined) { process.gags = {}; } - return process.gags[userID] ?? []; + if (process.gags[serverID] == undefined) { + process.gags[serverID] = {}; + } + return process.gags[serverID][userID] ?? []; }; exports.getGags = getGags; \ No newline at end of file diff --git a/functions/interactivefunctions.js b/functions/interactivefunctions.js index 3099b795..0fb76000 100644 --- a/functions/interactivefunctions.js +++ b/functions/interactivefunctions.js @@ -586,7 +586,7 @@ const assignMemeImages = () => { // Returns a blocking function which can be awaited // Will immediately resolve if the user allows everyone to remove bondage // else, will prompt them. Will resolve false if rejected. -function checkBondageRemoval(userID, targetID, type, item) { +function checkBondageRemoval(serverID, userID, targetID, type, item) { let useroption = getOption(targetID, "removebondage"); // Return true immediately if it's accepted without question @@ -612,7 +612,7 @@ function checkBondageRemoval(userID, targetID, type, item) { restraintobject = getHeavyBinder(targetID, type); } if (type == "gag") { - restraintobject = getGagBinder(targetID, item); + restraintobject = getGagBinder(serverID, targetID, item); } if (type == "mitten") { restraintobject = getMittenBinder(targetID); @@ -1273,7 +1273,7 @@ async function generateExtraConfig(interaction, userid, itemname, force) { } else { // Gags - getGags(userid).forEach(async (g) => { + getGags(interaction.guildId, userid).forEach(async (g) => { if ((g.gagtype == itemname) && process.eventfunctions.gags && process.eventfunctions.gags[g.gagtype] && process.eventfunctions.gags[g.gagtype].extraconfig) { interactionoutput.push(await process.eventfunctions.gags[g.gagtype].extraconfig(interaction, userid, itemname)); } @@ -1333,7 +1333,7 @@ async function generateExtraConfig(interaction, userid, itemname, force) { } else { // Gags - getGags(userid).forEach(async (g) => { + getGags(interaction.guildId, userid).forEach(async (g) => { if ((g.gagtype == itemname) && process.eventfunctions.gags && process.eventfunctions.gags[g.gagtype] && process.eventfunctions.gags[g.gagtype].extraconfig) { interactionoutput.push(await process.eventfunctions.gags[g.gagtype].extraconfig(interaction, userid, itemname)); } diff --git a/functions/messagefunctions.js b/functions/messagefunctions.js index 455458d5..df98f1e3 100644 --- a/functions/messagefunctions.js +++ b/functions/messagefunctions.js @@ -209,12 +209,14 @@ const splitMessage = (text, inputRegex = null) => { function runMessageEvents(data) { // Gags if (process.gags) { - Object.keys(process.gags).forEach((userid) => { - getGags(userid).forEach((g) => { - if (process.msgfunctions.gags && process.msgfunctions.gags[g.gagtype]) { - process.msgfunctions.gags[g.gagtype](userid, data); - } - }); + Object.keys(process.gags).forEach((serverid) => { + Object.keys(process.gags[serverid]).forEach((userid) => { + getGags(serverid, userid).forEach((g) => { + if (process.msgfunctions.gags && process.msgfunctions.gags[g.gagtype]) { + process.msgfunctions.gags[g.gagtype](userid, data); + } + }); + }) }); } // Headwear diff --git a/functions/outfitfunctions.js b/functions/outfitfunctions.js index 73ca1817..e554936e 100644 --- a/functions/outfitfunctions.js +++ b/functions/outfitfunctions.js @@ -49,7 +49,7 @@ const { getClonedChastityKeysOwned } = require("./getters/chastity/getClonedChas const { getClonedChastityBraKeysOwned } = require("./getters/chastity/getClonedChastityBraKeysOwned"); const { getClonedCollarKeysOwned } = require("./getters/collar/getClonedCollarKeysOwned"); -async function generateOutfitModal(userID, menu, page, options) { +async function generateOutfitModal(serverID, userID, menu, page, options) { let pagecomponents = [new TextDisplayBuilder().setContent(`## Outfitter - ${menu.slice(0, 1).toUpperCase()}${menu.slice(1)}`)]; let tabbuttons = [ // Restore @@ -203,10 +203,10 @@ async function generateOutfitModal(userID, menu, page, options) { // Gag section let texts = `### Gags:\n`; - if (!getGag(userID)) { + if (!getGag(serverID, userID)) { texts = `${texts}Not worn`; } else { - texts = `${texts}${getGags(userID) + texts = `${texts}${getGags(serverID, userID) .map((g) => convertGagText(g.gagtype)) .join(", ")}`; } @@ -219,7 +219,7 @@ async function generateOutfitModal(userID, menu, page, options) { .setLabel(options.slice(bitselector, bitselector + 1) == "1" ? `Save` : `Disabled`) .setStyle(options.slice(bitselector, bitselector + 1) == "1" ? ButtonStyle.Success : ButtonStyle.Danger) // Block if element doesn't exist - .setDisabled(!getGag(userID)), + .setDisabled(!getGag(serverID, userID)), ), ); bitselector++; @@ -515,7 +515,7 @@ function outfitEntryModal(interaction, slot) { return modal; } -async function inspectModal(userID, inspectuserIDin, menu, page) { +async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { let inspectuserID = inspectuserIDin ?? userID; let profilelink = (getOption(inspectuserID, "profilelink") && getOption(inspectuserID, "profilelink").length > 0) ? ` • [Profile](${getOption(inspectuserID, "profilelink")})` : `` let kinklistlink = (getOption(inspectuserID, "kinklistlink") && getOption(inspectuserID, "kinklistlink").length > 0) ? ` • [Kink List](${getOption(inspectuserID, "kinklistlink")})` : `` @@ -570,8 +570,8 @@ async function inspectModal(userID, inspectuserIDin, menu, page) { let headwearrestrictions = getHeadwearRestrictions(userID); let wearingtext = `## Worn Restraints:`; // Gags - if (getGag(inspectuserID)) { - wearingtext = `${wearingtext}\n${process.emojis.gag} Gags: **${getGags(inspectuserID).map((g) => { return `${convertGagText(g.gagtype)} (${g.intensity})`}).join(", ")}**` + if (getGag(serverID, inspectuserID)) { + wearingtext = `${wearingtext}\n${process.emojis.gag} Gags: **${getGags(serverID, inspectuserID).map((g) => { return `${convertGagText(g.gagtype)} (${g.intensity})`}).join(", ")}**` } // Headwear if (getHeadwear(inspectuserID).length > 0) { @@ -761,8 +761,8 @@ async function inspectModal(userID, inspectuserIDin, menu, page) { let headwearrestrictions = getHeadwearRestrictions(userID); let wearingtext = `## Regular Worn Restraints:`; // Gags - if (getGag(inspectuserID)) { - wearingtext = `${wearingtext}\n${process.emojis.gag} Gags: **${getGags(inspectuserID).map((g) => { return `${convertGagText(g.gagtype)} (${g.intensity})`}).join(", ")}**` + if (getGag(serverID, inspectuserID)) { + wearingtext = `${wearingtext}\n${process.emojis.gag} Gags: **${getGags(serverID, inspectuserID).map((g) => { return `${convertGagText(g.gagtype)} (${g.intensity})`}).join(", ")}**` } // Headwear if (getHeadwear(inspectuserID).length > 0) { diff --git a/functions/setters/config/restoreOutfit.js b/functions/setters/config/restoreOutfit.js index c0eb715b..68170320 100644 --- a/functions/setters/config/restoreOutfit.js +++ b/functions/setters/config/restoreOutfit.js @@ -17,12 +17,13 @@ const { markForSave } = require("../../other/markForSave"); * Retrieves an outfit and attempts to apply it to the user. * Application will follow the same constraints as applying the bondage pieces from their other standard commands. * + * - (server id) serverID - The server this is running on * - (user id) userID - The user whose outfit to restore * - (object) storedobject - An object of restraint objects to restore to the user * --- * ##### *No return value* *********/ -function restoreOutfit(userID, storedobject) { +function restoreOutfit(serverID, userID, storedobject) { Object.keys(storedobject).forEach((k) => { // I could use a switch statement here but I feel like using if conditionals. if (k == "wearable") { diff --git a/functions/setters/gag/assignGag.js b/functions/setters/gag/assignGag.js index be380777..a292af68 100644 --- a/functions/setters/gag/assignGag.js +++ b/functions/setters/gag/assignGag.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { statsAddCounter } = require("../config/statsAddCounter"); /********** * Adds or modifies a gag on the user. @@ -10,26 +11,26 @@ const { markForSave } = require("../../other/markForSave"); * --- * ##### *No return value* **********/ -function assignGag(userID, gagtype = "ball", intensity = 5, origbinder) { +function assignGag(serverID, userID, gagtype = "ball", intensity = 5, origbinder) { if (process.gags == undefined) { process.gags = {}; } - if (process.gags[userID] == undefined) { - process.gags[userID] = []; + if (process.gags[serverID] == undefined) { + process.gags[serverID] = []; + } + if (process.gags[serverID][userID] == undefined) { + process.gags[serverID][userID] = []; } // Retrieve the index if it is already on the wearer. - let foundgag = process.gags[userID].findIndex((s) => s.gagtype == gagtype); + let foundgag = process.gags[serverID][userID].findIndex((s) => s.gagtype == gagtype); let originalbinder = origbinder; if (foundgag > -1) { - originalbinder = process.gags[userID][foundgag].origbinder; - process.gags[userID].splice(foundgag, 1); + originalbinder = process.gags[serverID][userID][foundgag].origbinder; + process.gags[serverID][userID].splice(foundgag, 1); } - process.gags[userID].push({ gagtype: gagtype, intensity: intensity, origbinder: originalbinder }); - - if (process.userstats == undefined) { process.userstats = {} } - if (process.userstats[userID] == undefined) { process.userstats[userID] = {} } + process.gags[serverID][userID].push({ gagtype: gagtype, intensity: intensity, origbinder: originalbinder }); - process.userstats[userID].worngags = (process.userstats[userID].worngags ?? 0) + 1; + statsAddCounter(userID, "worngags") markForSave("gags"); markForSave("userstats"); diff --git a/functions/setters/gag/removeGag.js b/functions/setters/gag/removeGag.js index db449037..02e8177c 100644 --- a/functions/setters/gag/removeGag.js +++ b/functions/setters/gag/removeGag.js @@ -14,40 +14,40 @@ function deleteGag(userID, specificgag, force = false) { process.gags = {}; } // Remove all gags if none is specified. - if (!specificgag && process.gags[userID]) { + if (!specificgag && process.gags[serverID] && process.gags[serverID][userID]) { let lockedheadgears = []; - if (process.headwear[userID]) { lockedheadgears = Object.keys(process.headwear[userID]) } + if (process.headwear[serverID] && process.headwear[serverID][userID]) { lockedheadgears = Object.keys(process.headwear[userID]) } if ((lockedheadgears.length <= 1) || force) { // They dont have anything locked on their head, business as usual. - process.gags[userID].forEach((g) => { + process.gags[serverID][userID].forEach((g) => { if (process.gagtypes[g.gagtype] && process.gagtypes[g.gagtype].onUnlock) { - process.gagtypes[g.gagtype].onUnlock(userID); + process.gagtypes[g.gagtype].onUnlock(serverID, userID); } }) - delete process.gags[userID]; + delete process.gags[serverID][userID]; } else { - process.gags[userID].forEach((g) => { - if (process.gagtypes[g.gagtype] && process.gagtypes[g.gagtype].onUnlock) { - process.gagtypes[g.gagtype].onUnlock(userID); + process.gags[serverID][userID].forEach((g) => { + if (process.gagtypes[serverID] && process.gagtypes[serverID][g.gagtype] && process.gagtypes[serverID][g.gagtype].onUnlock) { + process.gagtypes[serverID][g.gagtype].onUnlock(userID); } - if (!process.headwear[userID][`gagharness_${g.gagtype}`]) { + if (!process.headwear[serverID][userID][`gagharness_${g.gagtype}`]) { // Splice out any gags that are eligible to be removed. - let loc = process.gags[userID].findIndex((f) => f.gagtype == g.gagtype); - process.gags[userID].splice(loc, 1); + let loc = process.gags[serverID][userID].findIndex((f) => f.gagtype == g.gagtype); + process.gags[serverID][userID].splice(loc, 1); } }) } - } else if (process.gags[userID]) { - let loc = process.gags[userID].findIndex((f) => f.gagtype == specificgag); + } else if (process.gags[serverID] && process.gags[serverID][userID]) { + let loc = process.gags[serverID][userID].findIndex((f) => f.gagtype == specificgag); if (loc > -1) { - if (process.gagtypes[process.gags[userID][loc].gagtype] && process.gagtypes[process.gags[userID][loc].gagtype].onUnlock) { - process.gagtypes[process.gags[userID][loc].gagtype].onUnlock({ userID: userID }); + if (process.gagtypes[process.gags[serverID][userID][loc].gagtype] && process.gagtypes[process.gags[serverID][userID][loc].gagtype].onUnlock) { + process.gagtypes[process.gags[serverID][userID][loc].gagtype].onUnlock({ userID: userID }); } - process.gags[userID].splice(loc, 1); + process.gags[serverID][userID].splice(loc, 1); } - if (process.gags[userID].length == 0) { - delete process.gags[userID]; + if (process.gags[serverID][userID].length == 0) { + delete process.gags[serverID][userID]; } } markForSave("gags"); diff --git a/functions/textfunctions.js b/functions/textfunctions.js index 5cccddb3..33a2225f 100644 --- a/functions/textfunctions.js +++ b/functions/textfunctions.js @@ -1933,20 +1933,20 @@ const texts_struggle = { `USER_TAG twirls USER_THEIR hair absentmindedly. Someone should tie USER_THEM up with more bondage, tehe!~`, { required: (t) => { - return !(process.gags && process.gags[t.interactionuser.id] && Math.random() > 0.75); + return !(process.gags && process.gags[t.serverid][t.interactionuser.id] && Math.random() > 0.75); }, text: `USER_TAG clears USER_THEIR throat and then begins to speak: The FitnessGram Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues. The 20 meter pacer test will begin in 30 seconds. Line up at the start. The running speed starts slowly but gets faster each minute after you hear this signal bodeboop. A single lap should be completed every time you hear this sound. ding Remember to run in a straight line and run as long as possible. The second time you fail to complete a lap before the sound, your test is over. The test will begin on the word start. On your mark. Get ready!… Start.`, }, `USER_TAG's mind is fantasizing about the cute characters in that last anime USER_THEY watched. Everyone should ask USER_THEM about it!`, { required: (t) => { - return !(process.gags && process.gags[t.interactionuser.id] && Math.random() > 0.75); + return !(process.gags && process.gags[t.serverid][t.interactionuser.id] && Math.random() > 0.75); }, text: `USER_TAG's voice echoes through the halls as USER_THEY monologueUSER_S: ***Tell me, for whom do you fight...***`, }, { required: (t) => { - return !(process.gags && process.gags[t.interactionuser.id] && Math.random() > 0.75); + return !(process.gags && process.gags[t.serverid][t.interactionuser.id] && Math.random() > 0.75); }, text: `USER_TAG pauses for a second, then begins to speak in a sultry tone: Hello Ladies~. Look at your outfit, now back to me, now back to your outfit, now back to me. Sadly, your outfit can't be mine~. But if you jumped into a Mimic instead of using the /wear command, it could look close to mine! Look down, back up, where are you? In my RP Thread! What's in your hand, back at me. I have it, it's the keys to your Collar and Belt! Look again, the keys are now vibes! Look down again, Back up. Where are you? Strapped in Display Stand! Now Cum for me~. Anything is possible when you dress using a Mimic and not by yourself! I'm on a (wooden) horse!`, }, @@ -2019,7 +2019,7 @@ const texts_struggle = { `USER_TAG wants to be the very best! Like no one ever was! To catch them is USER_THEIR great quest - to train them is USER_THEIR call!`, { required: (t) => { - return !(process.gags && process.gags[t.interactionuser.id]); + return !(process.gags && process.gags[t.serverid][t.interactionuser.id]); }, text: `USER_TAG produces a deck of cards and pulls one out with a dramatic flourish, holding it up while shouting, "It's time to d-d-d-d-d-duel!`, }, @@ -5466,7 +5466,7 @@ const getTextGeneric = (type, data_in) => { `USER_TAG twists USER_THEIR body at the sensation as USER_THEY pressUSER_S the button on USER_THEIR shock collar!`, { required: (t) => { - !process.gags[t.interactionuser.id] + !process.gags[t.serverid][t.interactionuser.id] }, text: `USER_TAG bites USER_THEIR lip ` } diff --git a/functions/timefunctions.js b/functions/timefunctions.js index ce07c9eb..bc9a99c2 100644 --- a/functions/timefunctions.js +++ b/functions/timefunctions.js @@ -317,13 +317,15 @@ function runTickEvents() { if (process.eventfunctions == undefined) { return } // Gags if (process.gags) { - Object.keys(process.gags).forEach((userid) => { - getGags(userid).forEach((g) => { - if (process.eventfunctions.gags && process.eventfunctions.gags[g.gagtype] && process.eventfunctions.gags[g.gagtype].tick) { - process.eventfunctions.gags[g.gagtype].tick(userid); - } - }); - }); + Object.keys(process.gags).forEach((serverid) => { + Object.keys(process.gags[serverid]).forEach((userid) => { + getGags(serverid, userid).forEach((g) => { + if (process.eventfunctions.gags && process.eventfunctions.gags[g.gagtype] && process.eventfunctions.gags[g.gagtype].tick) { + process.eventfunctions.gags[g.gagtype].tick(serverid, userid); + } + }); + }); + }); } // Headwear if (process.headwear) { diff --git a/functions/touchfunctions.js b/functions/touchfunctions.js index 6ea77758..108222fd 100644 --- a/functions/touchfunctions.js +++ b/functions/touchfunctions.js @@ -19,6 +19,7 @@ const { statsAddCounter } = require("./setters/config/statsAddCounter"); /**************** * Rolls a Pat based on the user's bondage and the target's bondage. If hit is false, then boundmiss will note the reason, if it is due to the user being bound. + * - **(server id) serverID** the server that this is on * - **(user id) user** trying to deliver the pat * - **(user id) target** to receive the pat * @@ -27,7 +28,7 @@ const { statsAddCounter } = require("./setters/config/statsAddCounter"); * - crit: Boolean * - boundmiss: string ("arms", "blind", "legs", "container") *******************/ -function rollPatChance(user, target) { +function rollPatChance(serverID, user, target) { let returnedobject = { hit: false, crit: false, @@ -97,7 +98,7 @@ function rollPatChance(user, target) { // Do all of the functions for the person receiving the headpats. // Note, within the function we need to check if headpat was successful! - emitEvent("headpatfunction", target, { target: target, returnedobject: returnedobject }) + emitEvent("headpatfunction", target, serverID, { target: target, returnedobject: returnedobject }) if (returnedobject.hit) { statsAddCounter(user, "headpatsgiven"); diff --git a/headwear/gagharness.js b/headwear/gagharness.js index 6deade45..1aac391e 100644 --- a/headwear/gagharness.js +++ b/headwear/gagharness.js @@ -12,7 +12,7 @@ exports.setupfunction = (data) => { name: `Lockable Harness (${process.gagtypes[g].choicename})`, lockable: true, // Only show in autocomplete if the user is currently wearing the gag. - showfunction: (targetuser) => { return (process.gags[targetuser] && process.gags[targetuser].find((ga) => ga.gagtype == g)) } + showfunction: (serverID, targetuser) => { return (process.gags[serverID] && process.gags[serverID][targetuser] && process.gags[serverID][targetuser].find((ga) => ga.gagtype == g)) } }) }) return returnheadwear; From 10a4e44f94efc990e4efd532829c435f35f3092e Mon Sep 17 00:00:00 2001 From: Enraa Date: Mon, 15 Jun 2026 20:23:28 -0700 Subject: [PATCH 02/44] Arousal now needs serverID --- chastity/belt/belt_eternaledging.js | 6 +-- chastity/belt/belt_seal_cyclical.js | 16 +++--- chastity/belt/belt_seal_earth.js | 17 +++---- chastity/belt/belt_seal_falsecalm.js | 6 +-- chastity/belt/belt_seal_fire.js | 10 ++-- eventfunctions/heavy/capture_sphere.js | 2 +- functions/getters/arousal/getArousal.js | 7 ++- functions/getters/arousal/getArousalBar.js | 3 +- .../arousal/getArousalChangeDescription.js | 6 ++- .../getters/arousal/getArousalDescription.js | 5 +- functions/getters/arousal/getArousedTexts.js | 6 ++- .../getters/chastity/getVibeEquivalent.js | 5 +- functions/getters/config/getDisplayTexts.js | 21 ++++---- .../getters/config/getProcessVariable.js | 16 ++++++ functions/keyfindingfunctions.js | 6 +-- functions/setters/arousal/addArousal.js | 12 +++-- functions/vibefunctions.js | 50 ++++++++++--------- toys/Misc/ice.js | 2 +- 18 files changed, 113 insertions(+), 83 deletions(-) create mode 100644 functions/getters/config/getProcessVariable.js diff --git a/chastity/belt/belt_eternaledging.js b/chastity/belt/belt_eternaledging.js index 892cc454..165df91d 100644 --- a/chastity/belt/belt_eternaledging.js +++ b/chastity/belt/belt_eternaledging.js @@ -5,10 +5,10 @@ const { getChastityBra } = require("../../functions/getters/chastity/getChastity // Chastity Belt of Eternal Edging // The Denial Coefficient output of this belt will always be set to 1% higher than the wearer's current arousal. exports.denialCoefficient = (data) => { - let braval = getBaseChastity(getChastityBra(data.userID)?.chastitytype)?.denialCoefficient() ?? 0; - let outnum = Math.round((getArousal(data.userID) / 10 * 1.01) * 10) / 10; + let braval = getBaseChastity(getChastityBra(data.serverID, data.userID)?.chastitytype)?.denialCoefficient() ?? 0; + let outnum = Math.round((getArousal(data.serverID, data.userID) / 10 * 1.01) * 10) / 10; outnum = outnum - braval; - if (Math.round(outnum * 10) == Math.round(getArousal(data.userID))) { + if (Math.round(outnum * 10) == Math.round(getArousal(data.serverID, data.userID))) { outnum += 0.1; } return Math.max(outnum, 1.0) diff --git a/chastity/belt/belt_seal_cyclical.js b/chastity/belt/belt_seal_cyclical.js index 71082195..13666d67 100644 --- a/chastity/belt/belt_seal_cyclical.js +++ b/chastity/belt/belt_seal_cyclical.js @@ -13,14 +13,14 @@ exports.denialCoefficient = (data) => { return 1 } // Events exports.onEquip = (data) => { // Configure base arousal value - if (!getUserVar(data.userID, "base_arousal") || getUserVar(data.userID, "base_arousal") == undefined) setUserVar(data.userID, "base_arousal", getArousal(data.userID) ?? 0); + if (!getUserVar(data.serverID, data.userID, "base_arousal") || getUserVar(data.serverID, data.userID, "base_arousal") == undefined) setUserVar(data.serverID, data.userID, "base_arousal", getArousal(data.serverID, data.userID) ?? 0); // Add a timer which will reset the arousal every 3 mins let chastityinterval = setInterval(() => { - if ((getChastity(data.userID)?.chastitytype == "belt_seal_cyclical") && getUserVar(data.userID, "base_arousal")) { + if ((getChastity(data.serverID, data.userID)?.chastitytype == "belt_seal_cyclical") && getUserVar(data.serverID, data.userID, "base_arousal")) { try { - clearArousal(data.userID); - addArousal(data.userID, getUserVar(data.userID, "base_arousal")); + clearArousal(data.serverID, data.userID); + addArousal(data.serverID, data.userID, getUserVar(data.serverID, data.userID, "base_arousal")); } catch (err) { console.log(err) @@ -30,7 +30,7 @@ exports.onEquip = (data) => { // They're somehow not wearing the belt anymore or something else broke. try { clearInterval(chastityinterval); - setUserVar(data.userID, "base_arousal", undefined); + setUserVar(data.serverID, data.userID, "base_arousal", undefined); } catch (err) { console.log(err) @@ -41,9 +41,9 @@ exports.onEquip = (data) => { exports.onUnequip = (data) => { // Add All Stored Arousal at once - clearArousal(data.userID); - addArousal(data.userID, getUserVar(data.userID, "base_arousal")); - setUserVar(data.userID, "base_arousal", undefined); + clearArousal(data.serverID, data.userID); + addArousal(data.serverID, data.userID, getUserVar(data.serverID, data.userID, "base_arousal")); + setUserVar(data.serverID, data.userID, "base_arousal", undefined); } // Tags diff --git a/chastity/belt/belt_seal_earth.js b/chastity/belt/belt_seal_earth.js index 3b669ad3..d3acd47b 100644 --- a/chastity/belt/belt_seal_earth.js +++ b/chastity/belt/belt_seal_earth.js @@ -11,27 +11,26 @@ exports.orgasmCooldown = (data) => { return 2 } exports.denialCoefficient = (data) => { return 1 } // Set Min Arousal to be equal to the base Arousal + 5% when equipped -exports.minArousal = function(data) { return getUserVar(data.userID, "base_arousal") * 0.90} -exports.maxArousal = function(data) { return getUserVar(data.userID, "base_arousal") * 1.10} +exports.minArousal = function(data) { return getUserVar(data.serverID, data.userID, "base_arousal") * 0.90} +exports.maxArousal = function(data) { return getUserVar(data.serverID, data.userID, "base_arousal") * 1.10} // Events exports.onOrgasm = (data) => { // Maintain Arousal level and Increase Base Arousal to raise cap as the 'rock' jolts slightly forwards - addArousal(data.userID, getUserVar(data.userID, "base_arousal")); - setUserVar(data.userID, "base_arousal", getUserVar(data.userID, "base_arousal") * 1.1) - console.log(getUserVar(data.userID, "base_arousal")) + addArousal(data.serverID, data.userID, getUserVar(data.serverID, data.userID, "base_arousal")); + setUserVar(data.serverID, data.userID, "base_arousal", getUserVar(data.serverID, data.userID, "base_arousal") * 1.1) } exports.afterArousalChange = (data) => { // Earth only allows slow shifts in the arousal values regardless of vibe strength - if(getArousal(data.userID) > getUserVar(data.userID, "base_arousal")) setUserVar(data.userID, "base_arousal", Math.max(getUserVar(data.userID, "base_arousal") * 1.02, getUserVar(data.userID, "base_arousal") + 0.01)) - else if(getArousal(data.userID) < getUserVar(data.userID, "base_arousal")) setUserVar(data.userID, "base_arousal", Math.max(Math.min(getUserVar(data.userID, "base_arousal") * 0.98, getUserVar(data.userID, "base_arousal") - 0.01), 0)) + if(getArousal(data.serverID, data.userID) > getUserVar(data.serverID, data.userID, "base_arousal")) setUserVar(data.serverID, data.userID, "base_arousal", Math.max(getUserVar(data.serverID, data.userID, "base_arousal") * 1.02, getUserVar(data.serverID, data.userID, "base_arousal") + 0.01)) + else if(getArousal(data.serverID, data.userID) < getUserVar(data.serverID, data.userID, "base_arousal")) setUserVar(data.serverID, data.userID, "base_arousal", Math.max(Math.min(getUserVar(data.serverID, data.userID, "base_arousal") * 0.98, getUserVar(data.serverID, data.userID, "base_arousal") - 0.01), 0)) } exports.onEquip = (data) => { // Configure base arousal value - if (!getUserVar(data.userID, "base_arousal") || getUserVar(data.userID, "base_arousal") == undefined) setUserVar(data.userID, "base_arousal", getArousal(data.userID)); + if (!getUserVar(data.serverID, data.userID, "base_arousal") || getUserVar(data.serverID, data.userID, "base_arousal") == undefined) setUserVar(data.serverID, data.userID, "base_arousal", getArousal(data.serverID, data.userID)); } exports.onUnequip = (data) => { - setUserVar(data.userID, "base_arousal", undefined); + setUserVar(data.serverID, data.userID, "base_arousal", undefined); } // Tags diff --git a/chastity/belt/belt_seal_falsecalm.js b/chastity/belt/belt_seal_falsecalm.js index 2fcf7fb4..75c0e64a 100644 --- a/chastity/belt/belt_seal_falsecalm.js +++ b/chastity/belt/belt_seal_falsecalm.js @@ -15,13 +15,13 @@ exports.maxArousal = (data) => { return 0 } // Randomly reduce the level of arousal by a random percentage, then reduce by a further 10% exports.onEquip = (data) => { // Configure base arousal value - if (!getUserVar(data.userID, "base_arousal") || getUserVar(data.userID, "base_arousal") == undefined) setUserVar(data.userID, "base_arousal", getArousal(data.userID) ?? 0); + if (!getUserVar(data.serverID, data.userID, "base_arousal") || getUserVar(data.serverID, data.userID, "base_arousal") == undefined) setUserVar(data.serverID, data.userID, "base_arousal", getArousal(data.serverID, data.userID) ?? 0); } exports.onUnequip = (data) => { // Add All Stored Arousal at once - addArousal(data.userID, getUserVar(data.userID, "base_arousal")); - setUserVar(data.userID, "base_arousal", undefined); + addArousal(data.serverID, data.userID, getUserVar(data.serverID, data.userID, "base_arousal")); + setUserVar(data.serverID, data.userID, "base_arousal", undefined); } // Tags diff --git a/chastity/belt/belt_seal_fire.js b/chastity/belt/belt_seal_fire.js index 88a94761..b24842d7 100644 --- a/chastity/belt/belt_seal_fire.js +++ b/chastity/belt/belt_seal_fire.js @@ -11,23 +11,23 @@ exports.orgasmCooldown = (data) => { return 0.5 } exports.denialCoefficient = (data) => { return 1 } // Set Min Arousal to be equal to the initial Arousal when equipped -exports.minArousal = function(data) { return getUserVar(data.userID, "base_arousal") } +exports.minArousal = function(data) { return getUserVar(data.serverID, data.userID, "base_arousal") } // Events exports.onOrgasm = (data) => { // Reset Arousal to Base - addArousal(data.userID, getUserVar(data.userID, "base_arousal")); + addArousal(data.serverID, data.userID, getUserVar(data.serverID, data.userID, "base_arousal")); } exports.onFailedOrgasm = (data) => { // Add a small amount of arousal with each failed attempt - addArousal(data.userID, 2 * Math.random()); + addArousal(data.serverID, data.userID, 2 * Math.random()); } exports.onEquip = (data) => { // Configure base arousal value - if (!getUserVar(data.userID, "base_arousal") || getUserVar(data.userID, "base_arousal") == undefined) setUserVar(data.userID, "base_arousal", getArousal(data.userID)); + if (!getUserVar(data.serverID, data.userID, "base_arousal") || getUserVar(data.serverID, data.userID, "base_arousal") == undefined) setUserVar(data.serverID, data.userID, "base_arousal", getArousal(data.serverID, data.userID)); } exports.onUnequip = (data) => { - setUserVar(data.userID, "base_arousal", undefined); + setUserVar(data.serverID, data.userID, "base_arousal", undefined); } // Tags diff --git a/eventfunctions/heavy/capture_sphere.js b/eventfunctions/heavy/capture_sphere.js index b79929b3..5388fcbc 100644 --- a/eventfunctions/heavy/capture_sphere.js +++ b/eventfunctions/heavy/capture_sphere.js @@ -25,7 +25,7 @@ const { getText } = require("../../functions/textfunctions") function calculatecapture(serverID, userid, ballbonusnum = 1.0) { // The user's "health" will be based off of 50 arousal. let maxhealth = 50 - let currhealth = Math.max(50 - getArousal(userid), 0.5) // Always clamp to 0.5 hp left - false swipe range if you will. + let currhealth = Math.max(50 - getArousal(serverID, userid), 0.5) // Always clamp to 0.5 hp left - false swipe range if you will. let darkgrass = 1 // Not used, but formula has this, so we'll add it // Catch rate will be a base of 150, minus 10 for each held key, down to 3 (the catch rate for Articuno!) diff --git a/functions/getters/arousal/getArousal.js b/functions/getters/arousal/getArousal.js index 58a8cafe..a74d2293 100644 --- a/functions/getters/arousal/getArousal.js +++ b/functions/getters/arousal/getArousal.js @@ -1,12 +1,15 @@ +const { getProcessVariable } = require("../config/getProcessVariable"); + /********* * Gets the user's current arousal * + * - (server id) serverID - The server this is on * - (user id) user - The user who is aroused * --- * ##### Returns a float representing the user's current arousal, or 0. */ -function getArousal(user) { - return process.arousal[user]?.arousal ?? 0; +function getArousal(serverID, user) { + return getProcessVariable(serverID, user, "arousal").arousal ?? 0; } exports.getArousal = getArousal; \ No newline at end of file diff --git a/functions/getters/arousal/getArousalBar.js b/functions/getters/arousal/getArousalBar.js index b76be7b0..5ce0b205 100644 --- a/functions/getters/arousal/getArousalBar.js +++ b/functions/getters/arousal/getArousalBar.js @@ -7,12 +7,13 @@ const ORGASM_LIMIT = 10; /********** * Get a bar representing the user's current arousal over denial. * + * - (server id) serverID - The server this is on * - (user id) userID - The user who is aroused * --- * ##### Returns a string representing a filled bar for arousal percentage **********/ function getArousalBar(userID) { - const arousal = getArousal(userID); + const arousal = getArousal(serverID, userID); const denialCoefficient = calcDenialCoefficient(userID); const orgasmLimit = ORGASM_LIMIT; const filledbar = "ā– "; diff --git a/functions/getters/arousal/getArousalChangeDescription.js b/functions/getters/arousal/getArousalChangeDescription.js index e458d215..2c689949 100644 --- a/functions/getters/arousal/getArousalChangeDescription.js +++ b/functions/getters/arousal/getArousalChangeDescription.js @@ -1,5 +1,6 @@ const { getBotOption } = require("../config/getBotOption"); const { getOption } = require("../config/getOption"); +const { getProcessVariable } = require("../config/getProcessVariable"); // the arousal needed for an unbelted user to orgasm const ORGASM_LIMIT = 10; @@ -7,14 +8,15 @@ const ORGASM_LIMIT = 10; /********** * Gets a description representing the user's arousal change * + * - (server id) serverID - The server this is on * - (user id) user - The user who is aroused * --- * ##### Returns a string representing their arousal change **********/ -function getArousalChangeDescription(user) { +function getArousalChangeDescription(serverID, user) { if (getOption(user, "arousalsystem") != 2) return null; - const arousal = process.arousal[user]; + const arousal = getProcessVariable(serverID, user, "arousal"); if (!arousal) return null; const lastChange = (arousal.arousal - arousal.prev) / (getBotOption("bot-timetickrate") / 60000); if (Math.abs(lastChange) < 0.01) return null; diff --git a/functions/getters/arousal/getArousalDescription.js b/functions/getters/arousal/getArousalDescription.js index 3a4ac282..993c5ca1 100644 --- a/functions/getters/arousal/getArousalDescription.js +++ b/functions/getters/arousal/getArousalDescription.js @@ -10,14 +10,15 @@ const RESET_LIMIT = 0.1; /********** * Gets a description representing the user's arousal * + * - (server id) serverID - The server this is on * - (user id) user - The user who is aroused * --- * ##### Returns a string representing their arousal **********/ -function getArousalDescription(user) { +function getArousalDescription(serverID, user) { if (getOption(user, "arousalsystem") === 0) return null; // Disabled Arousal system - const arousal = getArousal(user); + const arousal = getArousal(serverID, user); const denialCoefficient = calcDenialCoefficient(user); const orgasmLimit = ORGASM_LIMIT * denialCoefficient; const orgasmProgress = arousal / orgasmLimit; diff --git a/functions/getters/arousal/getArousedTexts.js b/functions/getters/arousal/getArousedTexts.js index f332f0e6..9d22f010 100644 --- a/functions/getters/arousal/getArousedTexts.js +++ b/functions/getters/arousal/getArousedTexts.js @@ -1,19 +1,21 @@ const { arousedtexts } = require("../../../vibes/aroused/aroused_texts"); const { calcStaticVibeIntensity } = require("../../vibefunctions"); const { getOption } = require("../config/getOption"); +const { getProcessVariable } = require("../config/getProcessVariable"); /********* * Returns valid arousal texts to be used when stuttering during speech * + * - (server id) serverID - The server this is running on * - (user id) user - The user that is aroused * --- * ##### Returns an array of strings with aroused texts *********/ -function getArousedTexts(user) { +function getArousedTexts(serverID, user) { const texts = []; if (getOption(user, "arousalsystem") == 2) { - const arousal = process.arousal[user]; + const arousal = getProcessVariable(serverID, user, "arousal"); const current = arousal.arousal; const change = arousal.arousal - arousal.prev; for (const [min, max, minChange, maxChange, text] of arousedtexts) { diff --git a/functions/getters/chastity/getVibeEquivalent.js b/functions/getters/chastity/getVibeEquivalent.js index c29f22f5..a45041cc 100644 --- a/functions/getters/chastity/getVibeEquivalent.js +++ b/functions/getters/chastity/getVibeEquivalent.js @@ -8,14 +8,15 @@ const STUTTER_LIMIT = 1; /*********** * Calculate the effective arousal for the user based on their current frustration * + * - (server id) serverID - The server this is on * - (user id) user - The user that is aroused * --- * ##### Returns a value of arousal with their added frustration ***********/ -function getVibeEquivalent(user) { +function getVibeEquivalent(serverID, user) { if (getOption(user, "arousalsystem") != 2) return calcStaticVibeIntensity(user) * 2; - let intensity = getArousal(user); + let intensity = getArousal(serverID, user); if (intensity >= STUTTER_LIMIT) intensity += calcFrustration(user) / 20; return intensity; } diff --git a/functions/getters/config/getDisplayTexts.js b/functions/getters/config/getDisplayTexts.js index 0c4f67c7..c7479ea4 100644 --- a/functions/getters/config/getDisplayTexts.js +++ b/functions/getters/config/getDisplayTexts.js @@ -11,29 +11,30 @@ const { getUserVar } = require("./getUserVar"); /************* * Get the user's additional display texts, ordered and only viewable if necessary. * + * - (server ID) serverID - The server this interaction is run on * - (user id) userID - User ID of the person viewing * - (user id) inspectuserID - User ID of the person we're checking * --- * ##### Returns a string to append to outfit modal with all of the additional widgets ************/ -async function getDisplayTexts(userID, inspectuserID) { +async function getDisplayTexts(serverID, userID, inspectuserID) { let bartext = ``; // ******************** Arousal Display - if (getArousal(inspectuserID) > 2.0) { - if (getOption(userID, "arousaldisplay") == "bar") { - bartext = `\n\nšŸ’ž Arousal: ${getArousalBar(inspectuserID).bar} (${getArousalBar(inspectuserID).percentage}%)` - if (calcDenialCoefficient(inspectuserID) > 1) { - bartext = `${bartext}\n\n-# ā€Ž (Current Denial: **${Math.round(calcDenialCoefficient(inspectuserID) * 100)}%**)` + if (getArousal(serverID, inspectuserID) > 2.0) { + if (getOption(serverID, userID, "arousaldisplay") == "bar") { + bartext = `\n\nšŸ’ž Arousal: ${getArousalBar(serverID, inspectuserID).bar} (${getArousalBar(serverID, inspectuserID).percentage}%)` + if (calcDenialCoefficient(serverID, inspectuserID) > 1) { + bartext = `${bartext}\n\n-# ā€Ž (Current Denial: **${Math.round(calcDenialCoefficient(serverID, inspectuserID) * 100)}%**)` } } - if (getOption(userID, "arousaldisplay") == "desc") { - let arousaltext = getArousalDescription(inspectuserID); - let arousalchangetext = getArousalChangeDescription(inspectuserID) + if (getOption(serverID, userID, "arousaldisplay") == "desc") { + let arousaltext = getArousalDescription(serverID, inspectuserID); + let arousalchangetext = getArousalChangeDescription(serverID, inspectuserID) bartext = `\n\nšŸ’ž Arousal: **${arousaltext}**${arousalchangetext ? `\n-# **...${arousalchangetext}**` : ""}` } if (getOption(userID, "arousaldisplay") == "numbers") { - bartext = `\n\nšŸ’ž Arousal: **${Math.round(getArousal(inspectuserID) * 10) / 10}** of **${Math.round(calcDenialCoefficient(inspectuserID) * 10)}** (${Math.round((getArousal(inspectuserID) / ((calcDenialCoefficient(inspectuserID) * 10))) * 100) / 1}%)` + bartext = `\n\nšŸ’ž Arousal: **${Math.round(getArousal(serverID, inspectuserID) * 10) / 10}** of **${Math.round(calcDenialCoefficient(serverID, inspectuserID) * 10)}** (${Math.round((getArousal(serverID, inspectuserID) / ((calcDenialCoefficient(serverID, inspectuserID) * 10))) * 100) / 1}%)` } } // ****************** diff --git a/functions/getters/config/getProcessVariable.js b/functions/getters/config/getProcessVariable.js new file mode 100644 index 00000000..aba43fee --- /dev/null +++ b/functions/getters/config/getProcessVariable.js @@ -0,0 +1,16 @@ +/******* + * Get the base object for a user. + * + * - (server ID) serverID - The server this is for + * - (user ID) userID - The user this is for + * - (string) processvar - The specific variable to get + * --- + * ##### Returns the object if it exists, undefined if it doesn't. + *******/ +function getProcessVariable(serverID, userID, processvar) { + if (process[processvar] == undefined) { process[processvar] = {} } + if (process[processvar][serverID] == undefined) { process[processvar][serverID] = {} } + return process[processvar][serverID][userID] +} + +exports.getProcessVariable = getProcessVariable; \ No newline at end of file diff --git a/functions/keyfindingfunctions.js b/functions/keyfindingfunctions.js index 571d9e13..99b65e40 100644 --- a/functions/keyfindingfunctions.js +++ b/functions/keyfindingfunctions.js @@ -84,7 +84,7 @@ function rollKeyFumble(keyholder, locked) { } } -function getFumbleChance(keyholder, locked) { +function getFumbleChance(serverID, keyholder, locked) { // cannot fumble if disabled if (getOption(locked, "fumbling") == "disabled") return 0; // ... or if not using the dynamic arousal system @@ -100,8 +100,8 @@ function getFumbleChance(keyholder, locked) { // Target numbers are 15 arousal = 0, 150 arousal = 100 // Frustration influences how sharply the curve tilts upwards as well as adding a tiny bit to the start // The notable part is that frustration SEVERELY affects higher arousal levels. - console.log((((0.0045 + frustrationaddition * 0.0004) * Math.pow(getArousal(locked), 2) - 1) + (frustrationaddition / 100))) - let chance = Math.max(0, (((0.0045 + frustrationaddition * 0.0004) * Math.pow(getArousal(locked), 2) - 1) + (frustrationaddition / 100))) + console.log((((0.0045 + frustrationaddition * 0.0004) * Math.pow(getArousal(serverID, locked), 2) - 1) + (frustrationaddition / 100))) + let chance = Math.max(0, (((0.0045 + frustrationaddition * 0.0004) * Math.pow(getArousal(serverID, locked), 2) - 1) + (frustrationaddition / 100))) // chance is increased if the keyholder is wearing mittens if (getMitten(keyholder)) { diff --git a/functions/setters/arousal/addArousal.js b/functions/setters/arousal/addArousal.js index ae0a0ab8..9c260e9b 100644 --- a/functions/setters/arousal/addArousal.js +++ b/functions/setters/arousal/addArousal.js @@ -1,27 +1,29 @@ const { getArousal } = require("../../getters/arousal/getArousal"); const { getCombinedTraits } = require("../../getters/chastity/getCombinedTraits"); +const { getProcessVariable } = require("../../getters/config/getProcessVariable"); /********** * Adds arousal to the user * + * - (server id) serverID - The server this is on * - (user id) user - The user to add the arousal to * - (float) change - The amount to change their arousal by. Can be negative * --- * ##### Returns current arousal after change **********/ -function addArousal(user, change) { - if (!process.arousal[user]) process.arousal[user] = { arousal: 0, prev: 0, timestamp: Date.now() }; +function addArousal(arousal, user, change) { + if (!getProcessVariable(serverID, user, "arousal")) process.arousal[serverID][user] = { arousal: 0, prev: 0, timestamp: Date.now() }; if (isNaN(change)) { console.log(`ERROR - Attempting to add a NaN arousal to user ID ${user}`) change = 0; // set it to 0 } process.arousal[user].arousal += change; - if (isNaN(getArousal(user))) { + if (isNaN(getArousal(serverID, user))) { console.log(`ERROR - ${user} is somehow not a number!`) process.arousal[user].arousal = 0; } - getCombinedTraits(user).afterArousalChange({ userID: user, prevArousal: (process.arousal[user].arousal - change), currArousal: process.arousal[user].arousal }); - return getArousal(user); + getCombinedTraits(serverID, user).afterArousalChange({ userID: user, prevArousal: (getArousal(serverID, user) - change), currArousal: getArousal(serverID, user) }); + return getArousal(serverID, user); } exports.addArousal = addArousal; \ No newline at end of file diff --git a/functions/vibefunctions.js b/functions/vibefunctions.js index a59786fe..700ee6fb 100644 --- a/functions/vibefunctions.js +++ b/functions/vibefunctions.js @@ -366,7 +366,7 @@ function stutterText(msg, text, intensity, arousedtexts) { let overcorrected = 3; let shockable = (process.collar && process.collar[msg.author.id] && ((process.collar[msg.author.id].collartype == "hornyshockcollar") || (process.collar[msg.author.id].additionalcollars && process.collar[msg.author.id].additionalcollars.includes("hornyshockcollar")))) let shocked = false; - let shockchance = (getArousal(msg.author.id) / 100) * 0.25 + let shockchance = (getArousal(msg.guild.id, msg.author.id) / 100) * 0.25 // js is a disaster sometimes. And Im a terrible coder. if (isNaN(usermod) || usermod > 2.0 || usermod < 0.33) { usermod == 1.0; @@ -562,30 +562,32 @@ function updateSharedBreath() { processed = []; let arousalscale = (getBotOption("bot-timetickrate") / 60000) * 0.4 let minadjustment = 0.1 * (getBotOption("bot-timetickrate") / 60000) - for (const user in process.headwear) { - if (process.headwear && process.headwear[user] && process.headwear[user].sharedbreathhose && !processed.includes(process.headwear[user].sharedbreathhose) && !processed.includes(user)) { - //console.log(`Adjusting horniness for ${user} to ${process.headwear[user].sharedbreathhose}`) - // If both people are wearing the linked gasmask AND have each other designated to share breath... - if (getHeadwear(user).includes("gasmasklinked") && getHeadwear(process.headwear[user].sharedbreathhose).includes("gasmasklinked") && - (user == process.headwear[process.headwear[user].sharedbreathhose].sharedbreathhose)) { - let personA = getArousal(user) - let personB = getArousal(process.headwear[user].sharedbreathhose) - let diff = personA - personB; - let delta = Math.max(arousalscale * Math.abs(diff), minadjustment); - if (diff < 0) { - // Person B is hornier, so person A should gain, person B should lose. - addArousal(user, delta); - addArousal(process.headwear[user].sharedbreathhose, -delta) - console.log(`${process.headwear[user].sharedbreathhose} sharing ${delta} arousal to ${user}`) + for (const serverID in process.headwear) { + for (const user in process.headwear[serverID]) { + if (process.headwear && process.headwear[serverID] && process.headwear[serverID][user] && process.headwear[serverID][user].sharedbreathhose && !processed.includes(process.headwear[serverID][user].sharedbreathhose) && !processed.includes(user)) { + //console.log(`Adjusting horniness for ${user} to ${process.headwear[user].sharedbreathhose}`) + // If both people are wearing the linked gasmask AND have each other designated to share breath... + if (getHeadwear(serverID, user).includes("gasmasklinked") && getHeadwear(serverID, process.headwear[user].sharedbreathhose).includes("gasmasklinked") && + (user == process.headwear[process.headwear[user].sharedbreathhose].sharedbreathhose)) { + let personA = getArousal(serverID, user) + let personB = getArousal(serverID, process.headwear[user].sharedbreathhose) + let diff = personA - personB; + let delta = Math.max(arousalscale * Math.abs(diff), minadjustment); + if (diff < 0) { + // Person B is hornier, so person A should gain, person B should lose. + addArousal(serverID, user, delta); + addArousal(serverID, process.headwear[user].sharedbreathhose, -delta) + console.log(`${process.headwear[user].sharedbreathhose} sharing ${delta} arousal to ${user}`) + } + else { + // Person A is hornier, so person B should gain, person A should lose. + addArousal(serverID, process.headwear[user].sharedbreathhose, delta); + addArousal(serverID, user, -delta) + console.log(`${user} sharing ${delta} arousal to ${process.headwear[user].sharedbreathhose}`) + } + processed.push(user) + processed.push(process.headwear[user].sharedbreathhose) } - else { - // Person A is hornier, so person B should gain, person A should lose. - addArousal(process.headwear[user].sharedbreathhose, delta); - addArousal(user, -delta) - console.log(`${user} sharing ${delta} arousal to ${process.headwear[user].sharedbreathhose}`) - } - processed.push(user) - processed.push(process.headwear[user].sharedbreathhose) } } } diff --git a/toys/Misc/ice.js b/toys/Misc/ice.js index 7bd97b97..8b5dc5f1 100644 --- a/toys/Misc/ice.js +++ b/toys/Misc/ice.js @@ -3,7 +3,7 @@ const { getChastity } = require("../../functions/getters/chastity/getChastity") // Ice // This reduces the arousal of the wearer by a proportion of their current arousal -exports.vibescale = (data) => { return (Math.max(Math.min(getArousal(data.userID) / 10, 10), 1) * -1) } +exports.vibescale = (data) => { return (Math.max(Math.min(getArousal(data.serverID, data.userID) / 10, 10), 1) * -1) } exports.calcVibeEffect = function (data) { if (getChastity(data.userID)) { return data.intensity * 0.4 * (this.vibescale(data) * 0.40) // 40% effectiveness if in chastity From f335523b524a6e49c3dbf117fa39ecc5fd5e6f39 Mon Sep 17 00:00:00 2001 From: Enraa Date: Mon, 15 Jun 2026 22:16:23 -0700 Subject: [PATCH 03/44] traceFirstParam This modifies all getter/setter functions and the ___functions.js files to utilize a new function called at the beginning where appropriate to check if the first param is a server ID, and crash the bot if it's not. This is for testing and once no crashes occur because of this, it can be removed in the future. --- chastity/belt/belt_seal_ice.js | 12 +++---- functions/collarfunctions.js | 3 ++ functions/configfunctions.js | 31 ------------------- functions/corsetfunctions.js | 13 +++++--- functions/delvefunctions.js | 10 ++++-- functions/dollfunctions.js | 10 ++++-- functions/gagfunctions.js | 4 ++- functions/gamefunctions.js | 5 +++ functions/getters/arousal/getArousal.js | 2 ++ functions/getters/arousal/getArousalBar.js | 4 ++- .../arousal/getArousalChangeDescription.js | 2 ++ .../getters/arousal/getArousalDescription.js | 2 ++ functions/getters/arousal/getArousedTexts.js | 2 ++ .../getters/chastity/canAccessChastity.js | 5 ++- .../getters/chastity/canAccessChastityBra.js | 2 ++ functions/getters/chastity/getChastity.js | 3 ++ functions/getters/chastity/getChastityBra.js | 3 ++ .../chastity/getChastityBraKeyholder.js | 2 ++ .../getters/chastity/getChastityBraKeys.js | 3 ++ .../getters/chastity/getChastityBraName.js | 3 ++ .../chastity/getChastityBraTimelock.js | 3 ++ .../getters/chastity/getChastityKeyholder.js | 2 ++ functions/getters/chastity/getChastityKeys.js | 3 ++ functions/getters/chastity/getChastityName.js | 3 ++ .../getters/chastity/getChastityTimelock.js | 2 ++ .../chastity/getClonedChastityBraKey.js | 2 ++ .../chastity/getClonedChastityBraKeysOwned.js | 3 ++ .../getters/chastity/getClonedChastityKey.js | 2 ++ .../chastity/getClonedChastityKeysOwned.js | 3 ++ .../getters/chastity/getCombinedTraits.js | 2 ++ .../getters/chastity/getOtherKeysChastity.js | 3 ++ .../chastity/getOtherKeysChastityBra.js | 3 ++ .../getters/chastity/getVibeEquivalent.js | 2 ++ functions/getters/collar/canAccessCollar.js | 2 ++ .../getters/collar/getClonedCollarKey.js | 2 ++ .../collar/getClonedCollarKeysOwned.js | 3 ++ functions/getters/collar/getCollar.js | 2 ++ .../getters/collar/getCollarKeyholder.js | 2 ++ functions/getters/collar/getCollarKeys.js | 3 ++ functions/getters/collar/getCollarName.js | 3 ++ functions/getters/collar/getCollarPerm.js | 2 ++ functions/getters/collar/getCollarTimelock.js | 2 ++ .../getters/collar/getOtherKeysCollar.js | 3 ++ .../getters/config/getAllSelectedOption.js | 3 ++ functions/getters/config/getAlternateName.js | 2 ++ functions/getters/config/getDisplayTexts.js | 2 ++ functions/getters/config/getOption.js | 2 ++ functions/getters/config/getOutfits.js | 3 ++ functions/getters/config/getPFP.js | 2 ++ .../getters/config/getProcessVariable.js | 3 ++ functions/getters/config/getPronouns.js | 2 ++ functions/getters/config/getPronounsSet.js | 3 ++ functions/getters/config/getUserTags.js | 2 ++ functions/getters/config/getUserVar.js | 3 ++ .../getters/config/getUsersWithOption.js | 3 ++ functions/getters/config/statsGetAllStat.js | 3 ++ functions/getters/config/statsGetCounter.js | 3 ++ functions/getters/corset/getBreath.js | 2 ++ functions/getters/corset/getCorset.js | 3 ++ functions/getters/corset/getCorsetBinder.js | 2 ++ functions/getters/delve/getCurrentFloor.js | 3 ++ functions/getters/delve/getDelveFloorState.js | 3 ++ .../getters/delve/getDelvePlayerStats.js | 3 ++ functions/getters/delve/getResolve.js | 3 ++ functions/getters/gag/getGag.js | 3 ++ functions/getters/gag/getGagBinder.js | 2 ++ functions/getters/gag/getGagIntensity.js | 2 ++ functions/getters/gag/getGagLast.js | 3 ++ functions/getters/gag/getGags.js | 3 ++ functions/getters/headwear/getHeadwear.js | 3 ++ .../getters/headwear/getHeadwearBinder.js | 3 ++ functions/getters/headwear/getHeadwearName.js | 2 ++ .../headwear/getHeadwearRestrictions.js | 2 ++ .../getters/headwear/getLockedHeadgear.js | 3 ++ functions/getters/heavy/getHeavy.js | 2 ++ functions/getters/heavy/getHeavyBinder.js | 2 ++ functions/getters/heavy/getHeavyBound.js | 2 ++ functions/getters/heavy/getHeavyList.js | 3 ++ .../getters/heavy/getHeavyRestrictions.js | 2 ++ functions/getters/heavy/getHeavyTagsOnUser.js | 2 ++ functions/getters/mitten/getMitten.js | 3 ++ functions/getters/mitten/getMittenName.js | 2 ++ functions/getters/toy/canPlaceToy.js | 3 ++ functions/getters/toy/canRemoveToy.js | 3 ++ functions/getters/toy/getSpecificToy.js | 2 ++ functions/getters/toy/getToys.js | 3 ++ functions/getters/toy/userBlockArousingToy.js | 2 ++ .../getters/wearable/getLockedWearable.js | 3 ++ functions/getters/wearable/getWearable.js | 3 ++ functions/getters/wearable/getWearableName.js | 3 ++ functions/headwearfunctions.js | 7 +++-- functions/interactivefunctions.js | 11 +++++-- functions/keyfindingfunctions.js | 5 ++- functions/other/TESTS/traceFirstParam.js | 27 ++++++++++++++++ functions/outfitfunctions.js | 2 ++ functions/pronounfunctions.js | 6 ++-- functions/setters/arousal/addArousal.js | 10 ++++-- functions/setters/arousal/clearArousal.js | 2 ++ functions/setters/chastity/assignChastity.js | 2 ++ .../setters/chastity/assignChastityBra.js | 2 ++ .../setters/chastity/cloneChastityBraKey.js | 2 ++ .../setters/chastity/cloneChastityKey.js | 2 ++ functions/setters/chastity/removeChastity.js | 2 ++ .../setters/chastity/removeChastityBra.js | 2 ++ .../setters/chastity/revokeChastityBraKey.js | 2 ++ .../setters/chastity/revokeChastityKey.js | 2 ++ functions/setters/chastity/swapChastity.js | 2 ++ functions/setters/chastity/swapChastityBra.js | 2 ++ .../chastity/transferChastityBraKey.js | 2 ++ .../setters/chastity/transferChastityKey.js | 2 ++ .../collar/addAdditionalCollarEffect.js | 2 ++ functions/setters/collar/assignCollar.js | 2 ++ functions/setters/collar/cloneCollarKey.js | 2 ++ .../collar/removeAdditionalCollarEffect.js | 2 ++ functions/setters/collar/removeCollar.js | 2 ++ functions/setters/collar/revokeCollarKey.js | 2 ++ functions/setters/collar/transferCollarKey.js | 2 ++ functions/setters/config/assignOutfit.js | 2 ++ functions/setters/config/discardKey.js | 2 ++ functions/setters/config/renameOutfit.js | 2 ++ functions/setters/config/restoreOutfit.js | 2 ++ functions/setters/config/setOption.js | 2 ++ functions/setters/config/setPronouns.js | 2 ++ functions/setters/config/setUserVar.js | 2 ++ functions/setters/config/statsAddCounter.js | 2 ++ functions/setters/config/statsSetCounter.js | 2 ++ functions/setters/corset/assignCorset.js | 2 ++ functions/setters/corset/removeCorset.js | 2 ++ functions/setters/delve/setDelveFloorState.js | 2 ++ functions/setters/delve/setNextDelveRoom.js | 2 ++ functions/setters/delve/setResolve.js | 3 ++ functions/setters/gag/assignGag.js | 2 ++ functions/setters/gag/removeGag.js | 2 ++ .../setters/headwear/addLockedHeadgear.js | 2 ++ functions/setters/headwear/assignHeadwear.js | 2 ++ functions/setters/headwear/removeHeadwear.js | 2 ++ .../setters/headwear/removeLockedHeadgear.js | 2 ++ functions/setters/heavy/assignHeavy.js | 2 ++ functions/setters/heavy/removeHeavy.js | 2 ++ functions/setters/mitten/assignMitten.js | 2 ++ functions/setters/mitten/removeMitten.js | 2 ++ functions/setters/toy/assignToy.js | 2 ++ functions/setters/toy/removeToy.js | 2 ++ .../setters/wearable/addLockedWearable.js | 2 ++ functions/setters/wearable/assignWearable.js | 2 ++ .../setters/wearable/removeLockedWearable.js | 2 ++ functions/setters/wearable/removeWearable.js | 2 ++ functions/statsfunctions.js | 4 ++- functions/textfunctions.js | 22 ++++++------- functions/timelockfunctions.js | 31 +++++++++++++------ functions/touchfunctions.js | 8 +++-- functions/vibefunctions.js | 28 +++++++++++------ functions/wearablefunctions.js | 1 - 153 files changed, 467 insertions(+), 95 deletions(-) create mode 100644 functions/other/TESTS/traceFirstParam.js diff --git a/chastity/belt/belt_seal_ice.js b/chastity/belt/belt_seal_ice.js index 3b2c9b7a..62a8e6c5 100644 --- a/chastity/belt/belt_seal_ice.js +++ b/chastity/belt/belt_seal_ice.js @@ -11,27 +11,27 @@ exports.orgasmCooldown = (data) => { return 2 } exports.denialCoefficient = (data) => { return 1 } // Set Min Arousal to be equal to the base Arousal + 5% when equipped -exports.maxArousal = function(data) { return getUserVar(data.userID, "base_arousal") * 1.05} +exports.maxArousal = function(data) { return getUserVar(data.serverID, data.userID, "base_arousal") * 1.05} // Events exports.onOrgasm = (data) => { // Decrease Base Arousal as the ice refreezes - setUserVar(data.userID, "base_arousal", getUserVar(data.userID, "base_arousal") * 0.5) + setUserVar(data.serverID, data.userID, "base_arousal", getUserVar(data.serverID, data.userID, "base_arousal") * 0.5) } exports.onFailedOrgasm = (data) => { // Remove a small amount of arousal with each failed attempt - addArousal(data.userID, -0.5); + addArousal(data.serverID, data.userID, -0.5); } exports.afterArousalChange = (data) => { // Gradually raise the arousal cap as the ice slowly melts - if(getArousal(data.userID) > getUserVar(data.userID, "base_arousal")) setUserVar(data.userID, "base_arousal", getUserVar(data.userID, "base_arousal") * 1.001) + if(getArousal(data.serverID, data.userID) > getUserVar(data.serverID, data.userID, "base_arousal")) setUserVar(data.serverID, data.userID, "base_arousal", getUserVar(data.serverID, data.userID, "base_arousal") * 1.001) } exports.onEquip = (data) => { // Configure base arousal value - if (!getUserVar(data.userID, "base_arousal") || getUserVar(data.userID, "base_arousal") == undefined) setUserVar(data.userID, "base_arousal", getArousal(data.userID) ?? 5); + if (!getUserVar(data.serverID, data.userID, "base_arousal") || getUserVar(data.serverID, data.userID, "base_arousal") == undefined) setUserVar(data.userID, "base_arousal", getArousal(data.serverID, data.userID) ?? 5); } exports.onUnequip = (data) => { - setUserVar(data.userID, "base_arousal", undefined); + setUserVar(data.serverID, data.userID, "base_arousal", undefined); } // Tags diff --git a/functions/collarfunctions.js b/functions/collarfunctions.js index 271b1473..6b80905d 100644 --- a/functions/collarfunctions.js +++ b/functions/collarfunctions.js @@ -3,6 +3,7 @@ const path = require("path"); const https = require("https"); const { SlashCommandBuilder, ComponentType, ButtonBuilder, ActionRowBuilder, ButtonStyle, MessageFlags } = require("discord.js"); const { getCollarPerm } = require("./getters/collar/getCollarPerm"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam"); const collartypes = [ { name: "Latex Collar", value: "collar_latex", tags: ["latex"] }, @@ -44,6 +45,7 @@ function loadCollarTypes() { // Called to prompt the wearer if it is okay to clone a key. async function promptCloneCollarKey(user, target, clonekeyholder) { + traceFirstParam(arguments[0]); return new Promise(async (res, rej) => { let buttons = [new ButtonBuilder().setCustomId("denyButton").setLabel("Deny").setStyle(ButtonStyle.Danger), new ButtonBuilder().setCustomId("acceptButton").setLabel("Allow").setStyle(ButtonStyle.Success)]; let bondageaccess = `${getCollarPerm(target.id, "mitten") ? "mitten you, " : ""}${getCollarPerm(target.id, "chastity") ? "put you in chastity, " : ""}${getCollarPerm(target.id, "chastity") ? "put heavy bondage on you, " : ""}`.slice(0, -2); @@ -82,6 +84,7 @@ async function promptCloneCollarKey(user, target, clonekeyholder) { // Called to prompt the wearer if it is okay to give a key. async function promptTransferCollarKey(user, target, newKeyholder) { + traceFirstParam(arguments[0]); return new Promise(async (res, rej) => { try { let buttons = [new ButtonBuilder().setCustomId("denyButton").setLabel("Deny").setStyle(ButtonStyle.Danger), new ButtonBuilder().setCustomId("acceptButton").setLabel("Allow").setStyle(ButtonStyle.Success)]; diff --git a/functions/configfunctions.js b/functions/configfunctions.js index f86ba81e..1b1cb85b 100644 --- a/functions/configfunctions.js +++ b/functions/configfunctions.js @@ -589,37 +589,6 @@ function generateUserEntryModal(interaction, data, optionval) { return modal; } -// Gets all blocked or preferred tags -function getUserTags(userID, preferred = false) { - if (!userID) { return [] } - let tags = []; - let optionstocheck = Object.keys(configoptions.Content).map((t) => t.replace("wearabletags-", "")) - optionstocheck.forEach((tag) => { - if (getOption(userID, `wearabletags-${tag}`) == (preferred ? "preferred" : "none")) { - tags.push(tag) - } - }) - return tags; -} - -async function getAllJoinedGuilds(client) { - let allguilds = await client.guilds.fetch(); - let guilds = []; - let actives = 0; - for (const guild of allguilds) { - let guildfetched = await client.guilds.fetch(guild[0]); - let guildapps = Array.from(await guildfetched.commands.fetch()).map((g) => g[0]); - guilds.push({ id: guild[0], name: guildfetched.name, commands: guildapps.length }); - if (process.configs.servers != undefined && process.configs.servers[guild[0]]) { - // Add to number to toast at the end of this function. - actives++; - } - } - process.joinedguilds = guilds.slice(0); - - console.log(`Joined to ${process.joinedguilds.length} servers; active in ${actives} servers.`); -} - exports.generateConfigModal = generateConfigModal; exports.generateTextEntryModal = generateTextEntryModal; exports.generateUserEntryModal = generateUserEntryModal; diff --git a/functions/corsetfunctions.js b/functions/corsetfunctions.js index 1bf87621..f53c31a7 100644 --- a/functions/corsetfunctions.js +++ b/functions/corsetfunctions.js @@ -6,6 +6,7 @@ const { getBaseCorset } = require("./getters/corset/getBaseCorset"); const { getCorset } = require("./getters/corset/getCorset"); const { getHeadwear } = require("./getters/headwear/getHeadwear"); const { markForSave } = require("./other/markForSave"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam"); nlp.extend(nlpSpeech); @@ -131,7 +132,7 @@ const silenceReplacers = [" ", ".", ",", ""]; const silenceMessages = ["-# *Panting heavily*", "-# *Completely out of breath*", "-# *Desperately gasping for air*", "-# *About to pass out*"]; // Consumes breath and returns possibly modified text -function corsetLimitWords(text, parent, user, msgModified) { +function corsetLimitWords(text, parent, user, msgModified, serverID) { // just do nothing if no text if (text.length == 0 || text.match(/^\s*$/)) return text; @@ -250,8 +251,9 @@ function corsetLimitWords(text, parent, user, msgModified) { return outtext; } -// calculates current breath and returns corset. Does not save to file. -function calcBreath(user) { +// calculates current breath and returns corset. Does not save to file. (server id, user id) +function calcBreath(serverID, user) { + traceFirstParam(arguments[0]); const corset = getCorset(user); const basecorset = getBaseCorset(corset.type); if (!corset) return null; @@ -283,8 +285,9 @@ function calcBreath(user) { } // consumes specified breath and returns true if user had enough -function tryExpendBreath(user, exertion) { - const corset = calcBreath(user); +function tryExpendBreath(serverID, user, exertion) { + traceFirstParam(arguments[0]); + const corset = calcBreath(serverID, user); const basecorset = getBaseCorset(corset.type ?? "corset_leather"); corset.breath -= exertion; basecorset.afterUsingBreath({ userID: user, corset: corset }); diff --git a/functions/delvefunctions.js b/functions/delvefunctions.js index ef5ba1f9..c456ec6b 100644 --- a/functions/delvefunctions.js +++ b/functions/delvefunctions.js @@ -18,6 +18,7 @@ const { assignMitten } = require("./setters/mitten/assignMitten") const { modifyResolve } = require("./setters/delve/setResolve") const { getDelveFloorState } = require("./getters/delve/getDelveFloorState") const { markForSave } = require("./other/markForSave") +const { traceFirstParam } = require("./other/TESTS/traceFirstParam") /***************** * Players will utilize their condition as returned by gags, masks, heavy bondage and the like. @@ -438,7 +439,8 @@ const delveroomchoices = { * - (user ID) user - The user ID doing the delve * - (integer) floor - The floor number the user is visiting. *******/ -async function generateDelveModal(user, floor, incomingdelvedata) { +async function generateDelveModal(serverID, user, floor, incomingdelvedata) { + traceFirstParam(arguments[0]); let floordata = delveroomchoices[process.delveuserdata[user]?.floorarr[floor]] ?? delveroomchoices["errorroom"] let delveuserdata = process.delveuserdata[user] @@ -577,7 +579,8 @@ async function generateDelveModal(user, floor, incomingdelvedata) { * - (user id) user - User ID doing the Delve * - (integer) roomnumber - Number of rooms to select ********/ -function chooseNextRooms(user, roomnumber) { +function chooseNextRooms(serverID, user, roomnumber) { + traceFirstParam(arguments[0]); let rooms = {}; let forcerooms = {}; let outrooms = []; @@ -652,7 +655,8 @@ function arrayShuffle(arr) { * * - (user id) user - User ID doing the Delve *******/ -function delveModalStats(user) { +function delveModalStats(serverID, user) { + traceFirstParam(arguments[0]); let outtext = `**Player:** <@${user}>`; if (getResolve(user)) { outtext = `${outtext}\n**Resolve:** ${getResolve(user)}` diff --git a/functions/dollfunctions.js b/functions/dollfunctions.js index 0b5442fd..7372a848 100644 --- a/functions/dollfunctions.js +++ b/functions/dollfunctions.js @@ -4,6 +4,7 @@ const garble = require("garble"); const { getHeadwear } = require("./getters/headwear/getHeadwear.js"); const { getOption } = require("./getters/config/getOption.js"); const { markForSave } = require("./other/markForSave.js"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam.js"); // Regex to capture the user's intended text segments post-corset and post-vibrator. // NOTE: Code uses invisible EOT control characters to encapsulate additions from corset/vibrator. @@ -181,7 +182,8 @@ const dronecodes = { * Typical use: let dollified = checkDollification(userID) * @param userID - The user's discord ID number *************************************************/ -function checkDollification(userID) { +function checkDollification(serverID, userID) { + traceFirstParam(arguments[0]); if (process.dolls == undefined) { process.dolls = {}; } @@ -209,7 +211,8 @@ function checkDollification(userID) { * Determine if a user is wearing doll gear. * @param userID - The user's discord ID number **********************************************/ -function isValidDoll(userID) { +function isValidDoll(serverID, userID) { + traceFirstParam(arguments[0]); // TODO - Control harness + collar required for dollification? return getHeadwear(userID).find((headwear) => DOLLVISORS.includes(headwear)); @@ -219,7 +222,8 @@ function isValidDoll(userID) { * Reward a doll for following protocol. * @param userID - The user's discord ID number **********************************************/ -function rewardDoll(userID) { +function rewardDoll(serverID, userID) { + traceFirstParam(arguments[0]); if (process.dolls == undefined) { process.dolls = {}; } diff --git a/functions/gagfunctions.js b/functions/gagfunctions.js index bb3fec5b..a65675c6 100644 --- a/functions/gagfunctions.js +++ b/functions/gagfunctions.js @@ -25,6 +25,7 @@ const { getPFP } = require("./getters/config/getPFP.js"); const { convertPronounsText } = require("./other/convertPronounsText.js"); const { getAlternateName } = require("./getters/config/getAlternateName.js"); const { markForSave } = require("./other/markForSave.js"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam.js"); // Grab all the command files from the commands directory const gagtypes = []; @@ -86,7 +87,8 @@ function loadMittenTypes() { * @param userID - The user's discord ID number * @param amount - How many violations? **********************************************/ -function punishDoll(userID, amount) { +function punishDoll(serverID, userID, amount) { + traceFirstParam(arguments[0]); if (process.dolls == undefined) { process.dolls = {}; } diff --git a/functions/gamefunctions.js b/functions/gamefunctions.js index f1ddab36..a834508b 100644 --- a/functions/gamefunctions.js +++ b/functions/gamefunctions.js @@ -4,6 +4,7 @@ const https = require("https"); const { getCollar } = require("./getters/collar/getCollar"); const { getChastity } = require("./getters/chastity/getChastity"); const { getChastityBra } = require("./getters/chastity/getChastityBra"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam"); // Load the game files! function loadGames() { @@ -22,6 +23,7 @@ function loadGames() { // Applies an escrow on a user's restraint, preventing it from being transferred // or removed until the game state has been concluded. function placeEscrow(user, restraint, gameid) { + traceFirstParam(arguments[0]); if (process.games && process.games[gameid]) { if (restraint == "collar") { if (getCollar(user)) { @@ -43,6 +45,7 @@ function placeEscrow(user, restraint, gameid) { // Removes all restraints with gameid from user function removeEscrow(user, gameid) { + traceFirstParam(arguments[0]); if (process.games && process.games[gameid]) { if (getCollar(user) && (getCollar(user).escrow == gameid)) { getCollar(user).escrow = undefined; @@ -58,6 +61,7 @@ function removeEscrow(user, gameid) { // Rewards all restraint keys placed in escrow for the loser to the winner function rewardEscrow(winner, loser, gameid) { + traceFirstParam(arguments[0]); if (process.games && process.games[gameid]) { // Transfer the loser's keys to the winner if (getCollar(loser) && (getCollar(loser).escrow == gameid)) { @@ -83,6 +87,7 @@ function rewardEscrow(winner, loser, gameid) { // Creates a game object. Note that this does not start it until the .started param is added to the object, // which will be handled when prompting everyone that is invited to the game. function createGame(players, gametype, escrows, options) { + traceFirstParam(arguments[0]); let randomid = crypto.randomUUID(); // Generates a unique 32-bit UUID. let playerarr = (Array.isArray(players)) ? players : [players]; process.games[randomid] = { diff --git a/functions/getters/arousal/getArousal.js b/functions/getters/arousal/getArousal.js index a74d2293..538b805d 100644 --- a/functions/getters/arousal/getArousal.js +++ b/functions/getters/arousal/getArousal.js @@ -1,4 +1,5 @@ const { getProcessVariable } = require("../config/getProcessVariable"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* * Gets the user's current arousal @@ -9,6 +10,7 @@ const { getProcessVariable } = require("../config/getProcessVariable"); * ##### Returns a float representing the user's current arousal, or 0. */ function getArousal(serverID, user) { + traceFirstParam(arguments[0]); return getProcessVariable(serverID, user, "arousal").arousal ?? 0; } diff --git a/functions/getters/arousal/getArousalBar.js b/functions/getters/arousal/getArousalBar.js index 5ce0b205..2dd89b9f 100644 --- a/functions/getters/arousal/getArousalBar.js +++ b/functions/getters/arousal/getArousalBar.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { calcDenialCoefficient } = require("../../vibefunctions"); const { getArousal } = require("./getArousal"); @@ -12,7 +13,8 @@ const ORGASM_LIMIT = 10; * --- * ##### Returns a string representing a filled bar for arousal percentage **********/ -function getArousalBar(userID) { +function getArousalBar(serverID, userID) { + traceFirstParam(arguments[0]); const arousal = getArousal(serverID, userID); const denialCoefficient = calcDenialCoefficient(userID); const orgasmLimit = ORGASM_LIMIT; diff --git a/functions/getters/arousal/getArousalChangeDescription.js b/functions/getters/arousal/getArousalChangeDescription.js index 2c689949..351e0e46 100644 --- a/functions/getters/arousal/getArousalChangeDescription.js +++ b/functions/getters/arousal/getArousalChangeDescription.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getBotOption } = require("../config/getBotOption"); const { getOption } = require("../config/getOption"); const { getProcessVariable } = require("../config/getProcessVariable"); @@ -14,6 +15,7 @@ const ORGASM_LIMIT = 10; * ##### Returns a string representing their arousal change **********/ function getArousalChangeDescription(serverID, user) { + traceFirstParam(arguments[0]); if (getOption(user, "arousalsystem") != 2) return null; const arousal = getProcessVariable(serverID, user, "arousal"); diff --git a/functions/getters/arousal/getArousalDescription.js b/functions/getters/arousal/getArousalDescription.js index 993c5ca1..7850fcff 100644 --- a/functions/getters/arousal/getArousalDescription.js +++ b/functions/getters/arousal/getArousalDescription.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { calcDenialCoefficient } = require("../../vibefunctions"); const { getOption } = require("../config/getOption"); const { getArousal } = require("./getArousal"); @@ -16,6 +17,7 @@ const RESET_LIMIT = 0.1; * ##### Returns a string representing their arousal **********/ function getArousalDescription(serverID, user) { + traceFirstParam(arguments[0]); if (getOption(user, "arousalsystem") === 0) return null; // Disabled Arousal system const arousal = getArousal(serverID, user); diff --git a/functions/getters/arousal/getArousedTexts.js b/functions/getters/arousal/getArousedTexts.js index 9d22f010..13496b4a 100644 --- a/functions/getters/arousal/getArousedTexts.js +++ b/functions/getters/arousal/getArousedTexts.js @@ -1,4 +1,5 @@ const { arousedtexts } = require("../../../vibes/aroused/aroused_texts"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { calcStaticVibeIntensity } = require("../../vibefunctions"); const { getOption } = require("../config/getOption"); const { getProcessVariable } = require("../config/getProcessVariable"); @@ -12,6 +13,7 @@ const { getProcessVariable } = require("../config/getProcessVariable"); * ##### Returns an array of strings with aroused texts *********/ function getArousedTexts(serverID, user) { + traceFirstParam(arguments[0]); const texts = []; if (getOption(user, "arousalsystem") == 2) { diff --git a/functions/getters/chastity/canAccessChastity.js b/functions/getters/chastity/canAccessChastity.js index 37146a0d..c6c9c839 100644 --- a/functions/getters/chastity/canAccessChastity.js +++ b/functions/getters/chastity/canAccessChastity.js @@ -1,8 +1,10 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getChastity } = require("./getChastity"); /************ * Checks whether the keyholder has access to do things to the chastityuser. * + * - (server id) serverID - The server this is running on * - (user id) chastityuser - The User ID who is **wearing** the collar * - (user id) keyholder - The User ID who is **performing the action** * - (boolean) unlock - If this action involves unlocking and removing the collar @@ -13,7 +15,8 @@ const { getChastity } = require("./getChastity"); * - public: Is this action permitted because of public access? * - hasbelt: Is the **chastityuser** wearing a chastity belt? ************/ -function canAccessChastity(chastityuser, keyholder, unlock, cloning) { +function canAccessChastity(serverID, chastityuser, keyholder, unlock, cloning) { + traceFirstParam(arguments[0]); // As a reference for access in timelocks: // 0: "Everyone Else" // 1: "Keyholder Only" diff --git a/functions/getters/chastity/canAccessChastityBra.js b/functions/getters/chastity/canAccessChastityBra.js index 27d70c00..4fc95f1b 100644 --- a/functions/getters/chastity/canAccessChastityBra.js +++ b/functions/getters/chastity/canAccessChastityBra.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getChastityBra } = require("./getChastityBra"); /************ @@ -14,6 +15,7 @@ const { getChastityBra } = require("./getChastityBra"); * - hasbelt: Is the **chastityuser** wearing a chastity bra? ************/ function canAccessChastityBra(chastityuser, keyholder, unlock, cloning) { + traceFirstParam(arguments[0]); // As a reference for access in timelocks: // 0: "Everyone Else" // 1: "Keyholder Only" diff --git a/functions/getters/chastity/getChastity.js b/functions/getters/chastity/getChastity.js index 0b89d409..29797cbe 100644 --- a/functions/getters/chastity/getChastity.js +++ b/functions/getters/chastity/getChastity.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********* * Get the chastity belt that the user is wearing. * @@ -11,6 +13,7 @@ * ###### Additional properties may be added by other functions *********/ function getChastity(user) { + traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } diff --git a/functions/getters/chastity/getChastityBra.js b/functions/getters/chastity/getChastityBra.js index c658e6ee..579c10db 100644 --- a/functions/getters/chastity/getChastityBra.js +++ b/functions/getters/chastity/getChastityBra.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********* * Get the chastity bra that the user is wearing. * @@ -11,6 +13,7 @@ * ###### Additional properties may be added by other functions *********/ function getChastityBra(user) { + traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } diff --git a/functions/getters/chastity/getChastityBraKeyholder.js b/functions/getters/chastity/getChastityBraKeyholder.js index 64cfcabc..057f61ee 100644 --- a/functions/getters/chastity/getChastityBraKeyholder.js +++ b/functions/getters/chastity/getChastityBraKeyholder.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getChastityBra } = require("./getChastityBra"); /********** @@ -8,6 +9,7 @@ const { getChastityBra } = require("./getChastityBra"); * ##### Returns a string with the user ID of the primary keyholder for the user's chastity bra. **********/ function getChastityBraKeyholder(user) { + traceFirstParam(arguments[0]); return getChastityBra(user)?.keyholder; } diff --git a/functions/getters/chastity/getChastityBraKeys.js b/functions/getters/chastity/getChastityBraKeys.js index 929b7cc6..36e4744d 100644 --- a/functions/getters/chastity/getChastityBraKeys.js +++ b/functions/getters/chastity/getChastityBraKeys.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********** * Gets the currently held chastity bra keys by the user. * @@ -6,6 +8,7 @@ * ##### Returns an array of user IDs the user is the primary keyholder for. **********/ function getChastityBraKeys(user) { + traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } diff --git a/functions/getters/chastity/getChastityBraName.js b/functions/getters/chastity/getChastityBraName.js index 9d680a81..15925857 100644 --- a/functions/getters/chastity/getChastityBraName.js +++ b/functions/getters/chastity/getChastityBraName.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /************ * Gets the full chastity bra name of the User ID. Optionally will get the full chastity bra name of a chastity bra by ID. * @@ -10,6 +12,7 @@ * ###### Note: Needs rework into separate getChastityName and getChastityNameOnUser functions ************/ function getChastityBraName(userID, chastityname) { + traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } diff --git a/functions/getters/chastity/getChastityBraTimelock.js b/functions/getters/chastity/getChastityBraTimelock.js index d1b1bdd1..6ce37339 100644 --- a/functions/getters/chastity/getChastityBraTimelock.js +++ b/functions/getters/chastity/getChastityBraTimelock.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /*********** * Returns UNIX timestring of the wearer's unlock time for their chastity bra if they are timelocked. * @@ -7,6 +9,7 @@ * ##### Returns an integer with the unlockTime or a string with the unlock time for Discord. ***********/ function getChastityBraTimelock(user, UNIXTimestring) { + traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } diff --git a/functions/getters/chastity/getChastityKeyholder.js b/functions/getters/chastity/getChastityKeyholder.js index 76940ea8..871ec5c6 100644 --- a/functions/getters/chastity/getChastityKeyholder.js +++ b/functions/getters/chastity/getChastityKeyholder.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getChastity } = require("./getChastity"); /********** @@ -8,6 +9,7 @@ const { getChastity } = require("./getChastity"); * ##### Returns a string with the user ID of the primary keyholder for the user's chastity belt. **********/ function getChastityKeyholder(user) { + traceFirstParam(arguments[0]); return getChastity(user)?.keyholder; } diff --git a/functions/getters/chastity/getChastityKeys.js b/functions/getters/chastity/getChastityKeys.js index 72c608ef..118b9f1c 100644 --- a/functions/getters/chastity/getChastityKeys.js +++ b/functions/getters/chastity/getChastityKeys.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********** * Gets the currently held chastity belt keys by the user. * @@ -6,6 +8,7 @@ * ##### Returns an array of user IDs the user is the primary keyholder for. **********/ function getChastityKeys(user) { + traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } diff --git a/functions/getters/chastity/getChastityName.js b/functions/getters/chastity/getChastityName.js index 1698d064..eb60513b 100644 --- a/functions/getters/chastity/getChastityName.js +++ b/functions/getters/chastity/getChastityName.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /************ * Gets the full chastity belt name of the User ID. Optionally will get the full chastity belt name of a chastity belt by ID. * @@ -10,6 +12,7 @@ * ###### Note: Needs rework into separate getChastityName and getChastityNameOnUser functions ************/ function getChastityName(userID, chastityname) { + traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } diff --git a/functions/getters/chastity/getChastityTimelock.js b/functions/getters/chastity/getChastityTimelock.js index 7aba89ad..bf7bbf49 100644 --- a/functions/getters/chastity/getChastityTimelock.js +++ b/functions/getters/chastity/getChastityTimelock.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getChastity } = require("./getChastity"); /*********** @@ -9,6 +10,7 @@ const { getChastity } = require("./getChastity"); * ##### Returns an integer with the unlockTime or a string with the unlock time for Discord. ***********/ function getChastityTimelock(user, UNIXTimestring) { + traceFirstParam(arguments[0]); if (!UNIXTimestring) { return getChastity(user)?.unlockTime; } else { diff --git a/functions/getters/chastity/getClonedChastityBraKey.js b/functions/getters/chastity/getClonedChastityBraKey.js index 93c729b9..9338d9e6 100644 --- a/functions/getters/chastity/getClonedChastityBraKey.js +++ b/functions/getters/chastity/getClonedChastityBraKey.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getChastityBra } = require("./getChastityBra"); /********* @@ -8,6 +9,7 @@ const { getChastityBra } = require("./getChastityBra"); * ##### Returns an array of user IDs with secondary access to this collar. *********/ function getClonedChastityBraKey(userID) { + traceFirstParam(arguments[0]); return getChastityBra(userID)?.clonedKeyholders ?? []; }; diff --git a/functions/getters/chastity/getClonedChastityBraKeysOwned.js b/functions/getters/chastity/getClonedChastityBraKeysOwned.js index 5e1559fe..cbde19cf 100644 --- a/functions/getters/chastity/getClonedChastityBraKeysOwned.js +++ b/functions/getters/chastity/getClonedChastityBraKeysOwned.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /*********** * Gets a list of cloned chastity bra keys the user is holding. * @@ -6,6 +8,7 @@ * ##### Returns an array of held cloned chastity bra keys in the format "0000000000000000_chastitybra" ***********/ function getClonedChastityBraKeysOwned(userID) { + traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } diff --git a/functions/getters/chastity/getClonedChastityKey.js b/functions/getters/chastity/getClonedChastityKey.js index 76aa84d6..f6a1bf1b 100644 --- a/functions/getters/chastity/getClonedChastityKey.js +++ b/functions/getters/chastity/getClonedChastityKey.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getChastity } = require("./getChastity"); /********* @@ -8,6 +9,7 @@ const { getChastity } = require("./getChastity"); * ##### Returns an array of user IDs with secondary access to this collar. *********/ function getClonedChastityKey(userID) { + traceFirstParam(arguments[0]); return getChastity(userID)?.clonedKeyholders ?? []; }; diff --git a/functions/getters/chastity/getClonedChastityKeysOwned.js b/functions/getters/chastity/getClonedChastityKeysOwned.js index 2a06c77b..8ca46de0 100644 --- a/functions/getters/chastity/getClonedChastityKeysOwned.js +++ b/functions/getters/chastity/getClonedChastityKeysOwned.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /*********** * Gets a list of cloned chastity belt keys the user is holding. * @@ -6,6 +8,7 @@ * ##### Returns an array of held cloned chastity belt keys in the format "0000000000000000_chastitybelt" ***********/ function getClonedChastityKeysOwned(userID) { + traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } diff --git a/functions/getters/chastity/getCombinedTraits.js b/functions/getters/chastity/getCombinedTraits.js index 59cf3d3a..036a487e 100644 --- a/functions/getters/chastity/getCombinedTraits.js +++ b/functions/getters/chastity/getCombinedTraits.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getBaseChastity } = require("./getBaseChastity"); const { getChastity } = require("./getChastity"); const { getChastityBra } = require("./getChastityBra"); @@ -77,6 +78,7 @@ function bounded(min, val, max) { * - orgasmArousalLeft: Percentage of arousal that will be left on the wearer after letting go. ********/ function getCombinedTraits(user) { + traceFirstParam(arguments[0]); // Build an object which references the combined properties // Any FUNCTIONS will be called from both when their respective unlock is called. const beltbase = getChastity(user) ? getBaseChastity(getChastity(user).chastitytype ?? "belt_silver") : undefined; diff --git a/functions/getters/chastity/getOtherKeysChastity.js b/functions/getters/chastity/getOtherKeysChastity.js index 9657200b..0f875120 100644 --- a/functions/getters/chastity/getOtherKeysChastity.js +++ b/functions/getters/chastity/getOtherKeysChastity.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********** * Gets a combined list of cloned keys for chastity belts the userID is the primary keyholder for * @@ -7,6 +9,7 @@ * ##### is the person wearing the restraint, and the second set is the person holding the key clone. **********/ function getOtherKeysChastity(userID) { + traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } diff --git a/functions/getters/chastity/getOtherKeysChastityBra.js b/functions/getters/chastity/getOtherKeysChastityBra.js index b8a20211..d1376aaf 100644 --- a/functions/getters/chastity/getOtherKeysChastityBra.js +++ b/functions/getters/chastity/getOtherKeysChastityBra.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********** * Gets a combined list of cloned keys for chastity bras the userID is the primary keyholder for * @@ -7,6 +9,7 @@ * ##### is the person wearing the restraint, and the second set is the person holding the key clone. **********/ function getOtherKeysChastityBra(userID) { + traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } diff --git a/functions/getters/chastity/getVibeEquivalent.js b/functions/getters/chastity/getVibeEquivalent.js index a45041cc..a00081e5 100644 --- a/functions/getters/chastity/getVibeEquivalent.js +++ b/functions/getters/chastity/getVibeEquivalent.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { calcStaticVibeIntensity, calcFrustration } = require("../../vibefunctions"); const { getArousal } = require("../arousal/getArousal"); const { getOption } = require("../config/getOption"); @@ -14,6 +15,7 @@ const STUTTER_LIMIT = 1; * ##### Returns a value of arousal with their added frustration ***********/ function getVibeEquivalent(serverID, user) { + traceFirstParam(arguments[0]); if (getOption(user, "arousalsystem") != 2) return calcStaticVibeIntensity(user) * 2; let intensity = getArousal(serverID, user); diff --git a/functions/getters/collar/canAccessCollar.js b/functions/getters/collar/canAccessCollar.js index d483b5b8..d4b6cabe 100644 --- a/functions/getters/collar/canAccessCollar.js +++ b/functions/getters/collar/canAccessCollar.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getCollar } = require("./getCollar"); /************ @@ -14,6 +15,7 @@ const { getCollar } = require("./getCollar"); * - hascollar: Is the **collaruser** wearing a collar? ************/ function canAccessCollar(collaruser, keyholder, unlock, cloning) { + traceFirstParam(arguments[0]); // As a reference for access in timelocks: // 0: "Everyone Else" // 1: "Keyholder Only" diff --git a/functions/getters/collar/getClonedCollarKey.js b/functions/getters/collar/getClonedCollarKey.js index 9634a090..a3b9a258 100644 --- a/functions/getters/collar/getClonedCollarKey.js +++ b/functions/getters/collar/getClonedCollarKey.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getCollar } = require("./getCollar"); /********* @@ -8,6 +9,7 @@ const { getCollar } = require("./getCollar"); * ##### Returns an array of user IDs with secondary access to this collar. *********/ function getClonedCollarKey(collaruser) { + traceFirstParam(arguments[0]); return getCollar(collaruser)?.clonedKeyholders ?? []; } diff --git a/functions/getters/collar/getClonedCollarKeysOwned.js b/functions/getters/collar/getClonedCollarKeysOwned.js index e31a48e2..fc3af933 100644 --- a/functions/getters/collar/getClonedCollarKeysOwned.js +++ b/functions/getters/collar/getClonedCollarKeysOwned.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /*********** * Gets a list of cloned collar keys the user is holding. * @@ -6,6 +8,7 @@ * ##### Returns an array of held cloned collar keys in the format "0000000000000000_collar" ***********/ function getClonedCollarKeysOwned(userID) { + traceFirstParam(arguments[0]); if (process.collar == undefined) { process.collar = {}; } diff --git a/functions/getters/collar/getCollar.js b/functions/getters/collar/getCollar.js index 33d69d6e..4f7bfe9d 100644 --- a/functions/getters/collar/getCollar.js +++ b/functions/getters/collar/getCollar.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* * Gets the worn collar for a user. Returns the collar if it exists, or undefined if not. @@ -17,6 +18,7 @@ const { markForSave } = require("../../other/markForSave"); * ###### Additional properties may be added by other functions *********/ function getCollar(user) { + traceFirstParam(arguments[0]); if (process.collar == undefined) { process.collar = {}; } diff --git a/functions/getters/collar/getCollarKeyholder.js b/functions/getters/collar/getCollarKeyholder.js index 39b54422..5e3fe3f0 100644 --- a/functions/getters/collar/getCollarKeyholder.js +++ b/functions/getters/collar/getCollarKeyholder.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getCollar } = require("./getCollar"); /********** @@ -8,6 +9,7 @@ const { getCollar } = require("./getCollar"); * ##### Returns a string with the user ID of the primary keyholder for the user's collar. **********/ function getCollarKeyholder(user) { + traceFirstParam(arguments[0]); return getCollar(user)?.keyholder; } diff --git a/functions/getters/collar/getCollarKeys.js b/functions/getters/collar/getCollarKeys.js index 84846f89..5e6555fa 100644 --- a/functions/getters/collar/getCollarKeys.js +++ b/functions/getters/collar/getCollarKeys.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********** * Gets the currently held collar keys by the user. * @@ -6,6 +8,7 @@ * ##### Returns an array of user IDs the user is the primary keyholder for. **********/ function getCollarKeys(user) { + traceFirstParam(arguments[0]); if (process.collar == undefined) { process.collar = {}; } diff --git a/functions/getters/collar/getCollarName.js b/functions/getters/collar/getCollarName.js index b3bd0b81..e8715132 100644 --- a/functions/getters/collar/getCollarName.js +++ b/functions/getters/collar/getCollarName.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /************ * Gets the full collar name of the User ID. Optionally will get the full collar name of a collar by ID. * @@ -10,6 +12,7 @@ * ###### Note: Needs rework into separate getCollarName and getCollarNameOnUser functions ************/ function getCollarName(userID, collarid) { + traceFirstParam(arguments[0]); if (process.collar == undefined) { process.collar = {}; } diff --git a/functions/getters/collar/getCollarPerm.js b/functions/getters/collar/getCollarPerm.js index 1a962396..371e9b8a 100644 --- a/functions/getters/collar/getCollarPerm.js +++ b/functions/getters/collar/getCollarPerm.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getCollar } = require("./getCollar"); /******** @@ -9,6 +10,7 @@ const { getCollar } = require("./getCollar"); * ##### Returns a boolean if permission is allowed or not, or undefined if not specified. ********/ function getCollarPerm(user, perm) { + traceFirstParam(arguments[0]); return (getCollar(user) ? getCollar(user)[perm] : undefined) } diff --git a/functions/getters/collar/getCollarTimelock.js b/functions/getters/collar/getCollarTimelock.js index 01859bdc..28805f6c 100644 --- a/functions/getters/collar/getCollarTimelock.js +++ b/functions/getters/collar/getCollarTimelock.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getCollar } = require("./getCollar"); /*********** @@ -9,6 +10,7 @@ const { getCollar } = require("./getCollar"); * ##### Returns an integer with the unlockTime or a string with the unlock time for Discord. ***********/ function getCollarTimelock(user, UNIXTimestring) { + traceFirstParam(arguments[0]); if (!UNIXTimestring) { return getCollar(user)?.unlockTime; } else { diff --git a/functions/getters/collar/getOtherKeysCollar.js b/functions/getters/collar/getOtherKeysCollar.js index e4a760cb..7820ef40 100644 --- a/functions/getters/collar/getOtherKeysCollar.js +++ b/functions/getters/collar/getOtherKeysCollar.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********** * Gets a combined list of cloned keys for collars the userID is the primary keyholder for * @@ -7,6 +9,7 @@ * ##### is the person wearing the restraint, and the second set is the person holding the key clone. **********/ function getOtherKeysCollar(userID) { + traceFirstParam(arguments[0]); if (process.collar == undefined) { process.collar = {}; } diff --git a/functions/getters/config/getAllSelectedOption.js b/functions/getters/config/getAllSelectedOption.js index e155710b..b5cf2aae 100644 --- a/functions/getters/config/getAllSelectedOption.js +++ b/functions/getters/config/getAllSelectedOption.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********* * Fetches a list of all users setting for option mapped by user ID * @@ -6,6 +8,7 @@ * ##### Returns an object with keys corresponding to their set value *********/ function getAllSelectedOption(option) { + traceFirstParam(arguments[0]); let selectedoption = {}; if (process.configs && process.configs.users) { Object.keys(process.configs.users).forEach((user) => { diff --git a/functions/getters/config/getAlternateName.js b/functions/getters/config/getAlternateName.js index e44cbee8..01cae5be 100644 --- a/functions/getters/config/getAlternateName.js +++ b/functions/getters/config/getAlternateName.js @@ -1,4 +1,5 @@ const { DRONEVISORS, DOLLVISORS } = require("../../headwearfunctions"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getCollar } = require("../collar/getCollar"); const { getHeadwear } = require("../headwear/getHeadwear"); const { getOption } = require("./getOption"); @@ -12,6 +13,7 @@ const { getOption } = require("./getOption"); * ##### Returns a string, either modified or the user's display name **********/ function getAlternateName(user) { + traceFirstParam(arguments[0]); let outname = user.displayName // We're putting a member object in here // Handle pet collar name if ((getCollar(user.id)?.collartype == "collarengraved") || (getCollar(user.id) && getCollar(user.id).additionalcollars && getCollar(user.id).additionalcollars.includes("collarengraved"))) { diff --git a/functions/getters/config/getDisplayTexts.js b/functions/getters/config/getDisplayTexts.js index c7479ea4..9dcfb877 100644 --- a/functions/getters/config/getDisplayTexts.js +++ b/functions/getters/config/getDisplayTexts.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { calcDenialCoefficient } = require("../../vibefunctions"); const { getArousal } = require("../arousal/getArousal"); const { getArousalBar } = require("../arousal/getArousalBar"); @@ -18,6 +19,7 @@ const { getUserVar } = require("./getUserVar"); * ##### Returns a string to append to outfit modal with all of the additional widgets ************/ async function getDisplayTexts(serverID, userID, inspectuserID) { + traceFirstParam(arguments[0]); let bartext = ``; // ******************** Arousal Display diff --git a/functions/getters/config/getOption.js b/functions/getters/config/getOption.js index d50e6414..7b4ab265 100644 --- a/functions/getters/config/getOption.js +++ b/functions/getters/config/getOption.js @@ -1,6 +1,7 @@ const { configoptions } = require("../../../lists/configoptions"); const { initializeOptions } = require("../../other/initializeOptions"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Gets the configured option for the user ID as set in /config @@ -11,6 +12,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### Returns the exact value of that configured option. Will use default if user has not configured it. ********/ function getOption(userID, option) { + traceFirstParam(arguments[0]); if (process.configs == undefined) { process.configs = {}; } diff --git a/functions/getters/config/getOutfits.js b/functions/getters/config/getOutfits.js index 7f60c8e6..1f2a00f9 100644 --- a/functions/getters/config/getOutfits.js +++ b/functions/getters/config/getOutfits.js @@ -1,9 +1,12 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******* * Gets all of the outfits for the user. * * - (user id) userID - The user whose outfits to retrieve *******/ function getOutfits(userID) { + traceFirstParam(arguments[0]); if (process.outfits == undefined) { process.outfits = {}; } diff --git a/functions/getters/config/getPFP.js b/functions/getters/config/getPFP.js index 7d65827e..fcc5a455 100644 --- a/functions/getters/config/getPFP.js +++ b/functions/getters/config/getPFP.js @@ -1,6 +1,7 @@ const axios = require("axios"); const sharp = require("sharp"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Get the combined profile picture of the user, if their original one matches the one we have on file @@ -11,6 +12,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### Returns a string with the user's PFP URL to use **********/ async function getPFP(member, mods = []) { + traceFirstParam(arguments[0]); let imagelist = mods.slice(0); if (member.displayAvatarDecorationURL()) { imagelist.push(member.displayAvatarDecorationURL()) diff --git a/functions/getters/config/getProcessVariable.js b/functions/getters/config/getProcessVariable.js index aba43fee..a8a7a8bb 100644 --- a/functions/getters/config/getProcessVariable.js +++ b/functions/getters/config/getProcessVariable.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******* * Get the base object for a user. * @@ -8,6 +10,7 @@ * ##### Returns the object if it exists, undefined if it doesn't. *******/ function getProcessVariable(serverID, userID, processvar) { + traceFirstParam(arguments[0]); if (process[processvar] == undefined) { process[processvar] = {} } if (process[processvar][serverID] == undefined) { process[processvar][serverID] = {} } return process[processvar][serverID][userID] diff --git a/functions/getters/config/getPronouns.js b/functions/getters/config/getPronouns.js index 8f7da6de..148ff65e 100644 --- a/functions/getters/config/getPronouns.js +++ b/functions/getters/config/getPronouns.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { remindPronouns, pronounsMap } = require("../../pronounfunctions"); /******************************************** @@ -16,6 +17,7 @@ const { remindPronouns, pronounsMap } = require("../../pronounfunctions"); * ##### Returns a string with the user's pronoun in the appropriate tense *******************************************/ const getPronouns = (user, form, capitalize = false) => { + traceFirstParam(arguments[0]); if (process.pronouns == undefined) { process.pronouns = {}; } diff --git a/functions/getters/config/getPronounsSet.js b/functions/getters/config/getPronounsSet.js index af6923d0..58623b2f 100644 --- a/functions/getters/config/getPronounsSet.js +++ b/functions/getters/config/getPronounsSet.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******************************************** * Get a user's pronouns in typical slash format - Ex: "she/her" * ##### NOTE: "it/it" is grammatically correct, but repetitive. Opted for "it/its" as a stylistic choice. @@ -7,6 +9,7 @@ * ##### Returns a string with the user's standard pronoun representation *******************************************/ const getPronounsSet = (user) => { + traceFirstParam(arguments[0]); if (process.pronouns == undefined) { process.pronouns = {}; } diff --git a/functions/getters/config/getUserTags.js b/functions/getters/config/getUserTags.js index b577672f..2db10184 100644 --- a/functions/getters/config/getUserTags.js +++ b/functions/getters/config/getUserTags.js @@ -1,4 +1,5 @@ const { configoptions } = require("../../../lists/configoptions"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getOption } = require("./getOption"); @@ -11,6 +12,7 @@ const { getOption } = require("./getOption"); * ##### Returns an array of string tags to block or prefer *********/ function getUserTags(userID, preferred = false) { + traceFirstParam(arguments[0]); if (!userID) { return [] } let tags = []; let optionstocheck = Object.keys(configoptions.Content).map((t) => t.replace("wearabletags-", "")) diff --git a/functions/getters/config/getUserVar.js b/functions/getters/config/getUserVar.js index 50fb8f86..11beaf30 100644 --- a/functions/getters/config/getUserVar.js +++ b/functions/getters/config/getUserVar.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********** * Gets a temporary user variable by key * @@ -7,6 +9,7 @@ * ##### Returns the value of the key **********/ function getUserVar(user, key) { + traceFirstParam(arguments[0]); if (process.usercontext == undefined) { process.usercontext = {}; } diff --git a/functions/getters/config/getUsersWithOption.js b/functions/getters/config/getUsersWithOption.js index 44883ce2..25950840 100644 --- a/functions/getters/config/getUsersWithOption.js +++ b/functions/getters/config/getUsersWithOption.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********* * Fetches a list of all user IDs where option == value * @@ -7,6 +9,7 @@ * ##### Returns an array of user IDs that have selected that value for that option. *********/ function getUsersWithOption(option, value) { + traceFirstParam(arguments[0]); let userswithval = []; if (process.configs && process.configs.users) { Object.keys(process.configs.users).forEach((user) => { diff --git a/functions/getters/config/statsGetAllStat.js b/functions/getters/config/statsGetAllStat.js index 92df892a..366de179 100644 --- a/functions/getters/config/statsGetAllStat.js +++ b/functions/getters/config/statsGetAllStat.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********* * Generates an array with users mapped to their count in a stat. * ##### This is not sorted, presented as [userid, stat]. Sort with .sort((a,b) => { return a[1] - b[1]}) @@ -7,6 +9,7 @@ * ##### Returns an array with array pairs of user IDs and stats, [userid, stat] *********/ function statsGetAllStat(stat) { + traceFirstParam(arguments[0]); let selectedoption = []; if (process.userstats) { Object.keys(process.userstats).forEach((user) => { diff --git a/functions/getters/config/statsGetCounter.js b/functions/getters/config/statsGetCounter.js index d1f63f57..e1a3e358 100644 --- a/functions/getters/config/statsGetCounter.js +++ b/functions/getters/config/statsGetCounter.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********** * Get the counter for a user by name. * @@ -7,6 +9,7 @@ * ##### Returns the current value of the counter for the user **********/ function statsGetCounter(user, countername) { + traceFirstParam(arguments[0]); if (process.userstats == undefined) { process.userstats = {} } if (process.userstats[user] == undefined) { process.userstats[user] = {} } return process.userstats[user][countername]; diff --git a/functions/getters/corset/getBreath.js b/functions/getters/corset/getBreath.js index 99ee1fa5..9cc89c09 100644 --- a/functions/getters/corset/getBreath.js +++ b/functions/getters/corset/getBreath.js @@ -1,5 +1,6 @@ const { calcBreath } = require("../../corsetfunctions"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### Returns the calculated breath of the user *********/ function getBreath(user) { + traceFirstParam(arguments[0]); const corset = calcBreath(user); markForSave("corset"); return corset.breath; diff --git a/functions/getters/corset/getCorset.js b/functions/getters/corset/getCorset.js index 624d5a8a..a007df7c 100644 --- a/functions/getters/corset/getCorset.js +++ b/functions/getters/corset/getCorset.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********* * Gets the worn corset for a user. Returns the corset if it exists, or undefined if not. * @@ -12,6 +14,7 @@ * ###### Additional properties may be added by other functions *********/ function getCorset(user) { + traceFirstParam(arguments[0]); if (process.corset == undefined) process.corset = {}; return process.corset[user]; } diff --git a/functions/getters/corset/getCorsetBinder.js b/functions/getters/corset/getCorsetBinder.js index f6cddecd..27c19bb1 100644 --- a/functions/getters/corset/getCorsetBinder.js +++ b/functions/getters/corset/getCorsetBinder.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getCorset } = require("./getCorset"); /********** @@ -8,6 +9,7 @@ const { getCorset } = require("./getCorset"); * ##### Returns the user ID of the person who put this corset on the wearer. **********/ function getCorsetBinder(user) { + traceFirstParam(arguments[0]); return getCorset(user)?.origbinder; } diff --git a/functions/getters/delve/getCurrentFloor.js b/functions/getters/delve/getCurrentFloor.js index 501f90b7..4357e1f2 100644 --- a/functions/getters/delve/getCurrentFloor.js +++ b/functions/getters/delve/getCurrentFloor.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******** * Gets the current floor the user is on. * @@ -6,6 +8,7 @@ * ##### Returns undefined if they're not on a delve, 0 if at delve entrance, or an integer floor number ********/ function getCurrentFloor(user) { + traceFirstParam(arguments[0]); if (process.delveuserdata == undefined) { process.delveuserdata = {} } if (process.delveuserdata[user]) { // They started a delve, return the floor diff --git a/functions/getters/delve/getDelveFloorState.js b/functions/getters/delve/getDelveFloorState.js index d162a366..61b76f77 100644 --- a/functions/getters/delve/getDelveFloorState.js +++ b/functions/getters/delve/getDelveFloorState.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******* * Get a floor's props. * @@ -9,6 +11,7 @@ * ##### Returns the current floordata for the floor *******/ function getDelveFloorState(user, floor) { + traceFirstParam(arguments[0]); if (process.delveuserdata == undefined) { process.delveuserdata = {} } if (process.delveuserdata[user]) { // They started a delve, now check what floor they're on diff --git a/functions/getters/delve/getDelvePlayerStats.js b/functions/getters/delve/getDelvePlayerStats.js index ea8385a7..64939971 100644 --- a/functions/getters/delve/getDelvePlayerStats.js +++ b/functions/getters/delve/getDelvePlayerStats.js @@ -1,9 +1,12 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******* * Get delve player stats. Otherwise, create a template for the player. * * - (user id) user - User ID doing the Delve *******/ function getDelvePlayerStats(user) { + traceFirstParam(arguments[0]); if (process.delveuserstats == undefined) { process.delveuserstats = {} } if (process.delveuserstats[user] == undefined) { // Create a template if it does not exist. diff --git a/functions/getters/delve/getResolve.js b/functions/getters/delve/getResolve.js index d80ba833..b35bf1ab 100644 --- a/functions/getters/delve/getResolve.js +++ b/functions/getters/delve/getResolve.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******* * Gets the user's current Resolve * @@ -6,6 +8,7 @@ * ##### Returns an integer with the current resolve of the user *******/ function getResolve(user) { + traceFirstParam(arguments[0]); if (process.delveuserdata == undefined) { process.delveuserdata = {} } if (process.delveuserdata[user]) { // They started a delve, return their current resolve diff --git a/functions/getters/gag/getGag.js b/functions/getters/gag/getGag.js index 63fa43b9..27bb90b1 100644 --- a/functions/getters/gag/getGag.js +++ b/functions/getters/gag/getGag.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********** * Gets the first worn gag for the user ID, or the specific gag by type if specified * @@ -11,6 +13,7 @@ * - origbinder: Who put the gag on the user **********/ function getGag(serverID, userID, gagbyname) { + traceFirstParam(arguments[0]); if (process.gags == undefined) { process.gags = {}; } diff --git a/functions/getters/gag/getGagBinder.js b/functions/getters/gag/getGagBinder.js index 2b112081..98470020 100644 --- a/functions/getters/gag/getGagBinder.js +++ b/functions/getters/gag/getGagBinder.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getGag } = require("./getGag"); /***** @@ -10,6 +11,7 @@ const { getGag } = require("./getGag"); * ##### Returns the user ID who put the gag on them *****/ function getGagBinder(serverID, userID, item) { + traceFirstParam(arguments[0]); return getGag(serverID, userID, item)?.origbinder; } diff --git a/functions/getters/gag/getGagIntensity.js b/functions/getters/gag/getGagIntensity.js index a21dcdf1..8b636457 100644 --- a/functions/getters/gag/getGagIntensity.js +++ b/functions/getters/gag/getGagIntensity.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getGag } = require("./getGag"); /******** @@ -9,6 +10,7 @@ const { getGag } = require("./getGag"); * ##### Returns the intensity of the first gag ********/ function getGagIntensity(serverID, userID) { + traceFirstParam(arguments[0]); return getGag(serverID, userID)?.intensity; } diff --git a/functions/getters/gag/getGagLast.js b/functions/getters/gag/getGagLast.js index 81810648..cd5aafc8 100644 --- a/functions/getters/gag/getGagLast.js +++ b/functions/getters/gag/getGagLast.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******** * Gets the last worn (top most) gag for a user. * @@ -10,6 +12,7 @@ * - origbinder: Who put the gag on the user ********/ function getGagLast(serverID, userID) { + traceFirstParam(arguments[0]); if (process.gags == undefined) { process.gags = {}; } diff --git a/functions/getters/gag/getGags.js b/functions/getters/gag/getGags.js index 738a9870..5fb54d32 100644 --- a/functions/getters/gag/getGags.js +++ b/functions/getters/gag/getGags.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******* * Get all of the gags worn by the user ID * @@ -7,6 +9,7 @@ * ##### Returns an array of gag objects *******/ function getGags(serverID, userID) { + traceFirstParam(arguments[0]); if (process.gags == undefined) { process.gags = {}; } diff --git a/functions/getters/headwear/getHeadwear.js b/functions/getters/headwear/getHeadwear.js index 8fad013d..e6fcde64 100644 --- a/functions/getters/headwear/getHeadwear.js +++ b/functions/getters/headwear/getHeadwear.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******* * Get the worn headwear for a user * @@ -6,6 +8,7 @@ * ##### Returns an array with string item IDs the user is wearing *******/ function getHeadwear(userID) { + traceFirstParam(arguments[0]); if (process.headwear == undefined) { process.headwear = {}; } diff --git a/functions/getters/headwear/getHeadwearBinder.js b/functions/getters/headwear/getHeadwearBinder.js index b66bc1ce..e10e1a85 100644 --- a/functions/getters/headwear/getHeadwearBinder.js +++ b/functions/getters/headwear/getHeadwearBinder.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******** * Gets the person who put a piece of headwear on the user * @@ -7,6 +9,7 @@ * ##### Returns the user ID who put this headgear on the wearer ********/ function getHeadwearBinder(userID, item) { + traceFirstParam(arguments[0]); if (process.headwear == undefined) { process.headwear = {}; } diff --git a/functions/getters/headwear/getHeadwearName.js b/functions/getters/headwear/getHeadwearName.js index 177b50b1..2d9cb4fe 100644 --- a/functions/getters/headwear/getHeadwearName.js +++ b/functions/getters/headwear/getHeadwearName.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getBaseHeadwear } = require("./getBaseHeadwear"); /********** @@ -11,6 +12,7 @@ const { getBaseHeadwear } = require("./getBaseHeadwear"); * #### This needs cleanup to remove the userID param as it is not used! **********/ function getHeadwearName(userID, headnname) { + traceFirstParam(arguments[0]); if (process.headwear == undefined) { process.headwear = {}; } diff --git a/functions/getters/headwear/getHeadwearRestrictions.js b/functions/getters/headwear/getHeadwearRestrictions.js index 7912264e..427d9a44 100644 --- a/functions/getters/headwear/getHeadwearRestrictions.js +++ b/functions/getters/headwear/getHeadwearRestrictions.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getHeadwearBlocks } = require("./getBaseHeadwear"); const { getHeadwear } = require("./getHeadwear"); @@ -11,6 +12,7 @@ const { getHeadwear } = require("./getHeadwear"); * - canInspect: The user is able to view details in /inspect ***********/ function getHeadwearRestrictions(userID) { + traceFirstParam(arguments[0]); let allowedperms = { canEmote: true, canInspect: true, forcedtextemoji: false }; let wornheadwear = getHeadwear(userID); for (let i = 0; i < wornheadwear.length; i++) { diff --git a/functions/getters/headwear/getLockedHeadgear.js b/functions/getters/headwear/getLockedHeadgear.js index 997123df..e05cd959 100644 --- a/functions/getters/headwear/getLockedHeadgear.js +++ b/functions/getters/headwear/getLockedHeadgear.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******* * Gets the protected headgear (/item protect) for the user. * @@ -6,6 +8,7 @@ * ##### Returns an array of string item IDs designated as protected with /item protect *******/ function getLockedHeadgear(userID) { + traceFirstParam(arguments[0]); if (process.headwear == undefined) { process.headwear = {}; } diff --git a/functions/getters/heavy/getHeavy.js b/functions/getters/heavy/getHeavy.js index a0046b13..2479bf0a 100644 --- a/functions/getters/heavy/getHeavy.js +++ b/functions/getters/heavy/getHeavy.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getBaseHeavy } = require("./getBaseHeavy"); /********* @@ -13,6 +14,7 @@ const { getBaseHeavy } = require("./getBaseHeavy"); * - namedcontainerowner?: User ID included in container checks *********/ function getHeavy(user, type) { + traceFirstParam(arguments[0]); if (process.heavy == undefined) { process.heavy = {}; } diff --git a/functions/getters/heavy/getHeavyBinder.js b/functions/getters/heavy/getHeavyBinder.js index 331cf61d..a49250f4 100644 --- a/functions/getters/heavy/getHeavyBinder.js +++ b/functions/getters/heavy/getHeavyBinder.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getHeavy } = require("./getHeavy"); /******** @@ -9,6 +10,7 @@ const { getHeavy } = require("./getHeavy"); * ##### Returns a user ID who put this heavy bondage on the user. ********/ function getHeavyBinder(user, type) { + traceFirstParam(arguments[0]); if (getHeavy(user)) { if (type) { return getHeavy(user, type)?.origbinder diff --git a/functions/getters/heavy/getHeavyBound.js b/functions/getters/heavy/getHeavyBound.js index 066ec6d9..6de1be7c 100644 --- a/functions/getters/heavy/getHeavyBound.js +++ b/functions/getters/heavy/getHeavyBound.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getHeavy } = require("./getHeavy"); const { getHeavyRestrictions } = require("./getHeavyRestrictions"); @@ -10,6 +11,7 @@ const { getHeavyRestrictions } = require("./getHeavyRestrictions"); * ##### Returns true if the user is able to bind the target, false if not **********/ function getHeavyBound(user, target) { + traceFirstParam(arguments[0]); if (getHeavy(user) == undefined) { return true; // No need to worry, they are able to do anything! } diff --git a/functions/getters/heavy/getHeavyList.js b/functions/getters/heavy/getHeavyList.js index 25505300..c1b94d7a 100644 --- a/functions/getters/heavy/getHeavyList.js +++ b/functions/getters/heavy/getHeavyList.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********* * Get a list of the heavy bondage worn by the user * @@ -10,6 +12,7 @@ * - namedcontainerowner?: User ID included in container checks *********/ function getHeavyList(user) { + traceFirstParam(arguments[0]); if (process.heavy == undefined) { process.heavy = {}; } diff --git a/functions/getters/heavy/getHeavyRestrictions.js b/functions/getters/heavy/getHeavyRestrictions.js index 14bf660a..dad478e7 100644 --- a/functions/getters/heavy/getHeavyRestrictions.js +++ b/functions/getters/heavy/getHeavyRestrictions.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getUserVar } = require("../config/getUserVar"); const { getBaseHeavy } = require("./getBaseHeavy"); const { getHeavy } = require("./getHeavy"); @@ -14,6 +15,7 @@ const { getHeavy } = require("./getHeavy"); * - touchlist?: If specified, an array of users the user can do actions to *******/ function getHeavyRestrictions(user) { + traceFirstParam(arguments[0]); let returnobject = { heavytags: [], touchself: true, diff --git a/functions/getters/heavy/getHeavyTagsOnUser.js b/functions/getters/heavy/getHeavyTagsOnUser.js index 94870135..6f8a0160 100644 --- a/functions/getters/heavy/getHeavyTagsOnUser.js +++ b/functions/getters/heavy/getHeavyTagsOnUser.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getBaseHeavy } = require("./getBaseHeavy"); const { getHeavyList } = require("./getHeavyList"); @@ -9,6 +10,7 @@ const { getHeavyList } = require("./getHeavyList"); * ##### Returns an array of "arms", "legs", or "container" *********/ function getHeavyTagsOnUser(user) { + traceFirstParam(arguments[0]); if (getHeavyList(user) == undefined) { return []; // They're not bound by anything lol } diff --git a/functions/getters/mitten/getMitten.js b/functions/getters/mitten/getMitten.js index 38d412b7..7aa2e8ec 100644 --- a/functions/getters/mitten/getMitten.js +++ b/functions/getters/mitten/getMitten.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /****** * Gets the currently worn mittens for a user. * @@ -8,6 +10,7 @@ * - origbinder: The person who put the mittens on the user ******/ function getMitten(userID) { + traceFirstParam(arguments[0]); if (process.mitten == undefined) { process.mitten = {}; } diff --git a/functions/getters/mitten/getMittenName.js b/functions/getters/mitten/getMittenName.js index 8281fff4..1646e616 100644 --- a/functions/getters/mitten/getMittenName.js +++ b/functions/getters/mitten/getMittenName.js @@ -1,4 +1,5 @@ const { mittentypes } = require("../../gagfunctions"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /************ * Gets the full mitten name of the User ID. Optionally will get the full mitten name of mittens by ID. @@ -12,6 +13,7 @@ const { mittentypes } = require("../../gagfunctions"); * ###### Note: Needs rework into separate getMittenName and getMittenNameOnUser functions ************/ function getMittenName(userID, mittenname) { + traceFirstParam(arguments[0]); if (process.mitten == undefined) { process.mitten = {}; } diff --git a/functions/getters/toy/canPlaceToy.js b/functions/getters/toy/canPlaceToy.js index 96de518c..27a8fcf4 100644 --- a/functions/getters/toy/canPlaceToy.js +++ b/functions/getters/toy/canPlaceToy.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******** * Check if a toy by ID can be placed on the target by the user * @@ -8,6 +10,7 @@ * ##### Returns true if the toy is permitted to be placed ********/ function canPlaceToy(userID, placerID, toy) { + traceFirstParam(arguments[0]); return (process.toytypes && process.toytypes[toy] && process.toytypes[toy].canEquip({ userID: userID, placerID: placerID })) } diff --git a/functions/getters/toy/canRemoveToy.js b/functions/getters/toy/canRemoveToy.js index ed036f64..1e1b3df6 100644 --- a/functions/getters/toy/canRemoveToy.js +++ b/functions/getters/toy/canRemoveToy.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******** * Check if a toy by ID can be removed from the target by the user * @@ -8,6 +10,7 @@ * ##### Returns true if the toy is permitted to be placed ********/ function canRemoveToy(userID, placerID, toy) { + traceFirstParam(arguments[0]); return (process.toytypes && process.toytypes[toy] && process.toytypes[toy].canUnequip({ userID: userID, placerID: placerID })) } diff --git a/functions/getters/toy/getSpecificToy.js b/functions/getters/toy/getSpecificToy.js index a8d021d9..f55c2f6e 100644 --- a/functions/getters/toy/getSpecificToy.js +++ b/functions/getters/toy/getSpecificToy.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getToys } = require("./getToys"); /********** @@ -12,6 +13,7 @@ const { getToys } = require("./getToys"); * - origbinder: The user ID who put the toy on the user **********/ function getSpecificToy(user, toytype) { + traceFirstParam(arguments[0]); return getToys(user).find((toy) => toy.type == toytype); } diff --git a/functions/getters/toy/getToys.js b/functions/getters/toy/getToys.js index 0a114117..3c2837eb 100644 --- a/functions/getters/toy/getToys.js +++ b/functions/getters/toy/getToys.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********** * Gets all of the toys that a user is wearing * @@ -9,6 +11,7 @@ * - origbinder: The user ID who put the toy on the user **********/ function getToys(user) { + traceFirstParam(arguments[0]); if (process.toys == undefined) { process.toys = {} } if (process.toys[user] == undefined) { process.toys[user] = [] } return process.toys[user]; diff --git a/functions/getters/toy/userBlockArousingToy.js b/functions/getters/toy/userBlockArousingToy.js index cc22e1af..a127618a 100644 --- a/functions/getters/toy/userBlockArousingToy.js +++ b/functions/getters/toy/userBlockArousingToy.js @@ -1,3 +1,4 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getOption } = require("../config/getOption"); /******** @@ -9,6 +10,7 @@ const { getOption } = require("../config/getOption"); * ##### Returns true if the user has arousal disabled and the toy is arousing, false if permitted or the toy isnt arousing ********/ function userBlockArousingToy(user, toy) { + traceFirstParam(arguments[0]); if (toy && (getOption(user, "arousalsystem") == 0) && (process.toytypes[toy].isArousing())) { return true; // Do not add a toy that can increase arousal, thats bad. } diff --git a/functions/getters/wearable/getLockedWearable.js b/functions/getters/wearable/getLockedWearable.js index 73ba94de..ea41e44a 100644 --- a/functions/getters/wearable/getLockedWearable.js +++ b/functions/getters/wearable/getLockedWearable.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********** * Gets a list of locked clothing the user is currently wearing * @@ -6,6 +8,7 @@ * ##### Returns an array with strings of wearable item IDs **********/ function getLockedWearable(userID) { + traceFirstParam(arguments[0]); if (process.wearable == undefined) { process.wearable = {}; } diff --git a/functions/getters/wearable/getWearable.js b/functions/getters/wearable/getWearable.js index 312ccff4..0cbeef61 100644 --- a/functions/getters/wearable/getWearable.js +++ b/functions/getters/wearable/getWearable.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /********** * Gets a list of clothing the user is currently wearing * @@ -6,6 +8,7 @@ * ##### Returns an array with strings of wearable item IDs **********/ function getWearable(userID) { + traceFirstParam(arguments[0]); if (process.wearable == undefined) { process.wearable = {}; } diff --git a/functions/getters/wearable/getWearableName.js b/functions/getters/wearable/getWearableName.js index ca50c25c..a99d0070 100644 --- a/functions/getters/wearable/getWearableName.js +++ b/functions/getters/wearable/getWearableName.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /************ * Gets the full wearable name of the User ID. Optionally will get the full wearable name of a wearable by ID. * @@ -10,6 +12,7 @@ * ###### Note: Needs rework to remove the first param and just use wearablename ************/ function getWearableName(userID, wearablename) { + traceFirstParam(arguments[0]); if (process.wearable == undefined) { process.wearable = {}; } diff --git a/functions/headwearfunctions.js b/functions/headwearfunctions.js index 47984204..d793da39 100644 --- a/functions/headwearfunctions.js +++ b/functions/headwearfunctions.js @@ -6,6 +6,7 @@ const { forcedtextemoji } = require("../headwear/doll_visor.js"); const { getHeadwearRestrictions } = require("./getters/headwear/getHeadwearRestrictions.js"); const { getHeadwear } = require("./getters/headwear/getHeadwear.js"); const { getHeadwearBlocks } = require("./getters/headwear/getBaseHeadwear.js"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam.js"); /* // This can probably be retired - leaving here for reference const headweartypes = [ @@ -112,7 +113,8 @@ const replaceEmoji = (text, parent, replaceEmoji, msgModified, matchFound) => { } } // Removes all emoji, optionally using an assigned emoji if they are wearing a mask with it! -const processHeadwearEmoji = (userID, msgTree, msgModified, dollvisoroverride) => { +const processHeadwearEmoji = (serverID, userID, msgTree, msgModified, dollvisoroverride) => { + traceFirstParam(arguments[0]); // Do nothing if no headwear blocks. if (getHeadwearRestrictions(userID).canEmote) {return;} @@ -297,7 +299,8 @@ const truthgasopposites = (text, parent, msgModified) => { return outtext.slice(1) // Cut the leading space } // Changes words and negates them -const processHeadwearTruthgas = (userID, msgTree, msgModified) => { +const processHeadwearTruthgas = (serverID, userID, msgTree, msgModified) => { + traceFirstParam(arguments[0]); // Do nothing if no headwear blocks. if (!getHeadwear(userID).includes("gasmask_truthgas")) { return } diff --git a/functions/interactivefunctions.js b/functions/interactivefunctions.js index 0fb76000..d3881abc 100644 --- a/functions/interactivefunctions.js +++ b/functions/interactivefunctions.js @@ -34,6 +34,7 @@ const { getGags } = require("./getters/gag/getGags.js"); const { getWearable } = require("./getters/wearable/getWearable.js"); const { getToys } = require("./getters/toy/getToys.js"); const { configoptions } = require("../lists/configoptions.js"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam.js"); // Generates a consent button which the user will have to agree to. const consentMessage = (interaction, user) => { @@ -635,7 +636,8 @@ function checkBondageRemoval(serverID, userID, targetID, type, item) { return false; } -async function handleBondageRemoval(user, target, type, change = false) { +async function handleBondageRemoval(serverID, user, target, type, change = false) { + traceFirstParam(arguments[0]); return new Promise(async (res, rej) => { try { let buttons = [new ButtonBuilder().setCustomId("denyButton").setLabel("Deny").setStyle(ButtonStyle.Danger), new ButtonBuilder().setCustomId("acceptButton").setLabel("Allow").setStyle(ButtonStyle.Success)]; @@ -684,7 +686,8 @@ async function handleBondageRemoval(user, target, type, change = false) { })*/ } -async function handleExtremeRestraint(user, target, type, restraint) { +async function handleExtremeRestraint(serverID, user, target, type, restraint) { + traceFirstParam(arguments[0]); return new Promise(async (res, rej) => { // cull out multiple styles of the same kind, this is used for things like Gag Harness to group multiple headpieces. let origrestraint = restraint @@ -778,6 +781,7 @@ async function handleExtremeRestraint(user, target, type, restraint) { // Will never be available for collars. // Will ALWAYS nag the user unless they're collared for that respective restraint. async function handleMajorRestraint(user, target, type, restraint) { + traceFirstParam(arguments[0]); return new Promise(async (res, rej) => { let hasOption = getOption(target.id, `majorrestraint`); if (canAccessCollar(target.id, user.id).access) { @@ -1012,7 +1016,8 @@ function generateListTexts() { } // Generates a message box with buttons to give keys for a user to a target, and listing all valid keys along with current cloned keyholders. -async function generateKeyGivingModal(userid, weareridin, targetidin, keybitin) { +async function generateKeyGivingModal(serverID, userid, weareridin, targetidin, keybitin) { + traceFirstParam(arguments[0]); let wearerid = weareridin ?? userid; let targetid = targetidin ?? userid; let keybit = keybitin ?? "0000"; // first character is give/clone, second, third and fourth are chastity, chastity bra and collar. diff --git a/functions/keyfindingfunctions.js b/functions/keyfindingfunctions.js index 99b65e40..d898d41a 100644 --- a/functions/keyfindingfunctions.js +++ b/functions/keyfindingfunctions.js @@ -18,11 +18,13 @@ const { getBaseCollar } = require("./getters/collar/getBaseCollar"); const { statsAddCounter } = require("./setters/config/statsAddCounter"); const { getTextGeneric } = require("./textfunctions"); const { markForSave } = require("./other/markForSave"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam"); const MAX_FUMBLE_CHANCE = 0.95; // returns how heavy the fumble was (usually 1 = regular, 2 = drop key) -function rollKeyFumble(keyholder, locked) { +function rollKeyFumble(serverID, keyholder, locked) { + traceFirstParam(arguments[0]); if (process.keyfumbling == undefined) { process.keyfumbling = {}; } @@ -85,6 +87,7 @@ function rollKeyFumble(keyholder, locked) { } function getFumbleChance(serverID, keyholder, locked) { + traceFirstParam(arguments[0]); // cannot fumble if disabled if (getOption(locked, "fumbling") == "disabled") return 0; // ... or if not using the dynamic arousal system diff --git a/functions/other/TESTS/traceFirstParam.js b/functions/other/TESTS/traceFirstParam.js new file mode 100644 index 00000000..d2f54312 --- /dev/null +++ b/functions/other/TESTS/traceFirstParam.js @@ -0,0 +1,27 @@ +// This is a test function that should be removed once all the code has been tested. Eventually. +// This will test the first param given to a function scope and throw if it is NOT a server ID. +// This is attached to all getter and setter functions. The first line in the function execution should be: +// +// traceFirstParam(arguments[0]); + +/******* + * Test first param to see if it is on process.serversjoined. If it is not, do a client.guilds.fetch() on it. If that fails, throw. + * + * - (any) serverID - Hopefully a server ID + * --- + * ##### Returns true if it is a server ID, crashes if it's not. + *******/ +function traceFirstParam(serverID) { + if (process.serversjoined == undefined) { process.serversjoined = [] } + if (!process.serversjoined.includes(serverID)) { + process.client.guilds.fetch(serverID).then((g) => { + process.serversjoined.push(serverID); + }) + .catch((err) => { + console.error(`Invalid server ID ${serverID}!`) + throw new Error(err) + }) + } +} + +exports.traceFirstParam = traceFirstParam; \ No newline at end of file diff --git a/functions/outfitfunctions.js b/functions/outfitfunctions.js index e554936e..fb6a4589 100644 --- a/functions/outfitfunctions.js +++ b/functions/outfitfunctions.js @@ -50,6 +50,7 @@ const { getClonedChastityBraKeysOwned } = require("./getters/chastity/getClonedC const { getClonedCollarKeysOwned } = require("./getters/collar/getClonedCollarKeysOwned"); async function generateOutfitModal(serverID, userID, menu, page, options) { + traceFirstParam(arguments[0]); let pagecomponents = [new TextDisplayBuilder().setContent(`## Outfitter - ${menu.slice(0, 1).toUpperCase()}${menu.slice(1)}`)]; let tabbuttons = [ // Restore @@ -516,6 +517,7 @@ function outfitEntryModal(interaction, slot) { } async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { + traceFirstParam(arguments[0]); let inspectuserID = inspectuserIDin ?? userID; let profilelink = (getOption(inspectuserID, "profilelink") && getOption(inspectuserID, "profilelink").length > 0) ? ` • [Profile](${getOption(inspectuserID, "profilelink")})` : `` let kinklistlink = (getOption(inspectuserID, "kinklistlink") && getOption(inspectuserID, "kinklistlink").length > 0) ? ` • [Kink List](${getOption(inspectuserID, "kinklistlink")})` : `` diff --git a/functions/pronounfunctions.js b/functions/pronounfunctions.js index 8cb0ad0a..c6516eee 100644 --- a/functions/pronounfunctions.js +++ b/functions/pronounfunctions.js @@ -2,6 +2,7 @@ const { ButtonBuilder } = require("@discordjs/builders"); const { ButtonStyle, ComponentType } = require("discord.js"); const { ActionRowBuilder } = require("@discordjs/builders"); const { setPronouns } = require("./setters/config/setPronouns.js"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam.js"); // Pronoun types const pronounsMap = new Map([ @@ -11,7 +12,8 @@ const pronounsMap = new Map([ ["it/its", { subject: "it", object: "it", possessive: "its", possessiveDeterminer: "its", reflexive: "itself", subjectIs: "it's", subjectWill: "it'll" }], ]); -const remindPronouns = async (user) => { +const remindPronouns = async (serverID, user) => { + traceFirstParam(arguments[0]); if (process.recentlyremindedpronouns == undefined) { process.recentlyremindedpronouns = {} } @@ -23,7 +25,7 @@ const remindPronouns = async (user) => { }, 900000) let userobject = await process.client.users.fetch(user) let buttons = [new ButtonBuilder().setCustomId("sheher").setLabel("She/Her").setStyle(ButtonStyle.Secondary), new ButtonBuilder().setCustomId("hehim").setLabel("He/Him").setStyle(ButtonStyle.Secondary), new ButtonBuilder().setCustomId("theythem").setLabel("They/Them").setStyle(ButtonStyle.Secondary), new ButtonBuilder().setCustomId("itits").setLabel("It/Its").setStyle(ButtonStyle.Secondary)]; - let pronounremindertext = `This bot uses gendered language for roleplay texts and output to individuals. Your pronouns currently are not set in the bot. Please click an option below to set them:` + let pronounremindertext = `This bot uses gendered language for roleplay texts and output to individuals. Your pronouns currently are not set in the bot for this server. Please click an option below to set them:` let dmchannel = await userobject.createDM(); await dmchannel .send({ content: `${pronounremindertext}`, components: [new ActionRowBuilder().addComponents(...buttons)]}) diff --git a/functions/setters/arousal/addArousal.js b/functions/setters/arousal/addArousal.js index 9c260e9b..7e7ef9ab 100644 --- a/functions/setters/arousal/addArousal.js +++ b/functions/setters/arousal/addArousal.js @@ -1,9 +1,10 @@ const { getArousal } = require("../../getters/arousal/getArousal"); const { getCombinedTraits } = require("../../getters/chastity/getCombinedTraits"); const { getProcessVariable } = require("../../getters/config/getProcessVariable"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** - * Adds arousal to the user + * Adds arousal to the user. Will set users with disabled arousal to 0. * * - (server id) serverID - The server this is on * - (user id) user - The user to add the arousal to @@ -11,8 +12,13 @@ const { getProcessVariable } = require("../../getters/config/getProcessVariable" * --- * ##### Returns current arousal after change **********/ -function addArousal(arousal, user, change) { +function addArousal(serverID, user, change) { + traceFirstParam(arguments[0]); if (!getProcessVariable(serverID, user, "arousal")) process.arousal[serverID][user] = { arousal: 0, prev: 0, timestamp: Date.now() }; + if (getOption(serverID, user, "arousalsystem") == 0) { + process.arousal[serverID][user] = { arousal: 0, prev: 0, timestamp: Date.now() } + return 0; // If they turned off arousal, do NOT do anything with them, just set it to zero. + } if (isNaN(change)) { console.log(`ERROR - Attempting to add a NaN arousal to user ID ${user}`) change = 0; // set it to 0 diff --git a/functions/setters/arousal/clearArousal.js b/functions/setters/arousal/clearArousal.js index bf09d510..08397215 100644 --- a/functions/setters/arousal/clearArousal.js +++ b/functions/setters/arousal/clearArousal.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* * Sets the user's arousal to 0 @@ -8,6 +9,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* *********/ function clearArousal(user) { + traceFirstParam(arguments[0]); process.arousal[user] = { arousal: 0, prev: 0, timestamp: Date.now() }; markForSave("arousal"); } diff --git a/functions/setters/chastity/assignChastity.js b/functions/setters/chastity/assignChastity.js index 7d703039..2c3c15e1 100644 --- a/functions/setters/chastity/assignChastity.js +++ b/functions/setters/chastity/assignChastity.js @@ -1,6 +1,7 @@ const { getBaseChastity } = require("../../getters/chastity/getBaseChastity"); const { getChastity } = require("../../getters/chastity/getChastity"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds or modifies a chastity belt on the user. @@ -13,6 +14,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### Returns true if successful, false if failed to put it on **********/ function assignChastity(user, keyholder, namedchastity, force = false) { + traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } diff --git a/functions/setters/chastity/assignChastityBra.js b/functions/setters/chastity/assignChastityBra.js index e2f00d6a..98f1fbff 100644 --- a/functions/setters/chastity/assignChastityBra.js +++ b/functions/setters/chastity/assignChastityBra.js @@ -1,6 +1,7 @@ const { getBaseChastity } = require("../../getters/chastity/getBaseChastity"); const { getChastityBra } = require("../../getters/chastity/getChastityBra"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds or modifies a chastity bra on the user. @@ -13,6 +14,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### Returns true if successful, false if failed to put it on **********/ function assignChastityBra(user, keyholder, namedchastity, force = false) { + traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } diff --git a/functions/setters/chastity/cloneChastityBraKey.js b/functions/setters/chastity/cloneChastityBraKey.js index 3456ecbc..fea658f3 100644 --- a/functions/setters/chastity/cloneChastityBraKey.js +++ b/functions/setters/chastity/cloneChastityBraKey.js @@ -1,5 +1,6 @@ const { getChastityBra } = require("../../getters/chastity/getChastityBra"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Adds a user as a cloned keyholder for the chastity bra @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* ********/ function cloneChastityBraKey(chastityuser, newKeyholder) { + traceFirstParam(arguments[0]); let chastity = getChastityBra(chastityuser); if (!chastity.clonedKeyholders) { chastity.clonedKeyholders = []; diff --git a/functions/setters/chastity/cloneChastityKey.js b/functions/setters/chastity/cloneChastityKey.js index 6220ade9..9f811224 100644 --- a/functions/setters/chastity/cloneChastityKey.js +++ b/functions/setters/chastity/cloneChastityKey.js @@ -1,5 +1,6 @@ const { getChastity } = require("../../getters/chastity/getChastity"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Adds a user as a cloned keyholder for the chastity belt @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* ********/ function cloneChastityKey(chastityuser, newKeyholder) { + traceFirstParam(arguments[0]); let chastity = getChastity(chastityuser); if (!chastity.clonedKeyholders) { chastity.clonedKeyholders = []; diff --git a/functions/setters/chastity/removeChastity.js b/functions/setters/chastity/removeChastity.js index f05db886..1618b1ab 100644 --- a/functions/setters/chastity/removeChastity.js +++ b/functions/setters/chastity/removeChastity.js @@ -1,6 +1,7 @@ const { getBaseChastity } = require("../../getters/chastity/getBaseChastity"); const { getChastity } = require("../../getters/chastity/getChastity"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a chastity belt from the user. @@ -12,6 +13,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### Returns true if successful, false if failed to remove **********/ function removeChastity(user, keyholder, force = false) { + traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } diff --git a/functions/setters/chastity/removeChastityBra.js b/functions/setters/chastity/removeChastityBra.js index 2a85f678..90500a18 100644 --- a/functions/setters/chastity/removeChastityBra.js +++ b/functions/setters/chastity/removeChastityBra.js @@ -1,6 +1,7 @@ const { getBaseChastity } = require("../../getters/chastity/getBaseChastity"); const { getChastityBra } = require("../../getters/chastity/getChastityBra"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a chastity bra from the user. @@ -12,6 +13,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### Returns true if successful, false if failed to remove **********/ function removeChastityBra(user, keyholder, force = false) { + traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } diff --git a/functions/setters/chastity/revokeChastityBraKey.js b/functions/setters/chastity/revokeChastityBraKey.js index 19ff375b..19bd6033 100644 --- a/functions/setters/chastity/revokeChastityBraKey.js +++ b/functions/setters/chastity/revokeChastityBraKey.js @@ -1,5 +1,6 @@ const { getChastityBra } = require("../../getters/chastity/getChastityBra"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******* * Removes a cloned key from a chastity bra @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* *******/ function revokeChastityBraKey(chastityuser, newKeyholder) { + traceFirstParam(arguments[0]); let chastity = getChastityBra(chastityuser); if (!chastity.clonedKeyholders) { chastity.clonedKeyholders = []; diff --git a/functions/setters/chastity/revokeChastityKey.js b/functions/setters/chastity/revokeChastityKey.js index 08fd6056..d1b22c6b 100644 --- a/functions/setters/chastity/revokeChastityKey.js +++ b/functions/setters/chastity/revokeChastityKey.js @@ -1,5 +1,6 @@ const { getChastity } = require("../../getters/chastity/getChastity"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******* * Removes a cloned key from a chastity belt @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* *******/ function revokeChastityKey(chastityuser, newKeyholder) { + traceFirstParam(arguments[0]); let chastity = getChastity(chastityuser); if (!chastity.clonedKeyholders) { chastity.clonedKeyholders = []; diff --git a/functions/setters/chastity/swapChastity.js b/functions/setters/chastity/swapChastity.js index 1fb30279..89b0a700 100644 --- a/functions/setters/chastity/swapChastity.js +++ b/functions/setters/chastity/swapChastity.js @@ -1,6 +1,7 @@ const { getBaseChastity } = require("../../getters/chastity/getBaseChastity"); const { getChastity } = require("../../getters/chastity/getChastity"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /*********** * Changes a chastity belt on the user in place @@ -12,6 +13,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### Returns true if successful, false if unable to change ***********/ function swapChastity(user, keyholder, namedchastity) { + traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } diff --git a/functions/setters/chastity/swapChastityBra.js b/functions/setters/chastity/swapChastityBra.js index bc2ed972..504234da 100644 --- a/functions/setters/chastity/swapChastityBra.js +++ b/functions/setters/chastity/swapChastityBra.js @@ -1,6 +1,7 @@ const { getBaseChastity } = require("../../getters/chastity/getBaseChastity"); const { getChastityBra } = require("../../getters/chastity/getChastityBra"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /*********** * Changes a chastity bra on the user in place @@ -12,6 +13,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### Returns true if successful, false if unable to change ***********/ function swapChastityBra(user, keyholder, namedchastity) { + traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } diff --git a/functions/setters/chastity/transferChastityBraKey.js b/functions/setters/chastity/transferChastityBraKey.js index 277fd70a..2866b27b 100644 --- a/functions/setters/chastity/transferChastityBraKey.js +++ b/functions/setters/chastity/transferChastityBraKey.js @@ -1,5 +1,6 @@ const { getChastityBra } = require("../../getters/chastity/getChastityBra"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Changes the primary keyholder for a user's chastity bra. Removes cloned keys. @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### Returns true if successful, false if lockedUser is not wearing a chastity bra ********/ function transferChastityBraKey(lockedUser, newKeyholder) { + traceFirstParam(arguments[0]); if (getChastityBra(lockedUser)) { if (getChastityBra(lockedUser).keyholder != newKeyholder) { getChastityBra(lockedUser).keyholder = newKeyholder; diff --git a/functions/setters/chastity/transferChastityKey.js b/functions/setters/chastity/transferChastityKey.js index 962ee47e..87109565 100644 --- a/functions/setters/chastity/transferChastityKey.js +++ b/functions/setters/chastity/transferChastityKey.js @@ -1,5 +1,6 @@ const { getChastity } = require("../../getters/chastity/getChastity"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Changes the primary keyholder for a user's chastity belt. Removes cloned keys. @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### Returns true if successful, false if lockedUser is not wearing a chastity belt ********/ function transferChastityKey(lockedUser, newKeyholder) { + traceFirstParam(arguments[0]); if (getChastity(lockedUser)) { if (getChastity(lockedUser).keyholder != newKeyholder) { getChastity(lockedUser).keyholder = newKeyholder; diff --git a/functions/setters/collar/addAdditionalCollarEffect.js b/functions/setters/collar/addAdditionalCollarEffect.js index 1f9f5ba8..f51da644 100644 --- a/functions/setters/collar/addAdditionalCollarEffect.js +++ b/functions/setters/collar/addAdditionalCollarEffect.js @@ -1,5 +1,6 @@ const { getCollar } = require("../../getters/collar/getCollar"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /****** * Adds an additional Collar effect to the user's collar, if they are wearing a collar. @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* *******/ function addAdditionalCollarEffect(user, type) { + traceFirstParam(arguments[0]); try { if (getCollar(user)) { if (!getCollar(user).additionalcollars) { getCollar(user).additionalcollars = [] } diff --git a/functions/setters/collar/assignCollar.js b/functions/setters/collar/assignCollar.js index 233a4f46..4bbbf0e4 100644 --- a/functions/setters/collar/assignCollar.js +++ b/functions/setters/collar/assignCollar.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds or modifies a collar on the user. @@ -12,6 +13,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function assignCollar(user, keyholder, restraints, only, customcollar) { + traceFirstParam(arguments[0]); if (process.collar == undefined) { process.collar = {}; } diff --git a/functions/setters/collar/cloneCollarKey.js b/functions/setters/collar/cloneCollarKey.js index ac547118..2617ca0b 100644 --- a/functions/setters/collar/cloneCollarKey.js +++ b/functions/setters/collar/cloneCollarKey.js @@ -1,5 +1,6 @@ const { getCollar } = require("../../getters/collar/getCollar"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Adds a user as a cloned keyholder for the collar @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* ********/ function cloneCollarKey(collarUser, newKeyholder) { + traceFirstParam(arguments[0]); let collar = getCollar(collarUser); if (!collar.clonedKeyholders) { collar.clonedKeyholders = []; diff --git a/functions/setters/collar/removeAdditionalCollarEffect.js b/functions/setters/collar/removeAdditionalCollarEffect.js index eb045189..857f2c6d 100644 --- a/functions/setters/collar/removeAdditionalCollarEffect.js +++ b/functions/setters/collar/removeAdditionalCollarEffect.js @@ -1,5 +1,6 @@ const { getCollar } = require("../../getters/collar/getCollar"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******* * Removes an additional Collar effect from the user's collar, if they are wearing a collar. @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* *******/ function removeAdditionalCollarEffect(user, type) { + traceFirstParam(arguments[0]); try { if (getCollar(user)) { if (getCollar(user).additionalcollars && getCollar(user).additionalcollars.includes(type)) { diff --git a/functions/setters/collar/removeCollar.js b/functions/setters/collar/removeCollar.js index e198381d..6e376708 100644 --- a/functions/setters/collar/removeCollar.js +++ b/functions/setters/collar/removeCollar.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Removes a collar from a user @@ -8,6 +9,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* ********/ function removeCollar(user) { + traceFirstParam(arguments[0]); if (process.collar == undefined) { process.collar = {}; } diff --git a/functions/setters/collar/revokeCollarKey.js b/functions/setters/collar/revokeCollarKey.js index 868ef9c1..7ca0bb80 100644 --- a/functions/setters/collar/revokeCollarKey.js +++ b/functions/setters/collar/revokeCollarKey.js @@ -1,5 +1,6 @@ const { getCollar } = require("../../getters/collar/getCollar"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******* * Removes a cloned key from a collar @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* *******/ function revokeCollarKey(collarUser, newKeyholder) { + traceFirstParam(arguments[0]); let collar = getCollar(collarUser); if (!collar.clonedKeyholders) { collar.clonedKeyholders = []; diff --git a/functions/setters/collar/transferCollarKey.js b/functions/setters/collar/transferCollarKey.js index aaabf225..77cb7fee 100644 --- a/functions/setters/collar/transferCollarKey.js +++ b/functions/setters/collar/transferCollarKey.js @@ -1,5 +1,6 @@ const { getCollar } = require("../../getters/collar/getCollar"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Changes the primary keyholder for a user's collar. Removes cloned keys. @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### Returns true if successful, false if lockedUser is not wearing a collar ********/ function transferCollarKey(lockedUser, newKeyholder) { + traceFirstParam(arguments[0]); if (getCollar(lockedUser)) { if (getCollar(lockedUser).keyholder != newKeyholder) { getCollar(lockedUser).keyholder = newKeyholder; diff --git a/functions/setters/config/assignOutfit.js b/functions/setters/config/assignOutfit.js index 2b0d179c..3aef1e26 100644 --- a/functions/setters/config/assignOutfit.js +++ b/functions/setters/config/assignOutfit.js @@ -9,6 +9,7 @@ const { getToys } = require("../../getters/toy/getToys"); const { getLockedWearable } = require("../../getters/wearable/getLockedWearable"); const { getWearable } = require("../../getters/wearable/getWearable"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* * Assigns an outfit to a slot for a user @@ -20,6 +21,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function assignOutfit(userID, slot, options) { + traceFirstParam(arguments[0]); if (process.outfits == undefined) { process.outfits = {}; } diff --git a/functions/setters/config/discardKey.js b/functions/setters/config/discardKey.js index e8b5358d..f24c33a4 100644 --- a/functions/setters/config/discardKey.js +++ b/functions/setters/config/discardKey.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { statsAddCounter } = require("./statsAddCounter"); /******* @@ -11,6 +12,7 @@ const { statsAddCounter } = require("./statsAddCounter"); * ##### Returns "keyholder" or "clone", depending on which key was discarded *******/ function discardKey(userid, keyholderid, device) { + traceFirstParam(arguments[0]); // If it isnt one of the three devices we know about, go away if ((device != "collar") && (device != "chastity belt") && (device != "chastity bra")) { console.log(`Unknown device ${device}. Use "collar", "chastity belt" or "chastity bra"`) diff --git a/functions/setters/config/renameOutfit.js b/functions/setters/config/renameOutfit.js index da909d2c..23c0e490 100644 --- a/functions/setters/config/renameOutfit.js +++ b/functions/setters/config/renameOutfit.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Renames an outfit for a user @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* ********/ function renameOutfit(userID, slot, newname) { + traceFirstParam(arguments[0]); if (process.outfits == undefined) { process.outfits = {}; } diff --git a/functions/setters/config/restoreOutfit.js b/functions/setters/config/restoreOutfit.js index 68170320..6291f162 100644 --- a/functions/setters/config/restoreOutfit.js +++ b/functions/setters/config/restoreOutfit.js @@ -12,6 +12,7 @@ const { getMitten } = require("../../getters/mitten/getMitten"); const { getLockedWearable } = require("../../getters/wearable/getLockedWearable"); const { getWearable } = require("../../getters/wearable/getWearable"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* * Retrieves an outfit and attempts to apply it to the user. @@ -24,6 +25,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* *********/ function restoreOutfit(serverID, userID, storedobject) { + traceFirstParam(arguments[0]); Object.keys(storedobject).forEach((k) => { // I could use a switch statement here but I feel like using if conditionals. if (k == "wearable") { diff --git a/functions/setters/config/setOption.js b/functions/setters/config/setOption.js index 4944893f..d727d4a1 100644 --- a/functions/setters/config/setOption.js +++ b/functions/setters/config/setOption.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Sets the configured option for the user ID as set in /config @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* ********/ function setOption(userID, option, choice) { + traceFirstParam(arguments[0]); if (process.configs == undefined) { process.configs = {}; } diff --git a/functions/setters/config/setPronouns.js b/functions/setters/config/setPronouns.js index ef68988b..24586e99 100644 --- a/functions/setters/config/setPronouns.js +++ b/functions/setters/config/setPronouns.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { setOption } = require("./setOption"); /********* @@ -10,6 +11,7 @@ const { setOption } = require("./setOption"); * ##### *No return value* *********/ function setPronouns(user, pronouns) { + traceFirstParam(arguments[0]); if (process.pronouns == undefined) { process.pronouns = {}; } diff --git a/functions/setters/config/setUserVar.js b/functions/setters/config/setUserVar.js index e62635cb..1bac8368 100644 --- a/functions/setters/config/setUserVar.js +++ b/functions/setters/config/setUserVar.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Set a temporary user variable by key @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function setUserVar(user, key, value) { + traceFirstParam(arguments[0]); if (process.usercontext == undefined) { process.usercontext = {}; } diff --git a/functions/setters/config/statsAddCounter.js b/functions/setters/config/statsAddCounter.js index 2ac736fa..e1ccba7b 100644 --- a/functions/setters/config/statsAddCounter.js +++ b/functions/setters/config/statsAddCounter.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds a point to a counter by name in user's stats. Specify amount for custom amount. @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function statsAddCounter(user, countername, amount = 1) { + traceFirstParam(arguments[0]); if (process.userstats == undefined) { process.userstats = {} } if (process.userstats[user] == undefined) { process.userstats[user] = {} } let newcount = (process.userstats[user][countername] ?? 0) + amount; diff --git a/functions/setters/config/statsSetCounter.js b/functions/setters/config/statsSetCounter.js index d079f809..690f020f 100644 --- a/functions/setters/config/statsSetCounter.js +++ b/functions/setters/config/statsSetCounter.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Set the counter for a user by name. Specify Value @@ -8,6 +9,7 @@ const { markForSave } = require("../../other/markForSave"); * - (any) value - Value to store in countername **********/ function statsSetCounter(user, countername, value) { + traceFirstParam(arguments[0]); if (process.userstats == undefined) { process.userstats = {} } if (process.userstats[user] == undefined) { process.userstats[user] = {} } process.userstats[user][countername] = value; diff --git a/functions/setters/corset/assignCorset.js b/functions/setters/corset/assignCorset.js index 59ed346c..7dd47040 100644 --- a/functions/setters/corset/assignCorset.js +++ b/functions/setters/corset/assignCorset.js @@ -3,6 +3,7 @@ const { getChastity } = require("../../getters/chastity/getChastity"); const { getBaseCorset } = require("../../getters/corset/getBaseCorset"); const { getBreath } = require("../../getters/corset/getBreath"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds or modifies a corset on the user. @@ -15,6 +16,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function assignCorset(user, type, tightness, origbinder) { + traceFirstParam(arguments[0]); if (process.corset == undefined) process.corset = {}; const old = Object.assign({}, process.corset[user]); const currentBreath = process.corset[user] ? getBreath(user) : null; diff --git a/functions/setters/corset/removeCorset.js b/functions/setters/corset/removeCorset.js index a07d3764..a8cb12c4 100644 --- a/functions/setters/corset/removeCorset.js +++ b/functions/setters/corset/removeCorset.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Removes a corset from a user @@ -8,6 +9,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* ********/ function removeCorset(user) { + traceFirstParam(arguments[0]); if (process.corset == undefined) process.corset = {}; delete process.corset[user]; markForSave("corset"); diff --git a/functions/setters/delve/setDelveFloorState.js b/functions/setters/delve/setDelveFloorState.js index e5d4d182..bbaa438d 100644 --- a/functions/setters/delve/setDelveFloorState.js +++ b/functions/setters/delve/setDelveFloorState.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******* * Set a floor prop on the floordata array. This is data only used by the floor itself. @@ -11,6 +12,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* *******/ function setDelveFloorState(user, floor, prop, value) { + traceFirstParam(arguments[0]); if (process.delveuserdata == undefined) { process.delveuserdata = {} } if (process.delveuserdata[user]) { // They started a delve, now check what floor they're on diff --git a/functions/setters/delve/setNextDelveRoom.js b/functions/setters/delve/setNextDelveRoom.js index 35952498..42a5aced 100644 --- a/functions/setters/delve/setNextDelveRoom.js +++ b/functions/setters/delve/setNextDelveRoom.js @@ -1,6 +1,7 @@ const { getCurrentFloor } = require("../../getters/delve/getCurrentFloor"); const { getDelvePlayerStats } = require("../../getters/delve/getDelvePlayerStats"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* * Sets the next Delve room by choice. If choice is not specified, the user is starting a new delve. This will always default to the delveentrance room. @@ -11,6 +12,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* *********/ function setNextDelveRoom(user, choice) { + traceFirstParam(arguments[0]); if ((getCurrentFloor(user) == undefined)) { process.delveuserdata[user] = { floorarr: ["delveentrance"], diff --git a/functions/setters/delve/setResolve.js b/functions/setters/delve/setResolve.js index d318fb21..c1dd7336 100644 --- a/functions/setters/delve/setResolve.js +++ b/functions/setters/delve/setResolve.js @@ -1,3 +1,5 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + /******* * Modifies the user's current Resolve, reducing it to 0 at minimum if it goes past that. * @@ -5,6 +7,7 @@ * - (integer) resolveamt - Amount of resolve to add or remove *******/ function modifyResolve(user, resolveamt) { + traceFirstParam(arguments[0]); if (process.delveuserdata == undefined) { process.delveuserdata = {} } if (process.delveuserdata[user]) { process.delveuserdata[user].resolve = Math.max(parseInt(process.delveuserdata[user].resolve) + resolveamt, 0); diff --git a/functions/setters/gag/assignGag.js b/functions/setters/gag/assignGag.js index a292af68..2c06e280 100644 --- a/functions/setters/gag/assignGag.js +++ b/functions/setters/gag/assignGag.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { statsAddCounter } = require("../config/statsAddCounter"); /********** @@ -12,6 +13,7 @@ const { statsAddCounter } = require("../config/statsAddCounter"); * ##### *No return value* **********/ function assignGag(serverID, userID, gagtype = "ball", intensity = 5, origbinder) { + traceFirstParam(arguments[0]); if (process.gags == undefined) { process.gags = {}; } diff --git a/functions/setters/gag/removeGag.js b/functions/setters/gag/removeGag.js index 02e8177c..3d69009f 100644 --- a/functions/setters/gag/removeGag.js +++ b/functions/setters/gag/removeGag.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a gag from the user. @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function deleteGag(userID, specificgag, force = false) { + traceFirstParam(arguments[0]); if (process.gags == undefined) { process.gags = {}; } diff --git a/functions/setters/headwear/addLockedHeadgear.js b/functions/setters/headwear/addLockedHeadgear.js index f78aafc4..0501bd4e 100644 --- a/functions/setters/headwear/addLockedHeadgear.js +++ b/functions/setters/headwear/addLockedHeadgear.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds a locked headwear item on the user. @@ -9,6 +10,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function addLockedHeadgear(userID, headwear) { + traceFirstParam(arguments[0]); if (process.headwear == undefined) { process.headwear = {}; } diff --git a/functions/setters/headwear/assignHeadwear.js b/functions/setters/headwear/assignHeadwear.js index 9d380989..c0f98b39 100644 --- a/functions/setters/headwear/assignHeadwear.js +++ b/functions/setters/headwear/assignHeadwear.js @@ -1,5 +1,6 @@ const { getBaseHeadwear } = require("../../getters/headwear/getBaseHeadwear"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds or modifies a headwear on the user. @@ -11,6 +12,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function assignHeadwear(userID, headwear, origbinder) { + traceFirstParam(arguments[0]); if (process.headwear == undefined) { process.headwear = {}; } diff --git a/functions/setters/headwear/removeHeadwear.js b/functions/setters/headwear/removeHeadwear.js index b48494f5..33dc8aa8 100644 --- a/functions/setters/headwear/removeHeadwear.js +++ b/functions/setters/headwear/removeHeadwear.js @@ -1,5 +1,6 @@ const { getLockedHeadgear } = require("../../getters/headwear/getLockedHeadgear"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a headwear from the user. @@ -11,6 +12,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function deleteHeadwear(userID, headwear, force = true) { + traceFirstParam(arguments[0]); if (process.headwear == undefined) { process.headwear = {}; } diff --git a/functions/setters/headwear/removeLockedHeadgear.js b/functions/setters/headwear/removeLockedHeadgear.js index 6517098e..256deaa6 100644 --- a/functions/setters/headwear/removeLockedHeadgear.js +++ b/functions/setters/headwear/removeLockedHeadgear.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a locked headwear item from the user. @@ -9,6 +10,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function removeLockedHeadgear(userID, headwear) { + traceFirstParam(arguments[0]); if (process.headwear == undefined) { process.headwear = {}; } diff --git a/functions/setters/heavy/assignHeavy.js b/functions/setters/heavy/assignHeavy.js index 8dbe1f13..0660f698 100644 --- a/functions/setters/heavy/assignHeavy.js +++ b/functions/setters/heavy/assignHeavy.js @@ -1,5 +1,6 @@ const { getHeavyName } = require("../../getters/heavy/getHeavyName"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /************** * Adds a heavy bondage to a user. @@ -12,6 +13,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **************/ function assignHeavy(user, type, origbinder, customname) { + traceFirstParam(arguments[0]); let namedcontainerowner; if ((type === "dominants_lap") || (type === "engulfing_slime")) { namedcontainerowner = origbinder; diff --git a/functions/setters/heavy/removeHeavy.js b/functions/setters/heavy/removeHeavy.js index e4092a8e..e6b45bb7 100644 --- a/functions/setters/heavy/removeHeavy.js +++ b/functions/setters/heavy/removeHeavy.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* * Remove Heavy Bondage from user. If **type** is not specified, will remove the first heavy bondage in the list. @@ -8,6 +9,7 @@ const { markForSave } = require("../../other/markForSave"); * - (boolean) force? - If true, removes all heavy bondage *********/ const removeHeavy = (user, type, force) => { + traceFirstParam(arguments[0]); if (process.heavy == undefined) { process.heavy = {}; } diff --git a/functions/setters/mitten/assignMitten.js b/functions/setters/mitten/assignMitten.js index 939d7ac4..662c8c74 100644 --- a/functions/setters/mitten/assignMitten.js +++ b/functions/setters/mitten/assignMitten.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds or modifies mittens on the user. @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function assignMitten(userID, mittentype, origbinder) { + traceFirstParam(arguments[0]); if (process.mitten == undefined) { process.mitten = {}; } diff --git a/functions/setters/mitten/removeMitten.js b/functions/setters/mitten/removeMitten.js index 385d13a6..0205eb94 100644 --- a/functions/setters/mitten/removeMitten.js +++ b/functions/setters/mitten/removeMitten.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes mittens from the user. @@ -8,6 +9,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function deleteMitten(userID) { + traceFirstParam(arguments[0]); if (process.mitten == undefined) { process.mitten = {}; } diff --git a/functions/setters/toy/assignToy.js b/functions/setters/toy/assignToy.js index 94670bd4..fc9fd271 100644 --- a/functions/setters/toy/assignToy.js +++ b/functions/setters/toy/assignToy.js @@ -1,6 +1,7 @@ const { getBaseChastity } = require("../../getters/chastity/getBaseChastity"); const { getOption } = require("../../getters/config/getOption"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds or modifies a toy on the user. @@ -16,6 +17,7 @@ const { markForSave } = require("../../other/markForSave"); * ###### Needs cleanup and review on the origbinder param **********/ function assignToy (user, keyholder, intensity, toytype = "vibe_bullet", origbinder) { + traceFirstParam(arguments[0]); let vibe = process.toytypes[toytype]; if (!vibe) { return "NoToy" } if ((getOption(user, "arousalsystem") == 0) && (vibe.isArousing())) { diff --git a/functions/setters/toy/removeToy.js b/functions/setters/toy/removeToy.js index 334933c5..61fc6cc3 100644 --- a/functions/setters/toy/removeToy.js +++ b/functions/setters/toy/removeToy.js @@ -1,5 +1,6 @@ const getBaseChastity = require("../../getters/chastity/getBaseChastity"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a toy from the user. @@ -12,6 +13,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function removeToy(user, keyholder, toytype, force = false) { + traceFirstParam(arguments[0]); if (process.toys == undefined) { process.toys = {} } if (process.toys[user] == undefined) { process.toys[user] = [] } let index = process.toys[user].findIndex((toy) => toy.type == toytype) diff --git a/functions/setters/wearable/addLockedWearable.js b/functions/setters/wearable/addLockedWearable.js index 70697f58..ee4106df 100644 --- a/functions/setters/wearable/addLockedWearable.js +++ b/functions/setters/wearable/addLockedWearable.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds a locked clothing item on the user. @@ -9,6 +10,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function addLockedWearable(userID, wearable) { + traceFirstParam(arguments[0]); if (process.wearable == undefined) { process.wearable = {}; } diff --git a/functions/setters/wearable/assignWearable.js b/functions/setters/wearable/assignWearable.js index bc020711..5bd1b461 100644 --- a/functions/setters/wearable/assignWearable.js +++ b/functions/setters/wearable/assignWearable.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /************** * Adds a wearable clothing item to a user. @@ -9,6 +10,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **************/ function assignWearable(user, wearable) { + traceFirstParam(arguments[0]); if (process.wearable == undefined) { process.wearable = {}; } diff --git a/functions/setters/wearable/removeLockedWearable.js b/functions/setters/wearable/removeLockedWearable.js index 2976b9b0..e2601921 100644 --- a/functions/setters/wearable/removeLockedWearable.js +++ b/functions/setters/wearable/removeLockedWearable.js @@ -1,4 +1,5 @@ const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a locked clothing item from the user. @@ -9,6 +10,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function removeLockedWearable(userID, wearable) { + traceFirstParam(arguments[0]); if (process.wearable == undefined) { process.wearable = {}; } diff --git a/functions/setters/wearable/removeWearable.js b/functions/setters/wearable/removeWearable.js index f2879bc6..229edbb5 100644 --- a/functions/setters/wearable/removeWearable.js +++ b/functions/setters/wearable/removeWearable.js @@ -1,5 +1,6 @@ const { getLockedWearable } = require("../../getters/wearable/getLockedWearable"); const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a clothing from the user. @@ -10,6 +11,7 @@ const { markForSave } = require("../../other/markForSave"); * ##### *No return value* **********/ function deleteWearable(userID, wearable) { + traceFirstParam(arguments[0]); if (process.wearable == undefined) { process.wearable = {}; } diff --git a/functions/statsfunctions.js b/functions/statsfunctions.js index 3071d723..fe70adc3 100644 --- a/functions/statsfunctions.js +++ b/functions/statsfunctions.js @@ -1,4 +1,5 @@ const { statsGetCounter } = require("./getters/config/statsGetCounter"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam"); const { parseDuration } = require("./timefunctions"); /********* @@ -6,7 +7,8 @@ const { parseDuration } = require("./timefunctions"); * * - (user id) user - User to generate stats for *********/ -function statsGeneratePage(user) { +function statsGeneratePage(serverID, user) { + traceFirstParam(arguments[0]); let statstogenerate = { Restraints: [ { diff --git a/functions/textfunctions.js b/functions/textfunctions.js index 33a2225f..18dc8393 100644 --- a/functions/textfunctions.js +++ b/functions/textfunctions.js @@ -41,19 +41,19 @@ const texts_chastity = { `USER_TAG whispers a sweet goodbye as USER_THEY wrapUSER_S a VAR_C2 around USER_THEIR waist, sealing USER_THEIR chastity away under lock and key.`, { required: (t) => { - return getArousal(t.interactionuser.id) > 10; + return getArousal(t.serverID, t.interactionuser.id) > 10; }, text: `Taking calm, deep breaths, USER_TAG wraps a VAR_C2 on USER_THEIR waist before USER_THEY touch there. USER_THEY_CAP still USER_HAVE the key, but at least it's something...`, }, { required: (t) => { - return getArousal(t.interactionuser.id) > 20; + return getArousal(t.serverID, t.interactionuser.id) > 20; }, text: `In a vain attempt to be a good USER_PRAISEOBJECT, USER_TAG locks USER_THEMSELF up with a VAR_C2. Though, USER_THEY USER_ISARE still holding the key.`, }, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG presses a VAR_C2 against USER_THEIR skin, feeling it activate and seal USER_THEM away until USER_THEY choose to remove it!`, }, @@ -73,13 +73,13 @@ const texts_chastity = { `USER_TAG whispers a sweet goodbye as USER_THEY wrapUSER_S a VAR_C2 around USER_THEIR chest, sealing USER_THEIR chastity away under lock and key.`, { required: (t) => { - return getArousal(t.interactionuser.id) > 10; + return getArousal(t.serverID, t.interactionuser.id) > 10; }, text: `Taking calm, deep breaths, USER_TAG wraps a VAR_C2 on USER_THEIR chest before USER_THEY touch there. USER_THEY_CAP still USER_HAVE the key, but at least it's something...`, }, { required: (t) => { - return getArousal(t.interactionuser.id) > 20; + return getArousal(t.serverID, t.interactionuser.id) > 20; }, text: `In a vain attempt to be a good USER_PRAISEOBJECT, USER_TAG locks USER_THEMSELF up with a VAR_C2. Though, USER_THEY USER_ISARE still holding the key.`, }, @@ -1353,25 +1353,25 @@ const texts_key = { keyholder: [ { required: (t) => { - return getArousal(t.interactionuser.id) < 20; + return getArousal(t.serverID, t.interactionuser.id) < 20; }, text: `USER_TAG looks one last time at USER_THEIR key to USER_THEIR VAR_C1 and tosses it without a second thought.`, }, { required: (t) => { - return !getHeadwearRestrictions(t.interactionuser.id).canInspect; + return !getHeadwearRestrictions(t.serverID, t.interactionuser.id).canInspect; }, text: `USER_TAG is unable to see, so USER_THEY decideUSER_S to toss the key to USER_THEIR VAR_C1 somewhere... Who knows where?`, }, { required: (t) => { - return getArousal(t.interactionuser.id) > 10; + return getArousal(t.serverID, t.interactionuser.id) > 10; }, text: `USER_TAG shudders slightly as USER_THEY stareUSER_S at USER_THEIR VAR_C1 key before flinging it off into the void!`, }, { required: (t) => { - return getArousal(t.interactionuser.id) > 20; + return getArousal(t.serverID, t.interactionuser.id) > 20; }, text: `Desperate to stay helpless and horny, USER_TAG throws USER_THEIR VAR_C1 key off into the distance!`, }, @@ -2181,13 +2181,13 @@ const texts_touch = { `USER_TAG brushes the hair out of TARGET_TAG's face as USER_THEY runUSER_S USER_THEIR hand over TARGET_THEIR head with a cute little headpat!`, { required: (t) => { - return (getArousal(t.targetuser.id) > 50) + return (getArousal(t.serverID, t.targetuser.id) > 50) }, text: `USER_TAG runs USER_THEIR hand over TARGET_TAG's hair. The heat radiating from TARGET_THEIR breath is enough to cook an egg with!` }, { required: (t) => { - return (getArousal(t.targetuser.id) > 100) + return (getArousal(t.serverID, t.targetuser.id) > 100) }, text: `USER_TAG runs USER_THEIR hand over TARGET_TAG's hair. TARGET_THEIR_CAP eyes are a bit glazed over from how horny TARGET_THEY feelTARGET_S right now...` }, diff --git a/functions/timelockfunctions.js b/functions/timelockfunctions.js index 7f567446..03ae944e 100644 --- a/functions/timelockfunctions.js +++ b/functions/timelockfunctions.js @@ -13,9 +13,11 @@ const { transferCollarKey } = require("./setters/collar/transferCollarKey.js"); const { transferChastityKey } = require("./setters/chastity/transferChastityKey.js"); const { transferChastityBraKey } = require("./setters/chastity/transferChastityBraKey.js"); const { markForSave } = require("./other/markForSave.js"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam.js"); // returns whether the locking was successful -function timelockChastity(client, wearer, keyholder, unlockTime, access, keyholderAfter, webhookchannel) { +function timelockChastity(serverID, client, wearer, keyholder, unlockTime, access, keyholderAfter, webhookchannel) { + traceFirstParam(arguments[0]); const now = Date.now(); if (now >= unlockTime) return false; if (process.chastity == undefined) process.chastity = {}; @@ -39,7 +41,8 @@ function timelockChastity(client, wearer, keyholder, unlockTime, access, keyhold } // returns whether the unlocking was successful -function unlockTimelockChastity(client, wearer, skipWrite = false) { +function unlockTimelockChastity(serverID, client, wearer, skipWrite = false) { + traceFirstParam(arguments[0]); if (process.chastity == undefined) process.chastity = {}; const chastity = process.chastity[wearer]; if (!chastity || !chastity.unlockTime) return false; @@ -55,7 +58,8 @@ function unlockTimelockChastity(client, wearer, skipWrite = false) { return true; } -async function sendTimelockChastityUnlockMessage(client, wearer, keyholder) { +async function sendTimelockChastityUnlockMessage(serverID, client, wearer, keyholder) { + traceFirstParam(arguments[0]); if (process.recentmessages && process.recentmessages[wearer]) { if (!keyholder) { messageSendChannel(`As the timer finally expires, <@${wearer}>'s chastity belt unlocks and falls to the floor!`, process.recentmessages[wearer]); @@ -71,7 +75,8 @@ async function sendTimelockChastityUnlockMessage(client, wearer, keyholder) { } // returns whether the locking was successful -function timelockChastityBra(client, wearer, keyholder, unlockTime, access, keyholderAfter, webhookchannel) { +function timelockChastityBra(serverID, client, wearer, keyholder, unlockTime, access, keyholderAfter, webhookchannel) { + traceFirstParam(arguments[0]); const now = Date.now(); if (now >= unlockTime) return false; if (process.chastitybra == undefined) process.chastitybra = {}; @@ -95,7 +100,8 @@ function timelockChastityBra(client, wearer, keyholder, unlockTime, access, keyh } // returns whether the unlocking was successful -function unlockTimelockChastityBra(client, wearer, skipWrite = false) { +function unlockTimelockChastityBra(serverID, client, wearer, skipWrite = false) { + traceFirstParam(arguments[0]); if (process.chastitybra == undefined) process.chastitybra = {}; const chastitybra = process.chastitybra[wearer]; if (!chastitybra || !chastitybra.unlockTime) return false; @@ -111,7 +117,8 @@ function unlockTimelockChastityBra(client, wearer, skipWrite = false) { return true; } -async function sendTimelockChastityBraUnlockMessage(client, wearer, keyholder) { +async function sendTimelockChastityBraUnlockMessage(serverID, client, wearer, keyholder) { + traceFirstParam(arguments[0]); if (process.recentmessages && process.recentmessages[wearer]) { if (!keyholder) { messageSendChannel(`As the timer finally expires, <@${wearer}>'s chastity bra unlocks and falls to the floor!`, process.recentmessages[wearer]); @@ -127,7 +134,8 @@ async function sendTimelockChastityBraUnlockMessage(client, wearer, keyholder) { } // returns whether the locking was successful -function timelockCollar(client, wearer, keyholder, unlockTime, access, keyholderAfter, webhookchannel) { +function timelockCollar(serverID, client, wearer, keyholder, unlockTime, access, keyholderAfter, webhookchannel) { + traceFirstParam(arguments[0]); const now = Date.now(); if (now >= unlockTime) return false; if (process.collar == undefined) process.collar = {}; @@ -151,7 +159,8 @@ function timelockCollar(client, wearer, keyholder, unlockTime, access, keyholder } // returns whether the unlocking was successful -function unlockTimelockCollar(client, wearer, skipWrite = false) { +function unlockTimelockCollar(serverID, client, wearer, skipWrite = false) { + traceFirstParam(arguments[0]); if (process.collar == undefined) process.collar = {}; const collar = process.collar[wearer]; if (!collar || !collar.unlockTime) return false; @@ -167,7 +176,8 @@ function unlockTimelockCollar(client, wearer, skipWrite = false) { return true; } -async function sendTimelockCollarUnlockMessage(client, wearer, keyholder) { +async function sendTimelockCollarUnlockMessage(serverID, client, wearer, keyholder) { + traceFirstParam(arguments[0]); if (process.recentmessages && process.recentmessages[wearer]) { if (!keyholder) { messageSendChannel(`As the timer finally expires, <@${wearer}>'s collar unlocks and falls to the floor!`, process.recentmessages[wearer]); @@ -199,7 +209,8 @@ function checkGagbotKeys() { } } -function gagbotHeldKeyTime(wearerid, type) { +function gagbotHeldKeyTime(serverID, wearerid, type) { + traceFirstParam(arguments[0]); if (process.heldkeytimers == undefined) { process.heldkeytimers = {} } if (!process.recentmessages[wearerid]) { return } if (!process.heldkeytimers[`${wearerid}_${type}`]) { diff --git a/functions/touchfunctions.js b/functions/touchfunctions.js index 108222fd..151e9eb7 100644 --- a/functions/touchfunctions.js +++ b/functions/touchfunctions.js @@ -16,6 +16,7 @@ const { getClonedChastityBraKey } = require("./getters/chastity/getClonedChastit const { getClonedCollarKey } = require("./getters/collar/getClonedCollarKey"); const { canAccessCollar } = require("./getters/collar/canAccessCollar"); const { statsAddCounter } = require("./setters/config/statsAddCounter"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam"); /**************** * Rolls a Pat based on the user's bondage and the target's bondage. If hit is false, then boundmiss will note the reason, if it is due to the user being bound. @@ -29,6 +30,7 @@ const { statsAddCounter } = require("./setters/config/statsAddCounter"); * - boundmiss: string ("arms", "blind", "legs", "container") *******************/ function rollPatChance(serverID, user, target) { + traceFirstParam(arguments[0]); let returnedobject = { hit: false, crit: false, @@ -197,7 +199,8 @@ function doHeadpatFunctions(headpatter, recipient, returnedobject) { * * - (user id) user - The person to shock! ********/ -async function shockUser(user) { +async function shockUser(serverID, user) { + traceFirstParam(arguments[0]); try { if (getOption(user, "pishockusername") && (typeof getOption(user, "pishockusername") == "string") && getOption(user, "pishockname") && (typeof getOption(user, "pishockname") == "string") && @@ -252,7 +255,8 @@ async function shockUser(user) { * - (string) type - The type of action being performed ("headpat", "shock", etc) * - (boolean) noprompt? - If true, skips DMing and immediately rejects if no suitable user ********/ -async function handleTouchEvent(user, target, type, noprompt = false) { +async function handleTouchEvent(serverID, user, target, type, noprompt = false) { + traceFirstParam(arguments[0]); return new Promise(async (res, rej) => { if (!user || !target) { rej("User or Target does NOT exist") diff --git a/functions/vibefunctions.js b/functions/vibefunctions.js index 700ee6fb..0d4e71b1 100644 --- a/functions/vibefunctions.js +++ b/functions/vibefunctions.js @@ -20,6 +20,7 @@ const { getHeavy } = require("./getters/heavy/getHeavy.js"); const { heavyDenialCoefficient } = require("./getters/heavy/getHeavyDenialCoefficient.js"); const { convertPronounsText } = require("./other/convertPronounsText.js"); const { markForSave } = require("./other/markForSave.js"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam.js"); // NOTE: canUnequip is currently checked in functions that remove/assign chastity and those functions return if it succeeded, but the text responses are not yet updated // probably makes more sense to make custom text responses for the belts/bras that use this that explain why it failed @@ -193,7 +194,8 @@ const AROUSAL_PERIOD_B = 1 / 33; const PENALTY_MULTIPLIER = 1.3; // Called to prompt the wearer if it is okay to clone a key. -async function promptCloneChastityKey(user, target, clonekeyholder, bra) { +async function promptCloneChastityKey(serverID, user, target, clonekeyholder) { + traceFirstParam(arguments[0]); return new Promise(async (res, rej) => { let buttons = [new ButtonBuilder().setCustomId("denyButton").setLabel("Deny").setStyle(ButtonStyle.Danger), new ButtonBuilder().setCustomId("acceptButton").setLabel("Allow").setStyle(ButtonStyle.Success)]; let dmchannel = await target.createDM(); @@ -230,7 +232,8 @@ async function promptCloneChastityKey(user, target, clonekeyholder, bra) { } // Called to prompt the wearer if it is okay to give a key. -async function promptTransferChastityKey(user, target, newKeyholder) { +async function promptTransferChastityKey(serverID, user, target, newKeyholder) { + traceFirstParam(arguments[0]); return new Promise(async (res, rej) => { try { let buttons = [new ButtonBuilder().setCustomId("denyButton").setLabel("Deny").setStyle(ButtonStyle.Danger), new ButtonBuilder().setCustomId("acceptButton").setLabel("Allow").setStyle(ButtonStyle.Success)]; @@ -272,7 +275,8 @@ async function promptTransferChastityKey(user, target, newKeyholder) { } // Called to prompt the wearer if it is okay to clone a key. -async function promptCloneChastityBraKey(user, target, clonekeyholder) { +async function promptCloneChastityBraKey(serverID, user, target, clonekeyholder) { + traceFirstParam(arguments[0]); return new Promise(async (res, rej) => { try { let buttons = [new ButtonBuilder().setCustomId("denyButton").setLabel("Deny").setStyle(ButtonStyle.Danger), new ButtonBuilder().setCustomId("acceptButton").setLabel("Allow").setStyle(ButtonStyle.Success)]; @@ -314,7 +318,8 @@ async function promptCloneChastityBraKey(user, target, clonekeyholder) { } // Called to prompt the wearer if it is okay to give a key. -async function promptTransferChastityBraKey(user, target, newKeyholder) { +async function promptTransferChastityBraKey(serverID, user, target, newKeyholder) { + traceFirstParam(arguments[0]); return new Promise(async (res, rej) => { try { let buttons = [new ButtonBuilder().setCustomId("denyButton").setLabel("Deny").setStyle(ButtonStyle.Danger), new ButtonBuilder().setCustomId("acceptButton").setLabel("Allow").setStyle(ButtonStyle.Success)]; @@ -611,7 +616,8 @@ function calcNextArousal(traits, time, arousal, prev, growthCoefficient, decayCo } // user attempts to orgasm, returns if it succeeds -function tryOrgasm(user) { +function tryOrgasm(serverID, user) { + traceFirstParam(arguments[0]); // always succeed if user isnt using the system if (getOption(user, "arousalsystem") != 2) return true; @@ -655,7 +661,8 @@ function tryOrgasm(user) { return false; } -function setArousalCooldown(user, cooldownModifier = 1, arousalLeft = 0) { +function setArousalCooldown(serverID, user, cooldownModifier = 1, arousalLeft = 0) { + traceFirstParam(arguments[0]); const now = Date.now(); process.arousal[user].timestamp = now + ORGASM_COOLDOWN * cooldownModifier; const old = process.arousal[user].arousal; @@ -664,7 +671,8 @@ function setArousalCooldown(user, cooldownModifier = 1, arousalLeft = 0) { } // modify when more things affect it -function calcStaticVibeIntensity(user) { +function calcStaticVibeIntensity(serverID, user) { + traceFirstParam(arguments[0]); const vibes = getToys(user); if (!vibes) return 0; return vibes.reduce((prev, currVibe) => { @@ -674,14 +682,16 @@ function calcStaticVibeIntensity(user) { } // modify when more things affect it -function calcDenialCoefficient(user) { +function calcDenialCoefficient(serverID, user) { + traceFirstParam(arguments[0]); const heavy = getHeavy(user); const chastity = getChastity(user); if (chastity) return (heavy ? heavyDenialCoefficient(heavy.type) : 0) / 2 + getCombinedTraits(user).denialCoefficient; return heavy ? heavyDenialCoefficient(heavy.type) : 1; } -function calcFrustration(user) { +function calcFrustration(serverID, user) { + traceFirstParam(arguments[0]); let frustrationmult = getOption(user, "frustration"); if (frustrationmult == 0) { return 0; diff --git a/functions/wearablefunctions.js b/functions/wearablefunctions.js index b5756dd1..39b56c4a 100644 --- a/functions/wearablefunctions.js +++ b/functions/wearablefunctions.js @@ -1,6 +1,5 @@ const fs = require("fs"); const path = require("path"); -const { getLockedWearable } = require("./getters/wearable/getLockedWearable"); let wearabletypes = [ // Aesthetic Body Parts From f54e2602143ccd32ae401b344b236e9a14d8f27c Mon Sep 17 00:00:00 2001 From: Enraa Date: Mon, 15 Jun 2026 23:23:20 -0700 Subject: [PATCH 04/44] add serverID to some functions --- functions/getters/arousal/getArousalBar.js | 2 +- .../getters/arousal/getArousalDescription.js | 2 +- .../getters/chastity/canAccessChastity.js | 32 ++++++++--------- .../getters/chastity/canAccessChastityBra.js | 35 ++++++++++--------- functions/getters/chastity/getChastity.js | 9 +++-- functions/getters/chastity/getChastityBra.js | 9 +++-- .../chastity/getChastityBraKeyholder.js | 5 +-- .../getters/chastity/getChastityBraKeys.js | 10 ++++-- .../getters/chastity/getChastityBraName.js | 13 +++---- functions/other/TESTS/traceFirstParam.js | 12 ++----- index.js | 1 + 11 files changed, 63 insertions(+), 67 deletions(-) diff --git a/functions/getters/arousal/getArousalBar.js b/functions/getters/arousal/getArousalBar.js index 2dd89b9f..c717cf6a 100644 --- a/functions/getters/arousal/getArousalBar.js +++ b/functions/getters/arousal/getArousalBar.js @@ -16,7 +16,7 @@ const ORGASM_LIMIT = 10; function getArousalBar(serverID, userID) { traceFirstParam(arguments[0]); const arousal = getArousal(serverID, userID); - const denialCoefficient = calcDenialCoefficient(userID); + const denialCoefficient = calcDenialCoefficient(serverID, userID); const orgasmLimit = ORGASM_LIMIT; const filledbar = "ā– "; const unfilled = "ā–”"; diff --git a/functions/getters/arousal/getArousalDescription.js b/functions/getters/arousal/getArousalDescription.js index 7850fcff..37327447 100644 --- a/functions/getters/arousal/getArousalDescription.js +++ b/functions/getters/arousal/getArousalDescription.js @@ -21,7 +21,7 @@ function getArousalDescription(serverID, user) { if (getOption(user, "arousalsystem") === 0) return null; // Disabled Arousal system const arousal = getArousal(serverID, user); - const denialCoefficient = calcDenialCoefficient(user); + const denialCoefficient = calcDenialCoefficient(serverID, user); const orgasmLimit = ORGASM_LIMIT * denialCoefficient; const orgasmProgress = arousal / orgasmLimit; // these numbers are mostly arbitrary diff --git a/functions/getters/chastity/canAccessChastity.js b/functions/getters/chastity/canAccessChastity.js index c6c9c839..a3068d29 100644 --- a/functions/getters/chastity/canAccessChastity.js +++ b/functions/getters/chastity/canAccessChastity.js @@ -24,27 +24,27 @@ function canAccessChastity(serverID, chastityuser, keyholder, unlock, cloning) { let accessval = { access: false, public: false, hasbelt: true }; // no belt, no need - if (!getChastity(chastityuser)) { + if (!getChastity(serverID, chastityuser)) { accessval.hasbelt = false; return accessval; } // Sealed Belt - nobody gets in! - if (getChastity(chastityuser)?.access == 2) { + if (getChastity(serverID, chastityuser)?.access == 2) { return accessval; } // If unlock is set, only allow access to unlock if the keyholder is the correct one. if (unlock) { // Allow unlocks by a non-self keyholder at all times, assuming its not sealed. - if (getChastity(chastityuser)?.access != 2 && getChastity(chastityuser)?.keyholder == keyholder && keyholder != chastityuser && !getChastity(chastityuser)?.fumbled) { + if (getChastity(serverID, chastityuser)?.access != 2 && getChastity(serverID, chastityuser)?.keyholder == keyholder && keyholder != chastityuser && !getChastity(serverID, chastityuser)?.fumbled) { accessval.access = true; } // Allow unlocks by any keyholder if no timelock if the key isn't fumbled! - if (getChastity(chastityuser)?.access == undefined && getChastity(chastityuser)?.keyholder == keyholder && !getChastity(chastityuser)?.fumbled) { + if (getChastity(serverID, chastityuser)?.access == undefined && getChastity(serverID, chastityuser)?.keyholder == keyholder && !getChastity(serverID, chastityuser)?.fumbled) { accessval.access = true; } // Allow unlocks by secondary keyholder if no timelock - let clonedkeys = getChastity(chastityuser)?.clonedKeyholders ?? []; - if (getChastity(chastityuser)?.access == undefined && clonedkeys.includes(keyholder)) { + let clonedkeys = getChastity(serverID, chastityuser)?.clonedKeyholders ?? []; + if (getChastity(serverID, chastityuser)?.access == undefined && clonedkeys.includes(keyholder)) { accessval.access = true; } // Else, return false. @@ -54,45 +54,45 @@ function canAccessChastity(serverID, chastityuser, keyholder, unlock, cloning) { // If Cloning is set, parse specific instructions for that. if (cloning) { // Primary Keyholder access only if set to 0. - if (getChastity(chastityuser)?.access == 0 && keyholder != chastityuser) { + if (getChastity(serverID, chastityuser)?.access == 0 && keyholder != chastityuser) { accessval.access = true; accessval.public = true; } // Keyholder access if access is unset (no timelocks) and the key isnt fumbled - if (getChastity(chastityuser)?.access == undefined && getChastity(chastityuser)?.keyholder == keyholder && !getChastity(chastityuser)?.fumbled) { + if (getChastity(serverID, chastityuser)?.access == undefined && getChastity(serverID, chastityuser)?.keyholder == keyholder && !getChastity(serverID, chastityuser)?.fumbled) { accessval.access = true; } // Keyholder access if timelock is 1 (keyholder only) but only if not self and if key isnt fumbled. - if (getChastity(chastityuser)?.access == 1 && getChastity(chastityuser)?.keyholder == keyholder && chastityuser != keyholder && !getChastity(chastityuser)?.fumbled) { + if (getChastity(serverID, chastityuser)?.access == 1 && getChastity(serverID, chastityuser)?.keyholder == keyholder && chastityuser != keyholder && !getChastity(serverID, chastityuser)?.fumbled) { accessval.access = true; } return accessval; } // Others access only when access is set to 0. - if (getChastity(chastityuser)?.access == 0 && keyholder != chastityuser) { + if (getChastity(serverID, chastityuser)?.access == 0 && keyholder != chastityuser) { accessval.access = true; accessval.public = true; } // Keyholder access if access is unset (no timelocks) and not fumbled - if (getChastity(chastityuser)?.access == undefined && getChastity(chastityuser)?.keyholder == keyholder && !getChastity(chastityuser)?.fumbled) { + if (getChastity(serverID, chastityuser)?.access == undefined && getChastity(serverID, chastityuser)?.keyholder == keyholder && !getChastity(serverID, chastityuser)?.fumbled) { accessval.access = true; } // Secondary Keyholder access (cloned key), but only if cloning is NOT true and no timelocks - let clonedkeys = getChastity(chastityuser)?.clonedKeyholders ?? []; - if (clonedkeys.includes(keyholder) && getChastity(chastityuser)?.access == undefined) { + let clonedkeys = getChastity(serverID, chastityuser)?.clonedKeyholders ?? []; + if (clonedkeys.includes(keyholder) && getChastity(serverID, chastityuser)?.access == undefined) { accessval.access = true; } // Keyholder access if timelock is 1 (keyholder only) but only if not self and not fumbled - if (getChastity(chastityuser)?.access == 1 && getChastity(chastityuser)?.keyholder == keyholder && chastityuser != keyholder && !getChastity(chastityuser)?.fumbled) { + if (getChastity(serverID, chastityuser)?.access == 1 && getChastity(serverID, chastityuser)?.keyholder == keyholder && chastityuser != keyholder && !getChastity(serverID, chastityuser)?.fumbled) { accessval.access = true; } // Secondary Keyholder access (cloned key) if access is 1, but only if not self. - if (clonedkeys.includes(keyholder) && getChastity(chastityuser)?.access == 1 && chastityuser != keyholder) { + if (clonedkeys.includes(keyholder) && getChastity(serverID, chastityuser)?.access == 1 && chastityuser != keyholder) { accessval.access = true; } // Secondary Keyholder access if temporary keyholder. - if (getChastity(chastityuser)?.temporarykeyholder && (getChastity(chastityuser)?.temporarykeyholder == keyholder) && (getChastity(chastityuser)?.temporarykeyholdertime > Date.now())) { + if (getChastity(serverID, chastityuser)?.temporarykeyholder && (getChastity(serverID, chastityuser)?.temporarykeyholder == keyholder) && (getChastity(serverID, chastityuser)?.temporarykeyholdertime > Date.now())) { accessval.access = true; } diff --git a/functions/getters/chastity/canAccessChastityBra.js b/functions/getters/chastity/canAccessChastityBra.js index 4fc95f1b..7b15fcf3 100644 --- a/functions/getters/chastity/canAccessChastityBra.js +++ b/functions/getters/chastity/canAccessChastityBra.js @@ -4,6 +4,7 @@ const { getChastityBra } = require("./getChastityBra"); /************ * Checks whether the keyholder has access to do things to the chastityuser. (for chastity bra) * + * - (server id) serverID - The server this is running on * - (user id) chastityuser - The User ID who is **wearing** the collar * - (user id) keyholder - The User ID who is **performing the action** * - (boolean) unlock - If this action involves unlocking and removing the collar @@ -14,7 +15,7 @@ const { getChastityBra } = require("./getChastityBra"); * - public: Is this action permitted because of public access? * - hasbelt: Is the **chastityuser** wearing a chastity bra? ************/ -function canAccessChastityBra(chastityuser, keyholder, unlock, cloning) { +function canAccessChastityBra(serverID, chastityuser, keyholder, unlock, cloning) { traceFirstParam(arguments[0]); // As a reference for access in timelocks: // 0: "Everyone Else" @@ -23,27 +24,27 @@ function canAccessChastityBra(chastityuser, keyholder, unlock, cloning) { let accessval = { access: false, public: false, hasbelt: true }; // no belt, no need - if (!getChastityBra(chastityuser)) { + if (!getChastityBra(serverID, chastityuser)) { accessval.hasbelt = false; return accessval; } // Sealed Belt - nobody gets in! - if (getChastityBra(chastityuser)?.access == 2) { + if (getChastityBra(serverID, chastityuser)?.access == 2) { return accessval; } // If unlock is set, only allow access to unlock if the keyholder is the correct one. if (unlock) { // Allow unlocks by a non-self keyholder at all times, assuming its not sealed. - if (getChastityBra(chastityuser)?.access != 2 && getChastityBra(chastityuser)?.keyholder == keyholder && keyholder != chastityuser && !getChastityBra(chastityuser)?.fumbled) { + if (getChastityBra(serverID, chastityuser)?.access != 2 && getChastityBra(serverID, chastityuser)?.keyholder == keyholder && keyholder != chastityuser && !getChastityBra(serverID, chastityuser)?.fumbled) { accessval.access = true; } // Allow unlocks by any keyholder if no timelock and not fumbled. - if (getChastityBra(chastityuser)?.access == undefined && getChastityBra(chastityuser)?.keyholder == keyholder && !getChastityBra(chastityuser)?.fumbled) { + if (getChastityBra(serverID, chastityuser)?.access == undefined && getChastityBra(serverID, chastityuser)?.keyholder == keyholder && !getChastityBra(serverID, chastityuser)?.fumbled) { accessval.access = true; } // Allow unlocks by secondary keyholder if no timelock - let clonedkeys = getChastityBra(chastityuser)?.clonedKeyholders ?? []; - if (getChastityBra(chastityuser)?.access == undefined && clonedkeys.includes(keyholder)) { + let clonedkeys = getChastityBra(serverID, chastityuser)?.clonedKeyholders ?? []; + if (getChastityBra(serverID, chastityuser)?.access == undefined && clonedkeys.includes(keyholder)) { accessval.access = true; } // Else, return false. @@ -53,45 +54,45 @@ function canAccessChastityBra(chastityuser, keyholder, unlock, cloning) { // If Cloning is set, parse specific instructions for that. if (cloning) { // Primary Keyholder access only if set to 0. - if (getChastityBra(chastityuser)?.access == 0 && keyholder != chastityuser) { + if (getChastityBra(serverID, chastityuser)?.access == 0 && keyholder != chastityuser) { accessval.access = true; accessval.public = true; } // Keyholder access if access is unset (no timelocks) - if (getChastityBra(chastityuser)?.access == undefined && getChastityBra(chastityuser)?.keyholder == keyholder && !getChastityBra(chastityuser)?.fumbled) { + if (getChastityBra(serverID, chastityuser)?.access == undefined && getChastityBra(serverID, chastityuser)?.keyholder == keyholder && !getChastityBra(serverID, chastityuser)?.fumbled) { accessval.access = true; } // Keyholder access if timelock is 1 (keyholder only) but only if not self. - if (getChastityBra(chastityuser)?.access == 1 && getChastityBra(chastityuser)?.keyholder == keyholder && chastityuser != keyholder && !getChastityBra(chastityuser)?.fumbled) { + if (getChastityBra(serverID, chastityuser)?.access == 1 && getChastityBra(serverID, chastityuser)?.keyholder == keyholder && chastityuser != keyholder && !getChastityBra(serverID, chastityuser)?.fumbled) { accessval.access = true; } return accessval; } // Others access only when access is set to 0. - if (getChastityBra(chastityuser)?.access == 0 && keyholder != chastityuser) { + if (getChastityBra(serverID, chastityuser)?.access == 0 && keyholder != chastityuser) { accessval.access = true; accessval.public = true; } // Keyholder access if access is unset (no timelocks) - if (getChastityBra(chastityuser)?.access == undefined && getChastityBra(chastityuser)?.keyholder == keyholder && !getChastityBra(chastityuser)?.fumbled) { + if (getChastityBra(serverID, chastityuser)?.access == undefined && getChastityBra(serverID, chastityuser)?.keyholder == keyholder && !getChastityBra(serverID, chastityuser)?.fumbled) { accessval.access = true; } // Secondary Keyholder access (cloned key), but only if cloning is NOT true and no timelocks - let clonedkeys = getChastityBra(chastityuser)?.clonedKeyholders ?? []; - if (clonedkeys.includes(keyholder) && getChastityBra(chastityuser)?.access == undefined) { + let clonedkeys = getChastityBra(serverID, chastityuser)?.clonedKeyholders ?? []; + if (clonedkeys.includes(keyholder) && getChastityBra(serverID, chastityuser)?.access == undefined) { accessval.access = true; } // Keyholder access if timelock is 1 (keyholder only) but only if not self. - if (getChastityBra(chastityuser)?.access == 1 && getChastityBra(chastityuser)?.keyholder == keyholder && chastityuser != keyholder && !getChastityBra(chastityuser)?.fumbled) { + if (getChastityBra(serverID, chastityuser)?.access == 1 && getChastityBra(serverID, chastityuser)?.keyholder == keyholder && chastityuser != keyholder && !getChastityBra(serverID, chastityuser)?.fumbled) { accessval.access = true; } // Secondary Keyholder access (cloned key) if access is 1, but only if not self. - if (clonedkeys.includes(keyholder) && getChastityBra(chastityuser)?.access == 1 && chastityuser != keyholder) { + if (clonedkeys.includes(keyholder) && getChastityBra(serverID, chastityuser)?.access == 1 && chastityuser != keyholder) { accessval.access = true; } // Keyholder access if temporary keyholder. - if (getChastityBra(chastityuser)?.temporarykeyholder && (getChastityBra(chastityuser)?.temporarykeyholder == keyholder) && (getChastityBra(chastityuser)?.temporarykeyholdertime > Date.now())) { + if (getChastityBra(serverID, chastityuser)?.temporarykeyholder && (getChastityBra(serverID, chastityuser)?.temporarykeyholder == keyholder) && (getChastityBra(serverID, chastityuser)?.temporarykeyholdertime > Date.now())) { accessval.access = true; } // Else, return false. diff --git a/functions/getters/chastity/getChastity.js b/functions/getters/chastity/getChastity.js index 29797cbe..b12bc8e3 100644 --- a/functions/getters/chastity/getChastity.js +++ b/functions/getters/chastity/getChastity.js @@ -1,8 +1,10 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /********* * Get the chastity belt that the user is wearing. * + * - (server id) serverID - The server this is running on * - (user id) user - The user ID of the chastity belt to retrieve * --- * ##### Returns the chastity belt object for the user. All chastity belt objects will have these properties: @@ -12,12 +14,9 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * - stateligible: If the chastity belt is restored from /outfit or other methods, will be **false** and won't be counted for longest chastity worn. * ###### Additional properties may be added by other functions *********/ -function getChastity(user) { +function getChastity(serverID, user) { traceFirstParam(arguments[0]); - if (process.chastity == undefined) { - process.chastity = {}; - } - return process.chastity[user]; + return getProcessVariable(serverID, user, "chastity") } exports.getChastity = getChastity; \ No newline at end of file diff --git a/functions/getters/chastity/getChastityBra.js b/functions/getters/chastity/getChastityBra.js index 579c10db..fc837a68 100644 --- a/functions/getters/chastity/getChastityBra.js +++ b/functions/getters/chastity/getChastityBra.js @@ -1,8 +1,10 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /********* * Get the chastity bra that the user is wearing. * + * - (server id) serverID - The server this is running on * - (user id) user - The user ID of the chastity bra to retrieve * --- * ##### Returns the chastity bra object for the user. All chastity bra objects will have these properties: @@ -12,12 +14,9 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * - stateligible: If the chastity bra is restored from /outfit or other methods, will be **false** and won't be counted for longest chastity worn. * ###### Additional properties may be added by other functions *********/ -function getChastityBra(user) { +function getChastityBra(serverID, user) { traceFirstParam(arguments[0]); - if (process.chastitybra == undefined) { - process.chastitybra = {}; - } - return process.chastitybra[user]; + return getProcessVariable(serverID, user, "chastitybra") } exports.getChastityBra = getChastityBra; \ No newline at end of file diff --git a/functions/getters/chastity/getChastityBraKeyholder.js b/functions/getters/chastity/getChastityBraKeyholder.js index 057f61ee..cf62b529 100644 --- a/functions/getters/chastity/getChastityBraKeyholder.js +++ b/functions/getters/chastity/getChastityBraKeyholder.js @@ -4,13 +4,14 @@ const { getChastityBra } = require("./getChastityBra"); /********** * Gets the primary keyholder for a person's chastity bra. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID to get the chastity bra for * --- * ##### Returns a string with the user ID of the primary keyholder for the user's chastity bra. **********/ -function getChastityBraKeyholder(user) { +function getChastityBraKeyholder(serverID, user) { traceFirstParam(arguments[0]); - return getChastityBra(user)?.keyholder; + return getChastityBra(serverID, user)?.keyholder; } exports.getChastityBraKeyholder = getChastityBraKeyholder; \ No newline at end of file diff --git a/functions/getters/chastity/getChastityBraKeys.js b/functions/getters/chastity/getChastityBraKeys.js index 36e4744d..3182d29f 100644 --- a/functions/getters/chastity/getChastityBraKeys.js +++ b/functions/getters/chastity/getChastityBraKeys.js @@ -3,18 +3,22 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Gets the currently held chastity bra keys by the user. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID to get keys held by * --- * ##### Returns an array of user IDs the user is the primary keyholder for. **********/ -function getChastityBraKeys(user) { +function getChastityBraKeys(serverID, user) { traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } + if (process.chastitybra[serverID] == undefined) { + process.chastitybra[serverID] = {}; + } let keysheld = []; - Object.keys(process.chastitybra).forEach((k) => { - if ((process.chastitybra[k].keyholder == user) && (!process.chastitybra[k]?.fumbled)) { + Object.keys(process.chastitybra[serverID]).forEach((k) => { + if ((process.chastitybra[serverID][k].keyholder == user) && (!process.chastitybra[serverID][k]?.fumbled)) { keysheld.push(k); } }); diff --git a/functions/getters/chastity/getChastityBraName.js b/functions/getters/chastity/getChastityBraName.js index 15925857..98509100 100644 --- a/functions/getters/chastity/getChastityBraName.js +++ b/functions/getters/chastity/getChastityBraName.js @@ -1,8 +1,10 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /************ * Gets the full chastity bra name of the User ID. Optionally will get the full chastity bra name of a chastity bra by ID. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID to get the chastity bra name of * - (string) chastityname - The chastity bra ID to retrieve the full name of * ##### *Note: This function should use either/or param, not both.* @@ -11,22 +13,17 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * --- * ###### Note: Needs rework into separate getChastityName and getChastityNameOnUser functions ************/ -function getChastityBraName(userID, chastityname) { +function getChastityBraName(serverID, userID, chastityname) { traceFirstParam(arguments[0]); - if (process.chastitybra == undefined) { - process.chastitybra = {}; - } let convertchastityarr = {}; for (let i = 0; i < process.autocompletes.chastitybra.length; i++) { convertchastityarr[process.autocompletes.chastitybra[i].value] = process.autocompletes.chastitybra[i].name; } if (chastityname) { return convertchastityarr[chastityname]; - } else if (process.chastitybra[userID]?.chastitytype) { - return convertchastityarr[process.chastitybra[userID]?.chastitytype]; } else { - return undefined; - } + return getProcessVariable(serverID, userID, "chastitybra").chastitytype; + } } exports.getChastityBraName = getChastityBraName; \ No newline at end of file diff --git a/functions/other/TESTS/traceFirstParam.js b/functions/other/TESTS/traceFirstParam.js index d2f54312..d5c85da5 100644 --- a/functions/other/TESTS/traceFirstParam.js +++ b/functions/other/TESTS/traceFirstParam.js @@ -12,15 +12,9 @@ * ##### Returns true if it is a server ID, crashes if it's not. *******/ function traceFirstParam(serverID) { - if (process.serversjoined == undefined) { process.serversjoined = [] } - if (!process.serversjoined.includes(serverID)) { - process.client.guilds.fetch(serverID).then((g) => { - process.serversjoined.push(serverID); - }) - .catch((err) => { - console.error(`Invalid server ID ${serverID}!`) - throw new Error(err) - }) + if (!process.client.guilds.cache.get(serverID)) { + console.error(`Invalid server ID ${serverID}!`) + throw new Error(err) } } diff --git a/index.js b/index.js index 4a120ae8..a7174531 100644 --- a/index.js +++ b/index.js @@ -241,6 +241,7 @@ client.on("clientReady", async () => { if (process.recentmessages == undefined) { process.recentmessages = {} } try { await client.application.fetch(); + await client.guilds.fetch(); console.log(`Bot is owned by user ID ${client?.application?.owner.id}`) console.log(`Executable Functions: [${Array.from(commands.keys()).join(", ")}]`); console.log(`Modals: [${Array.from(modalHandlers.keys()).join(", ")}]`); From f10f5619fa567d71fdf059e50e72c34d8b8493d3 Mon Sep 17 00:00:00 2001 From: Enraa Date: Tue, 16 Jun 2026 23:02:12 -0700 Subject: [PATCH 05/44] Update getters/chastity for serverID --- .../getters/arousal/getArousalChangeDescription.js | 2 +- functions/getters/arousal/getArousalDescription.js | 2 +- functions/getters/arousal/getArousedTexts.js | 4 ++-- functions/getters/chastity/getChastityBraName.js | 2 +- .../getters/chastity/getChastityBraTimelock.js | 12 +++++++----- functions/getters/chastity/getChastityKeyholder.js | 5 +++-- functions/getters/chastity/getChastityKeys.js | 10 +++++++--- functions/getters/chastity/getChastityName.js | 10 +++++----- functions/getters/chastity/getChastityTimelock.js | 9 +++++---- .../getters/chastity/getClonedChastityBraKey.js | 5 +++-- .../chastity/getClonedChastityBraKeysOwned.js | 12 ++++++++---- functions/getters/chastity/getClonedChastityKey.js | 5 +++-- .../getters/chastity/getClonedChastityKeysOwned.js | 12 ++++++++---- functions/getters/chastity/getCombinedTraits.js | 10 ++++++---- functions/getters/chastity/getOtherKeysChastity.js | 14 +++++++++----- .../getters/chastity/getOtherKeysChastityBra.js | 12 ++++++++---- functions/getters/chastity/getVibeEquivalent.js | 4 ++-- jsconfig.json | 7 +++++-- 18 files changed, 84 insertions(+), 53 deletions(-) diff --git a/functions/getters/arousal/getArousalChangeDescription.js b/functions/getters/arousal/getArousalChangeDescription.js index 351e0e46..1a2247e8 100644 --- a/functions/getters/arousal/getArousalChangeDescription.js +++ b/functions/getters/arousal/getArousalChangeDescription.js @@ -16,7 +16,7 @@ const ORGASM_LIMIT = 10; **********/ function getArousalChangeDescription(serverID, user) { traceFirstParam(arguments[0]); - if (getOption(user, "arousalsystem") != 2) return null; + if (getOption(serverID, user, "arousalsystem") != 2) return null; const arousal = getProcessVariable(serverID, user, "arousal"); if (!arousal) return null; diff --git a/functions/getters/arousal/getArousalDescription.js b/functions/getters/arousal/getArousalDescription.js index 37327447..d445a4ce 100644 --- a/functions/getters/arousal/getArousalDescription.js +++ b/functions/getters/arousal/getArousalDescription.js @@ -18,7 +18,7 @@ const RESET_LIMIT = 0.1; **********/ function getArousalDescription(serverID, user) { traceFirstParam(arguments[0]); - if (getOption(user, "arousalsystem") === 0) return null; // Disabled Arousal system + if (getOption(serverID, user, "arousalsystem") === 0) return null; // Disabled Arousal system const arousal = getArousal(serverID, user); const denialCoefficient = calcDenialCoefficient(serverID, user); diff --git a/functions/getters/arousal/getArousedTexts.js b/functions/getters/arousal/getArousedTexts.js index 13496b4a..8ff48fa3 100644 --- a/functions/getters/arousal/getArousedTexts.js +++ b/functions/getters/arousal/getArousedTexts.js @@ -16,7 +16,7 @@ function getArousedTexts(serverID, user) { traceFirstParam(arguments[0]); const texts = []; - if (getOption(user, "arousalsystem") == 2) { + if (getOption(serverID, user, "arousalsystem") == 2) { const arousal = getProcessVariable(serverID, user, "arousal"); const current = arousal.arousal; const change = arousal.arousal - arousal.prev; @@ -24,7 +24,7 @@ function getArousedTexts(serverID, user) { if ((min < 0 || min <= current) && (max < 0 || max >= current) && (minChange < 0 || minChange <= change) && (maxChange < 0 || maxChange >= change)) texts.push(text); } } else { - const arousal = calcStaticVibeIntensity(user); + const arousal = calcStaticVibeIntensity(serverID, user); for (const [min, max, _0, _1, text] of arousedtexts) { if ((min < 0 || min <= arousal) && (max < 0 || max >= arousal)) texts.push(text); diff --git a/functions/getters/chastity/getChastityBraName.js b/functions/getters/chastity/getChastityBraName.js index 98509100..533e0454 100644 --- a/functions/getters/chastity/getChastityBraName.js +++ b/functions/getters/chastity/getChastityBraName.js @@ -22,7 +22,7 @@ function getChastityBraName(serverID, userID, chastityname) { if (chastityname) { return convertchastityarr[chastityname]; } else { - return getProcessVariable(serverID, userID, "chastitybra").chastitytype; + return convertchastityarr[getProcessVariable(serverID, userID, "chastitybra").chastitytype]; } } diff --git a/functions/getters/chastity/getChastityBraTimelock.js b/functions/getters/chastity/getChastityBraTimelock.js index 6ce37339..552e2ff3 100644 --- a/functions/getters/chastity/getChastityBraTimelock.js +++ b/functions/getters/chastity/getChastityBraTimelock.js @@ -1,23 +1,25 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getChastityBra } = require("./getChastityBra"); /*********** * Returns UNIX timestring of the wearer's unlock time for their chastity bra if they are timelocked. * - * - (user id) user - The User ID wearing the chastity bra. + * - (server id) serverID - The server this is running on + * - (user id) userID - The User ID wearing the chastity bra. * - (boolean) UNIXTimestring? - If true, returns a Discord UNIX timestring instead * --- * ##### Returns an integer with the unlockTime or a string with the unlock time for Discord. ***********/ -function getChastityBraTimelock(user, UNIXTimestring) { +function getChastityBraTimelock(serverID, userID, UNIXTimestring) { traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } if (!UNIXTimestring) { - return process.chastitybra[user]?.unlockTime; + return getChastityBra(serverID, user)?.unlockTime; } else { - if (process.chastitybra[user]?.unlockTime) { - return ``; + if (getChastityBra(serverID, user)?.unlockTime) { + return ``; } else { return null; } diff --git a/functions/getters/chastity/getChastityKeyholder.js b/functions/getters/chastity/getChastityKeyholder.js index 871ec5c6..b6d57a8a 100644 --- a/functions/getters/chastity/getChastityKeyholder.js +++ b/functions/getters/chastity/getChastityKeyholder.js @@ -4,13 +4,14 @@ const { getChastity } = require("./getChastity"); /********** * Gets the primary keyholder for a person's chastity belt. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID to get the chastity belt for * --- * ##### Returns a string with the user ID of the primary keyholder for the user's chastity belt. **********/ -function getChastityKeyholder(user) { +function getChastityKeyholder(serverID, user) { traceFirstParam(arguments[0]); - return getChastity(user)?.keyholder; + return getChastity(serverID, user)?.keyholder; } exports.getChastityKeyholder = getChastityKeyholder; \ No newline at end of file diff --git a/functions/getters/chastity/getChastityKeys.js b/functions/getters/chastity/getChastityKeys.js index 118b9f1c..09ac2c43 100644 --- a/functions/getters/chastity/getChastityKeys.js +++ b/functions/getters/chastity/getChastityKeys.js @@ -3,18 +3,22 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Gets the currently held chastity belt keys by the user. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID to get keys held by * --- * ##### Returns an array of user IDs the user is the primary keyholder for. **********/ -function getChastityKeys(user) { +function getChastityKeys(serverID, user) { traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } + if (process.chastity[serverID] == undefined) { + process.chastity[serverID] = {}; + } let keysheld = []; - Object.keys(process.chastity).forEach((k) => { - if ((process.chastity[k].keyholder == user) && (!process.chastity[k]?.fumbled)) { + Object.keys(process.chastity[serverID]).forEach((k) => { + if ((process.chastity[serverID][k].keyholder == user) && (!process.chastity[serverID][k]?.fumbled)) { keysheld.push(k); } }); diff --git a/functions/getters/chastity/getChastityName.js b/functions/getters/chastity/getChastityName.js index eb60513b..7c130f3f 100644 --- a/functions/getters/chastity/getChastityName.js +++ b/functions/getters/chastity/getChastityName.js @@ -1,8 +1,10 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /************ * Gets the full chastity belt name of the User ID. Optionally will get the full chastity belt name of a chastity belt by ID. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID to get the chastity belt name of * - (string) chastityname - The chastity belt ID to retrieve the full name of * ##### *Note: This function should use either/or param, not both.* @@ -11,7 +13,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * --- * ###### Note: Needs rework into separate getChastityName and getChastityNameOnUser functions ************/ -function getChastityName(userID, chastityname) { +function getChastityName(serverID, userID, chastityname) { traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; @@ -22,11 +24,9 @@ function getChastityName(userID, chastityname) { } if (chastityname) { return convertchastityarr[chastityname]; - } else if (process.chastity[userID]?.chastitytype) { - return convertchastityarr[process.chastity[userID]?.chastitytype]; } else { - return undefined; - } + return convertchastityarr[getProcessVariable(serverID, userID, "chastitybra").chastitytype]; + } } exports.getChastityName = getChastityName; \ No newline at end of file diff --git a/functions/getters/chastity/getChastityTimelock.js b/functions/getters/chastity/getChastityTimelock.js index bf7bbf49..9b60874d 100644 --- a/functions/getters/chastity/getChastityTimelock.js +++ b/functions/getters/chastity/getChastityTimelock.js @@ -4,18 +4,19 @@ const { getChastity } = require("./getChastity"); /*********** * Returns UNIX timestring of the wearer's unlock time for their chastity belt if they are timelocked. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID wearing the chastity belt. * - (boolean) UNIXTimestring? - If true, returns a Discord UNIX timestring instead * --- * ##### Returns an integer with the unlockTime or a string with the unlock time for Discord. ***********/ -function getChastityTimelock(user, UNIXTimestring) { +function getChastityTimelock(serverID, user, UNIXTimestring) { traceFirstParam(arguments[0]); if (!UNIXTimestring) { - return getChastity(user)?.unlockTime; + return getChastity(serverID, user)?.unlockTime; } else { - if (getChastity(user)?.unlockTime) { - return ``; + if (getChastity(serverID, user)?.unlockTime) { + return ``; } else { return null; } diff --git a/functions/getters/chastity/getClonedChastityBraKey.js b/functions/getters/chastity/getClonedChastityBraKey.js index 9338d9e6..b387f4f6 100644 --- a/functions/getters/chastity/getClonedChastityBraKey.js +++ b/functions/getters/chastity/getClonedChastityBraKey.js @@ -4,13 +4,14 @@ const { getChastityBra } = require("./getChastityBra"); /********* * Gets a list of users with secondary key access to the user's chastity bra. * + * - (server id) serverID - The server this is running on * - (user id) userID - The User ID wearing the collar * --- * ##### Returns an array of user IDs with secondary access to this collar. *********/ -function getClonedChastityBraKey(userID) { +function getClonedChastityBraKey(serverID, userID) { traceFirstParam(arguments[0]); - return getChastityBra(userID)?.clonedKeyholders ?? []; + return getChastityBra(serverID, userID)?.clonedKeyholders ?? []; }; exports.getClonedChastityBraKey = getClonedChastityBraKey; \ No newline at end of file diff --git a/functions/getters/chastity/getClonedChastityBraKeysOwned.js b/functions/getters/chastity/getClonedChastityBraKeysOwned.js index cbde19cf..e1b8b69b 100644 --- a/functions/getters/chastity/getClonedChastityBraKeysOwned.js +++ b/functions/getters/chastity/getClonedChastityBraKeysOwned.js @@ -3,19 +3,23 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /*********** * Gets a list of cloned chastity bra keys the user is holding. * + * - (server ID) serverID - The server this is running on * - (user ID) userID - The user to check held keys * --- * ##### Returns an array of held cloned chastity bra keys in the format "0000000000000000_chastitybra" ***********/ -function getClonedChastityBraKeysOwned(userID) { +function getClonedChastityBraKeysOwned(serverID, userID) { traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } + if (process.chastitybra[serverID] == undefined) { + process.chastitybra[serverID] = {}; + } let ownedkeys = []; - Object.keys(process.chastitybra).forEach((k) => { - if (process.chastitybra[k].clonedKeyholders) { - if (process.chastitybra[k].clonedKeyholders.includes(userID)) { + Object.keys(process.chastitybra[serverID]).forEach((k) => { + if (process.chastitybra[serverID][k].clonedKeyholders) { + if (process.chastitybra[serverID][k].clonedKeyholders.includes(userID)) { ownedkeys.push(`${k}_chastitybra`); } } diff --git a/functions/getters/chastity/getClonedChastityKey.js b/functions/getters/chastity/getClonedChastityKey.js index f6a1bf1b..b1f37480 100644 --- a/functions/getters/chastity/getClonedChastityKey.js +++ b/functions/getters/chastity/getClonedChastityKey.js @@ -4,13 +4,14 @@ const { getChastity } = require("./getChastity"); /********* * Gets a list of users with secondary key access to the user's chastity belt. * + * - (server id) serverID - The server this is running on * - (user id) userID - The User ID wearing the collar * --- * ##### Returns an array of user IDs with secondary access to this collar. *********/ -function getClonedChastityKey(userID) { +function getClonedChastityKey(serverID, userID) { traceFirstParam(arguments[0]); - return getChastity(userID)?.clonedKeyholders ?? []; + return getChastity(serverID, userID)?.clonedKeyholders ?? []; }; exports.getClonedChastityKey = getClonedChastityKey; \ No newline at end of file diff --git a/functions/getters/chastity/getClonedChastityKeysOwned.js b/functions/getters/chastity/getClonedChastityKeysOwned.js index 8ca46de0..1cf92513 100644 --- a/functions/getters/chastity/getClonedChastityKeysOwned.js +++ b/functions/getters/chastity/getClonedChastityKeysOwned.js @@ -3,19 +3,23 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /*********** * Gets a list of cloned chastity belt keys the user is holding. * + * - (server id) serverID - The server this is running on * - (user ID) userID - The user to check held keys * --- * ##### Returns an array of held cloned chastity belt keys in the format "0000000000000000_chastitybelt" ***********/ -function getClonedChastityKeysOwned(userID) { +function getClonedChastityKeysOwned(serverID, userID) { traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } + if (process.chastity[serverID] == undefined) { + process.chastity[serverID] = {}; + } let ownedkeys = []; - Object.keys(process.chastity).forEach((k) => { - if (process.chastity[k].clonedKeyholders) { - if (process.chastity[k].clonedKeyholders.includes(userID)) { + Object.keys(process.chastity[serverID]).forEach((k) => { + if (process.chastity[serverID][k].clonedKeyholders) { + if (process.chastity[serverID][k].clonedKeyholders.includes(userID)) { ownedkeys.push(`${k}_chastitybelt`); } } diff --git a/functions/getters/chastity/getCombinedTraits.js b/functions/getters/chastity/getCombinedTraits.js index 036a487e..e9cb40c9 100644 --- a/functions/getters/chastity/getCombinedTraits.js +++ b/functions/getters/chastity/getCombinedTraits.js @@ -59,6 +59,7 @@ function bounded(min, val, max) { /******** * Get the combined chastity related traits for a user, accounting for chastity belt and bra, if worn. * + * - (server id) serverID - The server this is running on * - (user id) user - The person wearing the chastity devices * --- * ##### Returns an object with the following properties: @@ -77,15 +78,16 @@ function bounded(min, val, max) { * - orgasmCooldown: Multiplier for how long a wearer is immune to arousal gains after letting go. * - orgasmArousalLeft: Percentage of arousal that will be left on the wearer after letting go. ********/ -function getCombinedTraits(user) { +function getCombinedTraits(serverID, user) { traceFirstParam(arguments[0]); // Build an object which references the combined properties // Any FUNCTIONS will be called from both when their respective unlock is called. - const beltbase = getChastity(user) ? getBaseChastity(getChastity(user).chastitytype ?? "belt_silver") : undefined; - const brabase = getChastityBra(user) ? getBaseChastity(getChastityBra(user).chastitytype ?? "bra_silver") : undefined; + const beltbase = getChastity(serverID, user) ? getBaseChastity(getChastity(serverID, user).chastitytype ?? "belt_silver") : undefined; + const brabase = getChastityBra(serverID, user) ? getBaseChastity(getChastityBra(serverID, user).chastitytype ?? "bra_silver") : undefined; if (!beltbase && !brabase) return NO_CHASTITY; let datatopass = { - userID: user + userID: user, + serverID: serverID } // Because the usual stuff found in return object are typically referenced NOT as functions, we're gonna // parse them here. I don't think this is the best solution, admittedly, but it should suffice. diff --git a/functions/getters/chastity/getOtherKeysChastity.js b/functions/getters/chastity/getOtherKeysChastity.js index 0f875120..919fe606 100644 --- a/functions/getters/chastity/getOtherKeysChastity.js +++ b/functions/getters/chastity/getOtherKeysChastity.js @@ -3,21 +3,25 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Gets a combined list of cloned keys for chastity belts the userID is the primary keyholder for * + * - (server id) serverID - The server this is running on * - (user ID) userID - The primary keyholder of restraints * --- * ##### Returns an array of cloned chastity belt keys in the format "0000000000000000_00000000000000000" where the first set of 0s * ##### is the person wearing the restraint, and the second set is the person holding the key clone. **********/ -function getOtherKeysChastity(userID) { +function getOtherKeysChastity(serverID, userID) { traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } + if (process.chastity[serverID] == undefined) { + process.chastity[serverID] = {}; + } let ownedkeys = []; - Object.keys(process.chastity).forEach((k) => { - if (process.chastity[k].keyholder == userID) { - if (process.chastity[k].clonedKeyholders) { - process.chastity[k].clonedKeyholders.forEach((c) => { + Object.keys(process.chastity[serverID]).forEach((k) => { + if (process.chastity[serverID][k].keyholder == userID) { + if (process.chastity[serverID][k].clonedKeyholders) { + process.chastity[serverID][k].clonedKeyholders.forEach((c) => { ownedkeys.push(`${k}_${c}`); }); } diff --git a/functions/getters/chastity/getOtherKeysChastityBra.js b/functions/getters/chastity/getOtherKeysChastityBra.js index d1376aaf..17532aa9 100644 --- a/functions/getters/chastity/getOtherKeysChastityBra.js +++ b/functions/getters/chastity/getOtherKeysChastityBra.js @@ -3,6 +3,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Gets a combined list of cloned keys for chastity bras the userID is the primary keyholder for * + * - (server id) serverID - The server this is running on * - (user ID) userID - The primary keyholder of restraints * --- * ##### Returns an array of cloned chastity bra keys in the format "0000000000000000_00000000000000000" where the first set of 0s @@ -13,11 +14,14 @@ function getOtherKeysChastityBra(userID) { if (process.chastitybra == undefined) { process.chastitybra = {}; } + if (process.chastitybra[serverID] == undefined) { + process.chastitybra[serverID] = {}; + } let ownedkeys = []; - Object.keys(process.chastitybra).forEach((k) => { - if (process.chastitybra[k].keyholder == userID) { - if (process.chastitybra[k].clonedKeyholders) { - process.chastitybra[k].clonedKeyholders.forEach((c) => { + Object.keys(process.chastitybra[serverID]).forEach((k) => { + if (process.chastitybra[serverID][k].keyholder == userID) { + if (process.chastitybra[serverID][k].clonedKeyholders) { + process.chastitybra[serverID][k].clonedKeyholders.forEach((c) => { ownedkeys.push(`${k}_${c}`); }); } diff --git a/functions/getters/chastity/getVibeEquivalent.js b/functions/getters/chastity/getVibeEquivalent.js index a00081e5..2e46b11e 100644 --- a/functions/getters/chastity/getVibeEquivalent.js +++ b/functions/getters/chastity/getVibeEquivalent.js @@ -16,10 +16,10 @@ const STUTTER_LIMIT = 1; ***********/ function getVibeEquivalent(serverID, user) { traceFirstParam(arguments[0]); - if (getOption(user, "arousalsystem") != 2) return calcStaticVibeIntensity(user) * 2; + if (getOption(serverID, user, "arousalsystem") != 2) return calcStaticVibeIntensity(serverID, user) * 2; let intensity = getArousal(serverID, user); - if (intensity >= STUTTER_LIMIT) intensity += calcFrustration(user) / 20; + if (intensity >= STUTTER_LIMIT) intensity += calcFrustration(serverID, user) / 20; return intensity; } diff --git a/jsconfig.json b/jsconfig.json index 7db50e99..1219a9b6 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -1,7 +1,10 @@ { "compilerOptions": { - "module": "commonjs", - "target": "es6", + "target": "ES2022", + "module": "CommonJS", + "moduleResolution": "Node", + "ignoreDeprecations": "6.0", + "resolveJsonModule": true, }, "exclude": ["node_modules", "dist"], "include": ["functions/*", "lists/*"], From d685146ac96c9a607723e4284ed0cd0a6f475e3a Mon Sep 17 00:00:00 2001 From: Enraa Date: Tue, 16 Jun 2026 23:15:35 -0700 Subject: [PATCH 06/44] Some collar updates --- .../getters/chastity/getChastityBraName.js | 4 +- functions/getters/chastity/getChastityName.js | 7 +--- functions/getters/collar/canAccessCollar.js | 39 ++++++++++--------- .../getters/collar/getClonedCollarKey.js | 5 ++- .../collar/getClonedCollarKeysOwned.js | 12 ++++-- functions/getters/collar/getCollar.js | 16 +++----- .../getters/collar/getCollarKeyholder.js | 5 ++- functions/getters/collar/getCollarKeys.js | 10 +++-- functions/getters/collar/getCollarName.js | 10 ++--- 9 files changed, 53 insertions(+), 55 deletions(-) diff --git a/functions/getters/chastity/getChastityBraName.js b/functions/getters/chastity/getChastityBraName.js index 533e0454..605c166f 100644 --- a/functions/getters/chastity/getChastityBraName.js +++ b/functions/getters/chastity/getChastityBraName.js @@ -1,5 +1,5 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); -const { getProcessVariable } = require("../config/getProcessVariable"); +const { getChastityBra } = require("./getChastityBra"); /************ * Gets the full chastity bra name of the User ID. Optionally will get the full chastity bra name of a chastity bra by ID. @@ -22,7 +22,7 @@ function getChastityBraName(serverID, userID, chastityname) { if (chastityname) { return convertchastityarr[chastityname]; } else { - return convertchastityarr[getProcessVariable(serverID, userID, "chastitybra").chastitytype]; + return convertchastityarr[getChastityBra(serverID, userID)?.chastitytype]; } } diff --git a/functions/getters/chastity/getChastityName.js b/functions/getters/chastity/getChastityName.js index 7c130f3f..54187c86 100644 --- a/functions/getters/chastity/getChastityName.js +++ b/functions/getters/chastity/getChastityName.js @@ -1,5 +1,5 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); -const { getProcessVariable } = require("../config/getProcessVariable"); +const { getChastity } = require("./getChastity"); /************ * Gets the full chastity belt name of the User ID. Optionally will get the full chastity belt name of a chastity belt by ID. @@ -15,9 +15,6 @@ const { getProcessVariable } = require("../config/getProcessVariable"); ************/ function getChastityName(serverID, userID, chastityname) { traceFirstParam(arguments[0]); - if (process.chastity == undefined) { - process.chastity = {}; - } let convertchastityarr = {}; for (let i = 0; i < process.autocompletes.chastitybelt.length; i++) { convertchastityarr[process.autocompletes.chastitybelt[i].value] = process.autocompletes.chastitybelt[i].name; @@ -25,7 +22,7 @@ function getChastityName(serverID, userID, chastityname) { if (chastityname) { return convertchastityarr[chastityname]; } else { - return convertchastityarr[getProcessVariable(serverID, userID, "chastitybra").chastitytype]; + return convertchastityarr[getChastity(serverID, userID)?.chastitytype]; } } diff --git a/functions/getters/collar/canAccessCollar.js b/functions/getters/collar/canAccessCollar.js index d4b6cabe..0466f53b 100644 --- a/functions/getters/collar/canAccessCollar.js +++ b/functions/getters/collar/canAccessCollar.js @@ -4,6 +4,7 @@ const { getCollar } = require("./getCollar"); /************ * Checks whether the keyholder has access to do things to the collaruser. * + * - (server id) serverID - The server this is running on * - (user id) collaruser - The User ID who is **wearing** the collar * - (user id) keyholder - The User ID who is **performing the action** * - (boolean) unlock - If this action involves unlocking and removing the collar @@ -14,7 +15,7 @@ const { getCollar } = require("./getCollar"); * - public: Is this action permitted because of public access? * - hascollar: Is the **collaruser** wearing a collar? ************/ -function canAccessCollar(collaruser, keyholder, unlock, cloning) { +function canAccessCollar(serverID, collaruser, keyholder, unlock, cloning) { traceFirstParam(arguments[0]); // As a reference for access in timelocks: // 0: "Everyone Else" @@ -23,27 +24,27 @@ function canAccessCollar(collaruser, keyholder, unlock, cloning) { let accessval = { access: false, public: false, hascollar: true }; // no collar, no need - if (!getCollar(collaruser)) { + if (!getCollar(serverID, collaruser)) { accessval.hascollar = false; return accessval; } // Sealed Collar - nobody gets in! - if (getCollar(collaruser)?.access == 2) { + if (getCollar(serverID, collaruser)?.access == 2) { return accessval; } // If unlock is set, only allow access to unlock if the keyholder is the correct one. if (unlock) { // Allow unlocks by a non-self keyholder at all times, assuming its not sealed. - if (getCollar(collaruser)?.access != 2 && getCollar(collaruser)?.keyholder == keyholder && keyholder != collaruser && !getCollar(collaruser)?.fumbled) { + if (getCollar(serverID, collaruser)?.access != 2 && getCollar(serverID, collaruser)?.keyholder == keyholder && keyholder != collaruser && !getCollar(serverID, collaruser)?.fumbled) { accessval.access = true; } // Allow unlocks by any keyholder if no timelock. - if (getCollar(collaruser)?.access == undefined && getCollar(collaruser)?.keyholder == keyholder && !getCollar(collaruser)?.fumbled) { + if (getCollar(serverID, collaruser)?.access == undefined && getCollar(serverID, collaruser)?.keyholder == keyholder && !getCollar(serverID, collaruser)?.fumbled) { accessval.access = true; } // Allow unlocks by secondary keyholder if no timelock - let clonedkeys = getCollar(collaruser)?.clonedKeyholders ?? []; - if (getCollar(collaruser)?.access == undefined && clonedkeys.includes(keyholder)) { + let clonedkeys = getCollar(serverID, collaruser)?.clonedKeyholders ?? []; + if (getCollar(serverID, collaruser)?.access == undefined && clonedkeys.includes(keyholder)) { accessval.access = true; } // Else, return false. @@ -52,55 +53,55 @@ function canAccessCollar(collaruser, keyholder, unlock, cloning) { } if (cloning) { // Others access only when access is set to 0. - if (getCollar(collaruser)?.access == 0 && keyholder != collaruser) { + if (getCollar(serverID, collaruser)?.access == 0 && keyholder != collaruser) { accessval.access = true; accessval.public = true; } // Keyholder access if access is unset (no timelocks) - if (getCollar(collaruser)?.access == undefined && getCollar(collaruser)?.keyholder == keyholder && !getCollar(collaruser)?.fumbled) { + if (getCollar(serverID, collaruser)?.access == undefined && getCollar(serverID, collaruser)?.keyholder == keyholder && !getCollar(serverID, collaruser)?.fumbled) { accessval.access = true; } // Keyholder access if timelock is 1 (keyholder only) but only if not self. - if (getCollar(collaruser)?.access == 1 && getCollar(collaruser)?.keyholder == keyholder && collaruser != keyholder && !getCollar(collaruser)?.fumbled) { + if (getCollar(serverID, collaruser)?.access == 1 && getCollar(serverID, collaruser)?.keyholder == keyholder && collaruser != keyholder && !getCollar(serverID, collaruser)?.fumbled) { accessval.access = true; } return accessval; } // Others access only when access is set to 0. - if (getCollar(collaruser)?.access == 0 && keyholder != collaruser) { + if (getCollar(serverID, collaruser)?.access == 0 && keyholder != collaruser) { accessval.access = true; accessval.public = true; } // Keyholder access if access is unset (no timelocks) - if (getCollar(collaruser)?.access == undefined && getCollar(collaruser)?.keyholder == keyholder && !getCollar(collaruser)?.fumbled) { + if (getCollar(serverID, collaruser)?.access == undefined && getCollar(serverID, collaruser)?.keyholder == keyholder && !getCollar(serverID, collaruser)?.fumbled) { accessval.access = true; } // Secondary Keyholder access (cloned key), but only if cloning is NOT true and no timelocks - let clonedkeys = getCollar(collaruser)?.clonedKeyholders ?? []; - if (clonedkeys.includes(keyholder) && getCollar(collaruser)?.access == undefined) { + let clonedkeys = getCollar(serverID, collaruser)?.clonedKeyholders ?? []; + if (clonedkeys.includes(keyholder) && getCollar(serverID, collaruser)?.access == undefined) { accessval.access = true; } // Keyholder access if timelock is 1 (keyholder only) but only if not self. - if (getCollar(collaruser)?.access == 1 && getCollar(collaruser)?.keyholder == keyholder && collaruser != keyholder && !getCollar(collaruser)?.fumbled) { + if (getCollar(serverID, collaruser)?.access == 1 && getCollar(serverID, collaruser)?.keyholder == keyholder && collaruser != keyholder && !getCollar(serverID, collaruser)?.fumbled) { accessval.access = true; } // Secondary Keyholder access (cloned key) if access is 1, but only if not self. - if (clonedkeys.includes(keyholder) && getCollar(collaruser)?.access == 1 && collaruser != keyholder) { + if (clonedkeys.includes(keyholder) && getCollar(serverID, collaruser)?.access == 1 && collaruser != keyholder) { accessval.access = true; } // Free use collar if not locked. - if (!getCollar(collaruser)?.keyholder_only) { + if (!getCollar(serverID, collaruser)?.keyholder_only) { accessval.access = true; accessval.public = true; } // Free use collar if not locked. - if (getCollar(collaruser)?.headpatvulnerable && (getCollar(collaruser)?.headpatvulnerable >= Date.now())) { + if (getCollar(serverID, collaruser)?.headpatvulnerable && (getCollar(serverID, collaruser)?.headpatvulnerable >= Date.now())) { accessval.access = true; accessval.public = true; } // Keyholder access if temporary keyholder. - if (getCollar(collaruser)?.temporarykeyholder && (getCollar(collaruser)?.temporarykeyholder == keyholder) && (getCollar(collaruser)?.temporarykeyholdertime > Date.now())) { + if (getCollar(serverID, collaruser)?.temporarykeyholder && (getCollar(serverID, collaruser)?.temporarykeyholder == keyholder) && (getCollar(serverID, collaruser)?.temporarykeyholdertime > Date.now())) { accessval.access = true; } // Else, return false. diff --git a/functions/getters/collar/getClonedCollarKey.js b/functions/getters/collar/getClonedCollarKey.js index a3b9a258..33cc0788 100644 --- a/functions/getters/collar/getClonedCollarKey.js +++ b/functions/getters/collar/getClonedCollarKey.js @@ -4,13 +4,14 @@ const { getCollar } = require("./getCollar"); /********* * Gets a list of users with secondary key access to the collaruser. * + * - (server id) serverID - The server this is running on * - (user id) collaruser - The User ID wearing the collar * --- * ##### Returns an array of user IDs with secondary access to this collar. *********/ -function getClonedCollarKey(collaruser) { +function getClonedCollarKey(serverID, collaruser) { traceFirstParam(arguments[0]); - return getCollar(collaruser)?.clonedKeyholders ?? []; + return getCollar(serverID, collaruser)?.clonedKeyholders ?? []; } exports.getClonedCollarKey = getClonedCollarKey; \ No newline at end of file diff --git a/functions/getters/collar/getClonedCollarKeysOwned.js b/functions/getters/collar/getClonedCollarKeysOwned.js index fc3af933..3744900b 100644 --- a/functions/getters/collar/getClonedCollarKeysOwned.js +++ b/functions/getters/collar/getClonedCollarKeysOwned.js @@ -3,19 +3,23 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /*********** * Gets a list of cloned collar keys the user is holding. * + * - (server ID) serverID - The server this is running on * - (user ID) userID - The user to check held keys * --- * ##### Returns an array of held cloned collar keys in the format "0000000000000000_collar" ***********/ -function getClonedCollarKeysOwned(userID) { +function getClonedCollarKeysOwned(serverID, userID) { traceFirstParam(arguments[0]); if (process.collar == undefined) { process.collar = {}; } + if (process.collar[serverID] == undefined) { + process.collar[serverID] = {}; + } let ownedkeys = []; - Object.keys(process.collar).forEach((k) => { - if (process.collar[k].clonedKeyholders) { - if (process.collar[k].clonedKeyholders.includes(userID)) { + Object.keys(process.collar[serverID]).forEach((k) => { + if (process.collar[serverID][k].clonedKeyholders) { + if (process.collar[serverID][k].clonedKeyholders.includes(userID)) { ownedkeys.push(`${k}_collar`); } } diff --git a/functions/getters/collar/getCollar.js b/functions/getters/collar/getCollar.js index 4f7bfe9d..9a9a98e8 100644 --- a/functions/getters/collar/getCollar.js +++ b/functions/getters/collar/getCollar.js @@ -1,9 +1,10 @@ -const { markForSave } = require("../../other/markForSave"); const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /********* * Gets the worn collar for a user. Returns the collar if it exists, or undefined if not. * + * - (server id) serverID - The server this is running on * - (user id) user - The user ID of the collar to retrieve * --- * ##### Returns the collar object for the user. All collar objects will have these properties: @@ -17,16 +18,9 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * - mask: Permission to apply headwear to the user * ###### Additional properties may be added by other functions *********/ -function getCollar(user) { - traceFirstParam(arguments[0]); - if (process.collar == undefined) { - process.collar = {}; - } - if (process.collar[user] && !process.collar[user].timestamp) { - process.collar[user].timestamp = Date.now(); - markForSave("collar"); - } - return process.collar[user]; +function getCollar(serverID, user) { + traceFirstParam(arguments[0]) + return getProcessVariable(serverID, user, "collar") }; exports.getCollar = getCollar; \ No newline at end of file diff --git a/functions/getters/collar/getCollarKeyholder.js b/functions/getters/collar/getCollarKeyholder.js index 5e3fe3f0..2380d6be 100644 --- a/functions/getters/collar/getCollarKeyholder.js +++ b/functions/getters/collar/getCollarKeyholder.js @@ -4,13 +4,14 @@ const { getCollar } = require("./getCollar"); /********** * Gets the primary keyholder for a person's collar. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID to get the collar for * --- * ##### Returns a string with the user ID of the primary keyholder for the user's collar. **********/ -function getCollarKeyholder(user) { +function getCollarKeyholder(serverID, user) { traceFirstParam(arguments[0]); - return getCollar(user)?.keyholder; + return getCollar(serverID, user)?.keyholder; } exports.getCollarKeyholder = getCollarKeyholder; \ No newline at end of file diff --git a/functions/getters/collar/getCollarKeys.js b/functions/getters/collar/getCollarKeys.js index 5e6555fa..71912baa 100644 --- a/functions/getters/collar/getCollarKeys.js +++ b/functions/getters/collar/getCollarKeys.js @@ -3,18 +3,22 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Gets the currently held collar keys by the user. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID to get keys held by * --- * ##### Returns an array of user IDs the user is the primary keyholder for. **********/ -function getCollarKeys(user) { +function getCollarKeys(serverID, user) { traceFirstParam(arguments[0]); if (process.collar == undefined) { process.collar = {}; } + if (process.collar[serverID] == undefined) { + process.collar[serverID] = {}; + } let keysheld = []; - Object.keys(process.collar).forEach((k) => { - if ((process.collar[k].keyholder == user) && (!process.collar[k]?.fumbled)) { + Object.keys(process.collar[serverID]).forEach((k) => { + if ((process.collar[serverID][k].keyholder == user) && (!process.collar[serverID][k]?.fumbled)) { keysheld.push(k); } }); diff --git a/functions/getters/collar/getCollarName.js b/functions/getters/collar/getCollarName.js index e8715132..7d588e20 100644 --- a/functions/getters/collar/getCollarName.js +++ b/functions/getters/collar/getCollarName.js @@ -3,6 +3,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /************ * Gets the full collar name of the User ID. Optionally will get the full collar name of a collar by ID. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID to get the collar name of * - (string) collarid - The collar ID to retrieve the collar name of * ##### *Note: This function should use either/or param, not both.* @@ -11,21 +12,16 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * --- * ###### Note: Needs rework into separate getCollarName and getCollarNameOnUser functions ************/ -function getCollarName(userID, collarid) { +function getCollarName(serverID, userID, collarid) { traceFirstParam(arguments[0]); - if (process.collar == undefined) { - process.collar = {}; - } let convertcollararr = {}; for (let i = 0; i < process.collartypes.length; i++) { convertcollararr[process.collartypes[i].value] = process.collartypes[i].name; } if (collarid) { return convertcollararr[collarid]; - } else if (process.collar[userID]?.collartype) { - return convertcollararr[process.collar[userID]?.collartype]; } else { - return undefined; + return convertcollararr[getCollar(serverID, userID)?.collartype]; } } From b87716e219e84cf9a7085df1899ec776a73592ae Mon Sep 17 00:00:00 2001 From: Enraa Date: Wed, 17 Jun 2026 18:36:33 -0700 Subject: [PATCH 07/44] more servers --- functions/getters/collar/getCollarPerm.js | 5 +++-- functions/getters/collar/getCollarTimelock.js | 9 +++++---- .../getters/collar/getOtherKeysCollar.js | 14 +++++++++----- .../getters/config/getAllSelectedOption.js | 9 +++++---- functions/getters/config/getAlternateName.js | 19 ++++++++++--------- 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/functions/getters/collar/getCollarPerm.js b/functions/getters/collar/getCollarPerm.js index 371e9b8a..3542a45d 100644 --- a/functions/getters/collar/getCollarPerm.js +++ b/functions/getters/collar/getCollarPerm.js @@ -4,14 +4,15 @@ const { getCollar } = require("./getCollar"); /******** * Returns a boolean or undefined for perms supplied to a collar. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID to get the collar for * - (string) perm - The permission to check for * --- * ##### Returns a boolean if permission is allowed or not, or undefined if not specified. ********/ -function getCollarPerm(user, perm) { +function getCollarPerm(serverID, user, perm) { traceFirstParam(arguments[0]); - return (getCollar(user) ? getCollar(user)[perm] : undefined) + return (getCollar(serverID, user) ? getCollar(serverID, user)[perm] : undefined) } exports.getCollarPerm = getCollarPerm; \ No newline at end of file diff --git a/functions/getters/collar/getCollarTimelock.js b/functions/getters/collar/getCollarTimelock.js index 28805f6c..be1bf08d 100644 --- a/functions/getters/collar/getCollarTimelock.js +++ b/functions/getters/collar/getCollarTimelock.js @@ -4,18 +4,19 @@ const { getCollar } = require("./getCollar"); /*********** * Returns UNIX timestring of the wearer's unlock time for their collar if they are timelocked. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID wearing the collar. * - (boolean) UNIXTimestring? - If true, returns a Discord UNIX timestring instead * --- * ##### Returns an integer with the unlockTime or a string with the unlock time for Discord. ***********/ -function getCollarTimelock(user, UNIXTimestring) { +function getCollarTimelock(serverID, user, UNIXTimestring) { traceFirstParam(arguments[0]); if (!UNIXTimestring) { - return getCollar(user)?.unlockTime; + return getCollar(serverID, user)?.unlockTime; } else { - if (getCollar(user)?.unlockTime) { - return ``; + if (getCollar(serverID, user)?.unlockTime) { + return ``; } else { return null; } diff --git a/functions/getters/collar/getOtherKeysCollar.js b/functions/getters/collar/getOtherKeysCollar.js index 7820ef40..b5567eb0 100644 --- a/functions/getters/collar/getOtherKeysCollar.js +++ b/functions/getters/collar/getOtherKeysCollar.js @@ -3,21 +3,25 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Gets a combined list of cloned keys for collars the userID is the primary keyholder for * + * - (server id) serverID - The server this is running on * - (user ID) userID - The primary keyholder of restraints * --- * ##### Returns an array of cloned collar keys in the format "0000000000000000_00000000000000000" where the first set of 0s * ##### is the person wearing the restraint, and the second set is the person holding the key clone. **********/ -function getOtherKeysCollar(userID) { +function getOtherKeysCollar(serverID, userID) { traceFirstParam(arguments[0]); if (process.collar == undefined) { process.collar = {}; } + if (process.collar[serverID] == undefined) { + process.collar[serverID] = {}; + } let ownedkeys = []; - Object.keys(process.collar).forEach((k) => { - if (process.collar[k].keyholder == userID) { - if (process.collar[k].clonedKeyholders) { - process.collar[k].clonedKeyholders.forEach((c) => { + Object.keys(process.collar[serverID]).forEach((k) => { + if (process.collar[serverID][k].keyholder == userID) { + if (process.collar[serverID][k].clonedKeyholders) { + process.collar[serverID][k].clonedKeyholders.forEach((c) => { ownedkeys.push(`${k}_${c}`); }); } diff --git a/functions/getters/config/getAllSelectedOption.js b/functions/getters/config/getAllSelectedOption.js index b5cf2aae..9aefac05 100644 --- a/functions/getters/config/getAllSelectedOption.js +++ b/functions/getters/config/getAllSelectedOption.js @@ -3,16 +3,17 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* * Fetches a list of all users setting for option mapped by user ID * + * - (server id) serverID - The server this is running on * - (string) option - The string name of the config option * --- * ##### Returns an object with keys corresponding to their set value *********/ -function getAllSelectedOption(option) { +function getAllSelectedOption(serverID, option) { traceFirstParam(arguments[0]); let selectedoption = {}; - if (process.configs && process.configs.users) { - Object.keys(process.configs.users).forEach((user) => { - selectedoption[user] = process.configs.users[user][option] + if (process.configs && process.configs.users && process.configs.users[serverID]) { + Object.keys(process.configs.users[serverID]).forEach((user) => { + selectedoption[user] = process.configs.users[serverID][user][option] }) } return selectedoption; diff --git a/functions/getters/config/getAlternateName.js b/functions/getters/config/getAlternateName.js index 01cae5be..4e59cb2d 100644 --- a/functions/getters/config/getAlternateName.js +++ b/functions/getters/config/getAlternateName.js @@ -8,24 +8,25 @@ const { getOption } = require("./getOption"); /********** * Retrieves any alternate name for the user * + * - (server ID) serverID - The server this is running on (technically derivable from the guild member param) * - (guild member) user - The user wearing name modifying items * --- * ##### Returns a string, either modified or the user's display name **********/ -function getAlternateName(user) { +function getAlternateName(serverID, user) { traceFirstParam(arguments[0]); let outname = user.displayName // We're putting a member object in here // Handle pet collar name - if ((getCollar(user.id)?.collartype == "collarengraved") || (getCollar(user.id) && getCollar(user.id).additionalcollars && getCollar(user.id).additionalcollars.includes("collarengraved"))) { - if (getOption(user.id, "engravedcollarname") && getOption(user.id, "engravedcollarname").length > 0) { - outname = getOption(user.id, "engravedcollarname"); + if ((getCollar(serverID, user.id)?.collartype == "collarengraved") || (getCollar(serverID, user.id) && getCollar(serverID, user.id).additionalcollars && getCollar(serverID, user.id).additionalcollars.includes("collarengraved"))) { + if (getOption(serverID, user.id, "engravedcollarname") && getOption(serverID, user.id, "engravedcollarname").length > 0) { + outname = getOption(serverID, user.id, "engravedcollarname"); } } // Handle Doll Visor name - if (getHeadwear(user.id).find((headwear) => DOLLVISORS.includes(headwear))) { - let dollIDOverride = getOption(user.id, "dollvisorname"); - let dollmaker = getHeadwear(user.id).find((headwear) => headwear === "dollmaker_visor"); + if (getHeadwear(serverID, user.id).find((headwear) => DOLLVISORS.includes(headwear))) { + let dollIDOverride = getOption(serverID, user.id, "dollvisorname"); + let dollmaker = getHeadwear(serverID, user.id).find((headwear) => headwear === "dollmaker_visor"); // If dollIDOverride is not specified or the override is exactly a string of numbers... // Force Dollmaker's Visor wearers to get this generation function if (!dollIDOverride || (Number.isFinite(dollIDOverride) && dollIDOverride.length < 6) || dollmaker) { @@ -43,8 +44,8 @@ function getAlternateName(user) { } // Handle Drone Visor name - if (getHeadwear(user.id).find((headwear) => DRONEVISORS.includes(headwear))) { - outname = `⬔-Drone ${getOption(user.id, "dronevisorname")}`; + if (getHeadwear(serverID, user.id).find((headwear) => DRONEVISORS.includes(headwear))) { + outname = `⬔-Drone ${getOption(serverID, user.id, "dronevisorname")}`; } // Finally, if the outname is EXACTLY the same as the displayName we recieved, From c16a737e3232ba6ee434ff8be01e00584a6b8696 Mon Sep 17 00:00:00 2001 From: Enraa Date: Wed, 17 Jun 2026 18:48:32 -0700 Subject: [PATCH 08/44] Update getDisplayTexts.js --- functions/getters/config/getDisplayTexts.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/getters/config/getDisplayTexts.js b/functions/getters/config/getDisplayTexts.js index 9dcfb877..18811cff 100644 --- a/functions/getters/config/getDisplayTexts.js +++ b/functions/getters/config/getDisplayTexts.js @@ -45,7 +45,8 @@ async function getDisplayTexts(serverID, userID, inspectuserID) { let lappeople = []; // Attempt to get the current guild member object for the user. This might have unintended consequences // however I'd have to retool the main function to narrow down to one guild. Too much work currently. - let inspectusername = (process.client.guilds.cache.map(guild => guild.members.cache.get(inspectuserID)).find(m => m !== undefined))?.displayName; + let guild = process.client.guilds.cache.get(serverID); + let inspectusername = Object.keys(process.heavy).forEach((k) => { let lapped = false; if (!Array.isArray(process.heavy[k])) { From dc88a2780077708d8a1e4314cfd24fdb2899a030 Mon Sep 17 00:00:00 2001 From: Enraa Date: Wed, 17 Jun 2026 23:28:46 -0700 Subject: [PATCH 09/44] On your mark --- functions/getters/config/getDisplayTexts.js | 48 ++++++++++--------- functions/getters/config/getOption.js | 20 ++++---- functions/getters/config/getOutfits.js | 12 ++--- functions/getters/config/getPFP.js | 16 ++++--- functions/getters/config/getPronouns.js | 11 ++--- functions/getters/config/getPronounsSet.js | 10 ++-- functions/getters/config/getUserTags.js | 5 +- functions/getters/config/getUserVar.js | 12 ++--- .../getters/config/getUsersWithOption.js | 9 ++-- functions/getters/config/statsGetAllStat.js | 17 +++---- functions/getters/config/statsGetCounter.js | 8 ++-- functions/getters/corset/getBreath.js | 5 +- functions/getters/corset/getCorset.js | 7 +-- functions/getters/corset/getCorsetBinder.js | 5 +- 14 files changed, 94 insertions(+), 91 deletions(-) diff --git a/functions/getters/config/getDisplayTexts.js b/functions/getters/config/getDisplayTexts.js index 18811cff..0817fa1d 100644 --- a/functions/getters/config/getDisplayTexts.js +++ b/functions/getters/config/getDisplayTexts.js @@ -7,6 +7,7 @@ const { getArousalDescription } = require("../arousal/getArousalDescription"); const { getHeavy } = require("../heavy/getHeavy"); const { getToys } = require("../toy/getToys"); const { getOption } = require("./getOption"); +const { getProcessVariable } = require("./getProcessVariable"); const { getUserVar } = require("./getUserVar"); /************* @@ -46,42 +47,43 @@ async function getDisplayTexts(serverID, userID, inspectuserID) { // Attempt to get the current guild member object for the user. This might have unintended consequences // however I'd have to retool the main function to narrow down to one guild. Too much work currently. let guild = process.client.guilds.cache.get(serverID); - let inspectusername = - Object.keys(process.heavy).forEach((k) => { - let lapped = false; - if (!Array.isArray(process.heavy[k])) { - console.log("Not an array") - console.log(process.heavy[k]) - } - else { - process.heavy[k].forEach((h) => { - // If its a lap and starts with the inspect user's name, then it's OURS - if ((h.type === "dominants_lap") && (h.displayname.startsWith(inspectusername ?? "undefined"))) { - lappeople.push(k) - } - }) - } - }) + let inspectusername = guild.members.get(inspectuserID).displayname + if (process.heavy && process.heavy[serverID]) { + Object.keys(process.heavy[serverID]).forEach((k) => { + if (!Array.isArray(process.heavy[serverID][k])) { + console.log("Not an array") + console.log(process.heavy[serverID][k]) + } + else { + process.heavy[serverID][k].forEach((h) => { + // If its a lap and starts with the inspect user's name, then it's OURS + if ((h.type === "dominants_lap") && (h.displayname.startsWith(inspectusername ?? "undefined"))) { + lappeople.push(k) + } + }) + } + }) + } if (lappeople.length > 0) { bartext = `${bartext}\n\nšŸ«‚ Subs in Lap: ${lappeople.map((m) => `<@${m}>`).join(", ")}` } // ****************** // ****************** Shared Gasmask --- Can't currently test this because linked was disabled for now. - if (process.headwear && process.headwear[inspectuserID] && process.headwear[inspectuserID].sharedbreathhose) { - bartext = `${bartext}\n\n${process.emojis.gasmask} Sharing Breath with: <@${process.headwear[inspectuserID].sharedbreathhose}>` + if (getProcessVariable(serverID, inspectuserID, "headwear").sharedbreathhose) { + bartext = `${bartext}\n\n${process.emojis.gasmask} Sharing Breath with: <@${getProcessVariable(serverID, inspectuserID, "headwear").sharedbreathhose}>` } // ****************** // ****************** Headpat Battery - if (getToys(inspectuserID).find((t) => t.type == "vibe_headpatbattery")) { - bartext = `${bartext}\n\nšŸ”‹ Headpat Vibrator Battery: **${Math.round(getUserVar(inspectuserID, "headpatvibecharge") * 100)}%**` + if (getToys(serverID, inspectuserID).find((t) => t.type == "vibe_headpatbattery")) { + bartext = `${bartext}\n\nšŸ”‹ Headpat Vibrator Battery: **${Math.round(getUserVar(serverID, inspectuserID, "headpatvibecharge") * 100)}%**` } // ****************** - // ****************** Headpat Battery - if (getHeavy(inspectuserID, "windupclockwork")) { - bartext = `${bartext}\n\nšŸ•°ļø Wind-up Key Tension: **${Math.round(getUserVar(inspectuserID, "windupcharge") * 100)}%**` + // ****************** Windup Clockwork + if (getHeavy(serverID, inspectuserID, "windupclockwork")) { + bartext = `${bartext}\n\nšŸ•°ļø Wind-up Key Tension: **${Math.round(getUserVar(serverID, inspectuserID, "windupcharge") * 100)}%**` } // ****************** diff --git a/functions/getters/config/getOption.js b/functions/getters/config/getOption.js index 7b4ab265..04a128ea 100644 --- a/functions/getters/config/getOption.js +++ b/functions/getters/config/getOption.js @@ -6,12 +6,13 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Gets the configured option for the user ID as set in /config * + * - (server id) serverID - The server this is on * - (user ID) userID - The person to check the config of * - (string) option - The string name of the config option * --- * ##### Returns the exact value of that configured option. Will use default if user has not configured it. ********/ -function getOption(userID, option) { +function getOption(serverID, userID, option) { traceFirstParam(arguments[0]); if (process.configs == undefined) { process.configs = {}; @@ -19,27 +20,30 @@ function getOption(userID, option) { if (process.configs.users == undefined) { process.configs.users = {}; } - if (process.configs.users[userID] == undefined) { - process.configs.users[userID] = {}; - initializeOptions(userID); + if (process.configs.users[serverID] == undefined) { + process.configs.users[serverID] = {}; } - if (process.configs.users[userID][option] == undefined) { + if (process.configs.users[serverID][userID] == undefined) { + process.configs.users[serverID][userID] = {}; + initializeOptions(serverID, userID); + } + if (process.configs.users[serverID][userID][option] == undefined) { let pages = ["Me", "Arousal", "General", "Restraint Options", "Extreme", "Content"]; pages.forEach((p) => { let optionspages = Object.keys(configoptions[p]); optionspages.forEach((k) => { if (k == option) { if (typeof configoptions[p][k].default == "function") { - process.configs.users[userID][k] = configoptions[p][k].default(userID); + process.configs.users[serverID][userID][k] = configoptions[p][k].default(userID); } else { - process.configs.users[userID][k] = configoptions[p][k].default; + process.configs.users[serverID][userID][k] = configoptions[p][k].default; } } }); }); markForSave("configs"); } - return process.configs.users[userID][option]; + return process.configs.users[serverID][userID][option]; } exports.getOption = getOption; \ No newline at end of file diff --git a/functions/getters/config/getOutfits.js b/functions/getters/config/getOutfits.js index 1f2a00f9..69392083 100644 --- a/functions/getters/config/getOutfits.js +++ b/functions/getters/config/getOutfits.js @@ -1,19 +1,15 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("./getProcessVariable"); /******* * Gets all of the outfits for the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The user whose outfits to retrieve *******/ -function getOutfits(userID) { +function getOutfits(serverID, userID) { traceFirstParam(arguments[0]); - if (process.outfits == undefined) { - process.outfits = {}; - } - if (process.outfits[userID] == undefined) { - process.outfits[userID] = []; - } - return process.outfits[userID]; + return getProcessVariable(serverID, userID, "outfits"); } exports.getOutfits = getOutfits; \ No newline at end of file diff --git a/functions/getters/config/getPFP.js b/functions/getters/config/getPFP.js index fcc5a455..d6f779c1 100644 --- a/functions/getters/config/getPFP.js +++ b/functions/getters/config/getPFP.js @@ -6,12 +6,13 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Get the combined profile picture of the user, if their original one matches the one we have on file * + * - (server ID) - The server this is running on. Can be derived from guild member * - (guild member) member - The Guild Member object sending the message * - (mods) mods - Additional images to overlay in reverse order (not implemented yet) * --- * ##### Returns a string with the user's PFP URL to use **********/ -async function getPFP(member, mods = []) { +async function getPFP(serverID, member, mods = []) { traceFirstParam(arguments[0]); let imagelist = mods.slice(0); if (member.displayAvatarDecorationURL()) { @@ -20,12 +21,13 @@ async function getPFP(member, mods = []) { imagelist.push(member.displayAvatarURL()) if (process.memberavatars == undefined) { process.memberavatars = {} } - if (process.memberavatars[member.id]) { - if (process.memberavatars[member.id].avatarURL == member.displayAvatarURL()) { - if (process.memberavatars[member.id].decorationURL == member.displayAvatarDecorationURL()) { + if (process.memberavatars[serverID] == undefined) { process.memberavatars[serverID] = {} } + if (process.memberavatars[serverID][member.id]) { + if (process.memberavatars[serverID][member.id].avatarURL == member.displayAvatarURL()) { + if (process.memberavatars[serverID][member.id].decorationURL == member.displayAvatarDecorationURL()) { let modifiers = Object.keys(mods).join("") - if (process.memberavatars[member.id][`${mods}link`]) { - return process.memberavatars[member.id][`${mods}link`] + if (process.memberavatars[serverID][member.id][`${mods}link`]) { + return process.memberavatars[serverID][member.id][`${mods}link`] } } } @@ -111,7 +113,7 @@ async function getPFP(member, mods = []) { let imgururl = imgurupload?.data?.data?.link; if (imgururl) { - process.memberavatars[member.id] = { + process.memberavatars[serverID][member.id] = { avatarURL: member.displayAvatarURL(), decorationURL: member.displayAvatarDecorationURL(), link: imgururl diff --git a/functions/getters/config/getPronouns.js b/functions/getters/config/getPronouns.js index 148ff65e..c4eeacd3 100644 --- a/functions/getters/config/getPronouns.js +++ b/functions/getters/config/getPronouns.js @@ -1,9 +1,11 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { remindPronouns, pronounsMap } = require("../../pronounfunctions"); +const { getProcessVariable } = require("./getProcessVariable"); /******************************************** * Get a userID's pronoun of the necessary form. * + * - (server id) serverID - The server this is on * - (user id) user - The user whose pronouns we want to get * - (string) form - The linguistic form to get. See below. * - (boolean) capitalize - If true, capitalizes the first letter @@ -16,14 +18,11 @@ const { remindPronouns, pronounsMap } = require("../../pronounfunctions"); * --- * ##### Returns a string with the user's pronoun in the appropriate tense *******************************************/ -const getPronouns = (user, form, capitalize = false) => { +const getPronouns = (serverID, user, form, capitalize = false) => { traceFirstParam(arguments[0]); - if (process.pronouns == undefined) { - process.pronouns = {}; - } let output = ""; - if (process.pronouns[user]) { - output = process.pronouns[user][form]; + if (getProcessVariable(serverID, user, "pronouns")) { + output = getProcessVariable(serverID, user, "pronouns")[form]; } else { output = pronounsMap.get("they/them")[form]; // If the user has not set pronouns, we should try to send them a DM to have them do so diff --git a/functions/getters/config/getPronounsSet.js b/functions/getters/config/getPronounsSet.js index 58623b2f..5a1178b4 100644 --- a/functions/getters/config/getPronounsSet.js +++ b/functions/getters/config/getPronounsSet.js @@ -4,17 +4,15 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * Get a user's pronouns in typical slash format - Ex: "she/her" * ##### NOTE: "it/it" is grammatically correct, but repetitive. Opted for "it/its" as a stylistic choice. * + * - (server id) serverID - The server this is running on * - (user id) user - The user to retrieve pronouns for * --- * ##### Returns a string with the user's standard pronoun representation *******************************************/ -const getPronounsSet = (user) => { +const getPronounsSet = (serverID, user) => { traceFirstParam(arguments[0]); - if (process.pronouns == undefined) { - process.pronouns = {}; - } - if (process.pronouns[user]) { - return `${process.pronouns[user]["subject"]}/${process.pronouns[user]["subject"] != "it" ? process.pronouns[user]["object"] : process.pronouns[user]["possessive"]}`; + if (getProcessVariable(serverID, user, "pronouns")) { + return `${getProcessVariable(serverID, user, "pronouns")["subject"]}/${getProcessVariable(serverID, user, "pronouns")["subject"] != "it" ? getProcessVariable(serverID, user, "pronouns")["object"] : getProcessVariable(serverID, user, "pronouns")["possessive"]}`; } return `no pronouns set`; }; diff --git a/functions/getters/config/getUserTags.js b/functions/getters/config/getUserTags.js index 2db10184..7f4d3a69 100644 --- a/functions/getters/config/getUserTags.js +++ b/functions/getters/config/getUserTags.js @@ -6,18 +6,19 @@ const { getOption } = require("./getOption"); /********* * Gets a list of tags the user has blocked or preferred * + * - (server ID) serverID - The server this is running on * - (user ID) userID - The user to check tags for * - (boolean) preferred? - If true, get a list of things the user **loves**. * --- * ##### Returns an array of string tags to block or prefer *********/ -function getUserTags(userID, preferred = false) { +function getUserTags(serverID, userID, preferred = false) { traceFirstParam(arguments[0]); if (!userID) { return [] } let tags = []; let optionstocheck = Object.keys(configoptions.Content).map((t) => t.replace("wearabletags-", "")) optionstocheck.forEach((tag) => { - if (getOption(userID, `wearabletags-${tag}`) == (preferred ? "preferred" : "none")) { + if (getOption(serverID, userID, `wearabletags-${tag}`) == (preferred ? "preferred" : "none")) { tags.push(tag) } }) diff --git a/functions/getters/config/getUserVar.js b/functions/getters/config/getUserVar.js index 11beaf30..b382e495 100644 --- a/functions/getters/config/getUserVar.js +++ b/functions/getters/config/getUserVar.js @@ -1,22 +1,18 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("./getProcessVariable"); /********** * Gets a temporary user variable by key * + * - (server id) serverID - The server this is running on * - (user id) user - The User whose key to search for * - (string) key - The specific key to retrieve * --- * ##### Returns the value of the key **********/ -function getUserVar(user, key) { +function getUserVar(serverID, user, key) { traceFirstParam(arguments[0]); - if (process.usercontext == undefined) { - process.usercontext = {}; - } - if (process.usercontext[user] == undefined) { - process.usercontext[user] = {}; - } - return process.usercontext[user][key]; + return getProcessVariable(serverID, user, "usercontext")[key]; } exports.getUserVar = getUserVar; \ No newline at end of file diff --git a/functions/getters/config/getUsersWithOption.js b/functions/getters/config/getUsersWithOption.js index 25950840..6e9abd03 100644 --- a/functions/getters/config/getUsersWithOption.js +++ b/functions/getters/config/getUsersWithOption.js @@ -3,17 +3,18 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* * Fetches a list of all user IDs where option == value * + * - (server id) serverID - The server this is running on * - (string) option - The string name of the config option * - (any) value - The exact value to check * --- * ##### Returns an array of user IDs that have selected that value for that option. *********/ -function getUsersWithOption(option, value) { +function getUsersWithOption(serverID, option, value) { traceFirstParam(arguments[0]); let userswithval = []; - if (process.configs && process.configs.users) { - Object.keys(process.configs.users).forEach((user) => { - if (process.configs.users[option] == value) { + if (process.configs && process.configs.users && process.configs.users[serverID]) { + Object.keys(rocess.configs.users[serverID]).forEach((user) => { + if (rocess.configs.users[serverID][option] == value) { userswithval.push(user) } }) diff --git a/functions/getters/config/statsGetAllStat.js b/functions/getters/config/statsGetAllStat.js index 366de179..c1cccd20 100644 --- a/functions/getters/config/statsGetAllStat.js +++ b/functions/getters/config/statsGetAllStat.js @@ -4,23 +4,24 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * Generates an array with users mapped to their count in a stat. * ##### This is not sorted, presented as [userid, stat]. Sort with .sort((a,b) => { return a[1] - b[1]}) * + * - (server id) serverID - The server this is running on * - (string) stat - The stat to pull all of. ] * --- * ##### Returns an array with array pairs of user IDs and stats, [userid, stat] *********/ -function statsGetAllStat(stat) { +function statsGetAllStat(serverID, stat) { traceFirstParam(arguments[0]); let selectedoption = []; - if (process.userstats) { - Object.keys(process.userstats).forEach((user) => { - if ((process.userstats[user] && process.userstats[user][stat])) { - if ((typeof process.userstats[user][stat] == "number")) { - if (process.userstats[user][stat] > 0) { - selectedoption.push([user, process.userstats[user][stat]]) + if (process.userstats && process.userstats[serverID]) { + Object.keys(process.userstats[serverID]).forEach((user) => { + if ((process.userstats[serverID][user] && process.userstats[serverID][user][stat])) { + if ((typeof process.userstats[serverID][user][stat] == "number")) { + if (process.userstats[serverID][user][stat] > 0) { + selectedoption.push([user, process.userstats[serverID][user][stat]]) } } else { - selectedoption.push([user, process.userstats[user][stat]]) + selectedoption.push([user, process.userstats[serverID][user][stat]]) } } }) diff --git a/functions/getters/config/statsGetCounter.js b/functions/getters/config/statsGetCounter.js index e1a3e358..cc306e43 100644 --- a/functions/getters/config/statsGetCounter.js +++ b/functions/getters/config/statsGetCounter.js @@ -1,18 +1,18 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("./getProcessVariable"); /********** * Get the counter for a user by name. * + * - (server id) serverID - The server this is running on * - (user id) user - User to increment for * - (string) countername - ID of the counter to get * --- * ##### Returns the current value of the counter for the user **********/ -function statsGetCounter(user, countername) { +function statsGetCounter(serverID, user, countername) { traceFirstParam(arguments[0]); - if (process.userstats == undefined) { process.userstats = {} } - if (process.userstats[user] == undefined) { process.userstats[user] = {} } - return process.userstats[user][countername]; + return getProcessVariable(serverID, user, "userstats")[countername]; } exports.statsGetCounter = statsGetCounter; \ No newline at end of file diff --git a/functions/getters/corset/getBreath.js b/functions/getters/corset/getBreath.js index 9cc89c09..8eb6d1c8 100644 --- a/functions/getters/corset/getBreath.js +++ b/functions/getters/corset/getBreath.js @@ -6,13 +6,14 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* * Gets the current breath of the user * + * - (server id) serverID - The server this is running on * - (user id) user - The user wearing the corset * --- * ##### Returns the calculated breath of the user *********/ -function getBreath(user) { +function getBreath(serverID, user) { traceFirstParam(arguments[0]); - const corset = calcBreath(user); + const corset = calcBreath(serverID, user); markForSave("corset"); return corset.breath; } diff --git a/functions/getters/corset/getCorset.js b/functions/getters/corset/getCorset.js index a007df7c..1503eed9 100644 --- a/functions/getters/corset/getCorset.js +++ b/functions/getters/corset/getCorset.js @@ -1,8 +1,10 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /********* * Gets the worn corset for a user. Returns the corset if it exists, or undefined if not. * + * - (server id) serverID - The server this is running on * - (user ID) user - The user to get the corset for * --- * ##### Returns the current corset object for the user. All corsets will have: @@ -13,10 +15,9 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * - type: The type of corset (defaults to "corset_leather") * ###### Additional properties may be added by other functions *********/ -function getCorset(user) { +function getCorset(serverID, user) { traceFirstParam(arguments[0]); - if (process.corset == undefined) process.corset = {}; - return process.corset[user]; + return getProcessVariable(serverID, user, "corset"); } exports.getCorset = getCorset; \ No newline at end of file diff --git a/functions/getters/corset/getCorsetBinder.js b/functions/getters/corset/getCorsetBinder.js index 27c19bb1..d591a781 100644 --- a/functions/getters/corset/getCorsetBinder.js +++ b/functions/getters/corset/getCorsetBinder.js @@ -4,13 +4,14 @@ const { getCorset } = require("./getCorset"); /********** * Gets the origbinder of someone's corset, if worn. * + * - (server id) serverID - The server this is running on * - (user id) user - The user wearing the corset * --- * ##### Returns the user ID of the person who put this corset on the wearer. **********/ -function getCorsetBinder(user) { +function getCorsetBinder(serverID, user) { traceFirstParam(arguments[0]); - return getCorset(user)?.origbinder; + return getCorset(serverID, user)?.origbinder; } exports.getCorsetBinder = getCorsetBinder; \ No newline at end of file From 4ea9c6200dc3b052b1d2f3da186e3f28a9d27e93 Mon Sep 17 00:00:00 2001 From: Enraa Date: Wed, 17 Jun 2026 23:48:24 -0700 Subject: [PATCH 10/44] y'all get set --- functions/getters/config/getUserVar.js | 2 +- functions/getters/config/statsGetCounter.js | 2 +- functions/getters/delve/getCurrentFloor.js | 14 ++++---------- functions/getters/delve/getDelveFloorState.js | 12 +++++++----- functions/getters/delve/getDelvePlayerStats.js | 10 ++++++---- functions/getters/delve/getResolve.js | 14 ++++---------- functions/getters/headwear/getHeadwear.js | 9 ++++----- functions/getters/headwear/getHeadwearBinder.js | 8 +++----- functions/getters/headwear/getHeadwearName.js | 3 ++- .../getters/headwear/getHeadwearRestrictions.js | 5 +++-- functions/getters/headwear/getLockedHeadgear.js | 6 ++---- 11 files changed, 37 insertions(+), 48 deletions(-) diff --git a/functions/getters/config/getUserVar.js b/functions/getters/config/getUserVar.js index b382e495..9ebb087b 100644 --- a/functions/getters/config/getUserVar.js +++ b/functions/getters/config/getUserVar.js @@ -12,7 +12,7 @@ const { getProcessVariable } = require("./getProcessVariable"); **********/ function getUserVar(serverID, user, key) { traceFirstParam(arguments[0]); - return getProcessVariable(serverID, user, "usercontext")[key]; + return (getProcessVariable(serverID, user, "usercontext") && getProcessVariable(serverID, user, "usercontext")[key]); } exports.getUserVar = getUserVar; \ No newline at end of file diff --git a/functions/getters/config/statsGetCounter.js b/functions/getters/config/statsGetCounter.js index cc306e43..332631b7 100644 --- a/functions/getters/config/statsGetCounter.js +++ b/functions/getters/config/statsGetCounter.js @@ -12,7 +12,7 @@ const { getProcessVariable } = require("./getProcessVariable"); **********/ function statsGetCounter(serverID, user, countername) { traceFirstParam(arguments[0]); - return getProcessVariable(serverID, user, "userstats")[countername]; + return (getProcessVariable(serverID, user, "userstats") && getProcessVariable(serverID, user, "userstats")[countername]); } exports.statsGetCounter = statsGetCounter; \ No newline at end of file diff --git a/functions/getters/delve/getCurrentFloor.js b/functions/getters/delve/getCurrentFloor.js index 4357e1f2..7edbf4d2 100644 --- a/functions/getters/delve/getCurrentFloor.js +++ b/functions/getters/delve/getCurrentFloor.js @@ -1,23 +1,17 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /******** * Gets the current floor the user is on. * + * - (server ID) serverID - The server this is running on * - (user ID) user - The user ID doing the delve * --- * ##### Returns undefined if they're not on a delve, 0 if at delve entrance, or an integer floor number ********/ -function getCurrentFloor(user) { +function getCurrentFloor(serverID, user) { traceFirstParam(arguments[0]); - if (process.delveuserdata == undefined) { process.delveuserdata = {} } - if (process.delveuserdata[user]) { - // They started a delve, return the floor - return process.delveuserdata[user].floor - } - else { - // They're not in the Delve. - return undefined; - } + return getProcessVariable(serverID, user, "delveuserdata")?.floor } exports.getCurrentFloor = getCurrentFloor; \ No newline at end of file diff --git a/functions/getters/delve/getDelveFloorState.js b/functions/getters/delve/getDelveFloorState.js index 61b76f77..02298570 100644 --- a/functions/getters/delve/getDelveFloorState.js +++ b/functions/getters/delve/getDelveFloorState.js @@ -3,6 +3,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******* * Get a floor's props. * + * - (server ID) serverID - The server this is running on * - (user ID) user - The user ID doing the delve * - (integer) floor - Floor number they are on * - (string) prop - Name of the property to save @@ -10,14 +11,15 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * --- * ##### Returns the current floordata for the floor *******/ -function getDelveFloorState(user, floor) { +function getDelveFloorState(serverID, user, floor) { traceFirstParam(arguments[0]); if (process.delveuserdata == undefined) { process.delveuserdata = {} } - if (process.delveuserdata[user]) { + if (process.delveuserdata[serverID] == undefined) { process.delveuserdata[serverID] = {} } + if (process.delveuserdata[serverID] && process.delveuserdata[serverID][user]) { // They started a delve, now check what floor they're on - if (process.delveuserdata[user].floordata == undefined) { process.delveuserdata[user].floordata = [] } - if (process.delveuserdata[user].floordata[floor] == undefined) { process.delveuserdata[user].floordata[floor] = {} } - return process.delveuserdata[user].floordata[floor] + if (process.delveuserdata[serverID][user].floordata == undefined) { process.delveuserdata[serverID][user].floordata = [] } + if (process.delveuserdata[serverID][user].floordata[floor] == undefined) { process.delveuserdata[serverID][user].floordata[floor] = {} } + return process.delveuserdata[serverID][user].floordata[floor] } else { return undefined; diff --git a/functions/getters/delve/getDelvePlayerStats.js b/functions/getters/delve/getDelvePlayerStats.js index 64939971..70d2d001 100644 --- a/functions/getters/delve/getDelvePlayerStats.js +++ b/functions/getters/delve/getDelvePlayerStats.js @@ -3,14 +3,16 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******* * Get delve player stats. Otherwise, create a template for the player. * + * - (server id) serverID - The server this is running on * - (user id) user - User ID doing the Delve *******/ -function getDelvePlayerStats(user) { +function getDelvePlayerStats(serverID, user) { traceFirstParam(arguments[0]); if (process.delveuserstats == undefined) { process.delveuserstats = {} } - if (process.delveuserstats[user] == undefined) { + if (process.delveuserstats[serverID] == undefined) { process.delveuserstats[serverID] = {} } + if (process.delveuserstats[serverID][user] == undefined) { // Create a template if it does not exist. - process.delveuserstats[user] = { + process.delveuserstats[serverID][user] = { // Main strength: 6, dexterity: 6, @@ -31,7 +33,7 @@ function getDelvePlayerStats(user) { level: 1 } } - return process.delveuserstats[user] + return process.delveuserstats[serverID][user] } exports.getDelvePlayerStats = getDelvePlayerStats; \ No newline at end of file diff --git a/functions/getters/delve/getResolve.js b/functions/getters/delve/getResolve.js index b35bf1ab..b137d710 100644 --- a/functions/getters/delve/getResolve.js +++ b/functions/getters/delve/getResolve.js @@ -1,23 +1,17 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /******* * Gets the user's current Resolve * + * - (server id) serverID - The server this is running on * - (user id) user - User ID doing the Delve * --- * ##### Returns an integer with the current resolve of the user *******/ -function getResolve(user) { +function getResolve(serverID, user) { traceFirstParam(arguments[0]); - if (process.delveuserdata == undefined) { process.delveuserdata = {} } - if (process.delveuserdata[user]) { - // They started a delve, return their current resolve - return process.delveuserdata[user].resolve - } - else { - // They're not in the Delve. - return undefined; - } + return getProcessVariable(serverID, user, "delveuserdata")?.resolve; } exports.getResolve = getResolve; \ No newline at end of file diff --git a/functions/getters/headwear/getHeadwear.js b/functions/getters/headwear/getHeadwear.js index e6fcde64..8f736baf 100644 --- a/functions/getters/headwear/getHeadwear.js +++ b/functions/getters/headwear/getHeadwear.js @@ -1,18 +1,17 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /******* * Get the worn headwear for a user * + * - (server id) serverID - The server this is running on * - (user id) userID - The user that's wearing the head gear * --- * ##### Returns an array with string item IDs the user is wearing *******/ -function getHeadwear(userID) { +function getHeadwear(serverID, userID) { traceFirstParam(arguments[0]); - if (process.headwear == undefined) { - process.headwear = {}; - } - return process.headwear[userID]?.wornheadwear ? process.headwear[userID]?.wornheadwear : []; + return getProcessVariable(serverID, userID, "headwear")?.wornheadwear ?? [] } exports.getHeadwear = getHeadwear; \ No newline at end of file diff --git a/functions/getters/headwear/getHeadwearBinder.js b/functions/getters/headwear/getHeadwearBinder.js index e10e1a85..cbfb4077 100644 --- a/functions/getters/headwear/getHeadwearBinder.js +++ b/functions/getters/headwear/getHeadwearBinder.js @@ -3,17 +3,15 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Gets the person who put a piece of headwear on the user * + * - (server id) serverID - The server this is running on * - (user id) userID - The person wearing the headgear * - (string) item - The item ID to check * --- * ##### Returns the user ID who put this headgear on the wearer ********/ -function getHeadwearBinder(userID, item) { +function getHeadwearBinder(serverID, userID, item) { traceFirstParam(arguments[0]); - if (process.headwear == undefined) { - process.headwear = {}; - } - return (process.headwear[userID] && process.headwear[userID][item]?.origbinder); + return (getProcessVariable(serverID, userID, "headwear") && getProcessVariable(serverID, userID, "headwear")[item] && getProcessVariable(serverID, userID, "headwear")[item]?.origbinder); } exports.getHeadwearBinder = getHeadwearBinder; \ No newline at end of file diff --git a/functions/getters/headwear/getHeadwearName.js b/functions/getters/headwear/getHeadwearName.js index 2d9cb4fe..d458c5ff 100644 --- a/functions/getters/headwear/getHeadwearName.js +++ b/functions/getters/headwear/getHeadwearName.js @@ -4,6 +4,7 @@ const { getBaseHeadwear } = require("./getBaseHeadwear"); /********** * Gets the full name of a piece of headwear * + * - (server ID) serverID - The server this is running on * - (user ID) userID - The user wearing the headgear * - (string) headnname - The string ID of the headgear * --- @@ -11,7 +12,7 @@ const { getBaseHeadwear } = require("./getBaseHeadwear"); * --- * #### This needs cleanup to remove the userID param as it is not used! **********/ -function getHeadwearName(userID, headnname) { +function getHeadwearName(serverID, userID, headnname) { traceFirstParam(arguments[0]); if (process.headwear == undefined) { process.headwear = {}; diff --git a/functions/getters/headwear/getHeadwearRestrictions.js b/functions/getters/headwear/getHeadwearRestrictions.js index 427d9a44..afcf8536 100644 --- a/functions/getters/headwear/getHeadwearRestrictions.js +++ b/functions/getters/headwear/getHeadwearRestrictions.js @@ -5,16 +5,17 @@ const { getHeadwear } = require("./getHeadwear"); /*********** * Determine if a user is able to perform headwear blocking restrictions. * + * - (server id) serverID - The server this is running on * - (user id) userID - The user wearing the headgear * --- * ##### Returns an object with the following properties: * - canEmote: The user is able to use emotes * - canInspect: The user is able to view details in /inspect ***********/ -function getHeadwearRestrictions(userID) { +function getHeadwearRestrictions(serverID, userID) { traceFirstParam(arguments[0]); let allowedperms = { canEmote: true, canInspect: true, forcedtextemoji: false }; - let wornheadwear = getHeadwear(userID); + let wornheadwear = getHeadwear(serverID, userID); for (let i = 0; i < wornheadwear.length; i++) { if (getHeadwearBlocks(wornheadwear[i]) && getHeadwearBlocks(wornheadwear[i]).blockemote) { allowedperms.canEmote = false; diff --git a/functions/getters/headwear/getLockedHeadgear.js b/functions/getters/headwear/getLockedHeadgear.js index e05cd959..33ab2487 100644 --- a/functions/getters/headwear/getLockedHeadgear.js +++ b/functions/getters/headwear/getLockedHeadgear.js @@ -1,4 +1,5 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /******* * Gets the protected headgear (/item protect) for the user. @@ -9,10 +10,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); *******/ function getLockedHeadgear(userID) { traceFirstParam(arguments[0]); - if (process.headwear == undefined) { - process.headwear = {}; - } - return process.headwear[userID]?.locked ? process.headwear[userID]?.locked : []; + return getProcessVariable(serverID, userID, "headwear")?.locked ?? [] } exports.getLockedHeadgear = getLockedHeadgear; \ No newline at end of file From 5043104e23228d0e1a706484f3193107f409d0bc Mon Sep 17 00:00:00 2001 From: Enraa Date: Thu, 18 Jun 2026 00:29:26 -0700 Subject: [PATCH 11/44] Then pull the trigger and GO! --- .../getters/headwear/getLockedHeadgear.js | 3 ++- functions/getters/heavy/getHeavy.js | 18 +++++++++++------- functions/getters/heavy/getHeavyBinder.js | 9 +++++---- functions/getters/heavy/getHeavyBound.js | 7 ++++--- functions/getters/heavy/getHeavyList.js | 14 ++++---------- .../getters/heavy/getHeavyRestrictions.js | 13 +++++++------ functions/getters/heavy/getHeavyTagsOnUser.js | 7 ++++--- functions/getters/mitten/getMitten.js | 9 ++++----- functions/getters/mitten/getMittenBinder.js | 5 +++-- functions/getters/mitten/getMittenName.js | 10 +++++++--- functions/getters/toy/canPlaceToy.js | 5 +++-- functions/getters/toy/canRemoveToy.js | 5 +++-- functions/getters/toy/getSpecificToy.js | 3 ++- functions/getters/toy/getToys.js | 8 ++++---- functions/getters/toy/userBlockArousingToy.js | 5 +++-- 15 files changed, 66 insertions(+), 55 deletions(-) diff --git a/functions/getters/headwear/getLockedHeadgear.js b/functions/getters/headwear/getLockedHeadgear.js index 33ab2487..01372673 100644 --- a/functions/getters/headwear/getLockedHeadgear.js +++ b/functions/getters/headwear/getLockedHeadgear.js @@ -4,11 +4,12 @@ const { getProcessVariable } = require("../config/getProcessVariable"); /******* * Gets the protected headgear (/item protect) for the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The person with protected headgear * --- * ##### Returns an array of string item IDs designated as protected with /item protect *******/ -function getLockedHeadgear(userID) { +function getLockedHeadgear(serverID, userID) { traceFirstParam(arguments[0]); return getProcessVariable(serverID, userID, "headwear")?.locked ?? [] } diff --git a/functions/getters/heavy/getHeavy.js b/functions/getters/heavy/getHeavy.js index 2479bf0a..3c337d90 100644 --- a/functions/getters/heavy/getHeavy.js +++ b/functions/getters/heavy/getHeavy.js @@ -4,6 +4,7 @@ const { getBaseHeavy } = require("./getBaseHeavy"); /********* * Get Heavy Bondage worn by the user. Returns arms -> legs -> container if multiple. * + * - (server ID) serverID - The server this is running on * - (user id) user - The user wearing the heavy bondage * - (string) type? - If specified, get specific bondage * --- @@ -13,35 +14,38 @@ const { getBaseHeavy } = require("./getBaseHeavy"); * - displayname: The display name of this heavy bondage * - namedcontainerowner?: User ID included in container checks *********/ -function getHeavy(user, type) { +function getHeavy(serverID, user, type) { traceFirstParam(arguments[0]); if (process.heavy == undefined) { process.heavy = {}; } + if (process.heavy[serverID] == undefined) { + process.heavy[serverID] = {}; + } let returnarms; let returnlegs; let returncontainer; let returnedval; - if (process.heavy[user] && (process.heavy[user].length > 0)) { + if (process.heavy[serverID][user] && (process.heavy[serverID][user].length > 0)) { if (!type) { - let mapped = process.heavy[user].map((h) => getBaseHeavy(h.type)) + let mapped = process.heavy[serverID][user].map((h) => getBaseHeavy(h.type)) // return arms first mapped.forEach((h) => { if (h.heavytags.includes("arms")) { - returnarms = process.heavy[user].find((heavy) => heavy.type === h.value) + returnarms = process.heavy[serverID][user].find((heavy) => heavy.type === h.value) } }) // return legs next mapped.forEach((h) => { if (h.heavytags.includes("legs")) { - returnlegs = process.heavy[user].find((heavy) => heavy.type === h.value) + returnlegs = process.heavy[serverID][user].find((heavy) => heavy.type === h.value) } }) // return container last mapped.forEach((h) => { if (h.heavytags.includes("container")) { - returncontainer = process.heavy[user].find((heavy) => heavy.type === h.value) + returncontainer = process.heavy[serverID][user].find((heavy) => heavy.type === h.value) } }) if (returnarms) { @@ -55,7 +59,7 @@ function getHeavy(user, type) { } } else { - returnedval = process.heavy[user].find((h) => h.type === type); + returnedval = process.heavy[serverID][user].find((h) => h.type === type); } } return returnedval diff --git a/functions/getters/heavy/getHeavyBinder.js b/functions/getters/heavy/getHeavyBinder.js index a49250f4..601c8123 100644 --- a/functions/getters/heavy/getHeavyBinder.js +++ b/functions/getters/heavy/getHeavyBinder.js @@ -4,19 +4,20 @@ const { getHeavy } = require("./getHeavy"); /******** * Get the person who applied heavy bondage to the user. * + * - (server id) serverID - The server this is running on * - (user id) user - The person wearing the heavy bondage * - (string) type - The specific heavy bondage ID. If unspecified, returns the first heavy bondage * --- * ##### Returns a user ID who put this heavy bondage on the user. ********/ -function getHeavyBinder(user, type) { +function getHeavyBinder(serverID, user, type) { traceFirstParam(arguments[0]); - if (getHeavy(user)) { + if (getHeavy(serverID, user)) { if (type) { - return getHeavy(user, type)?.origbinder + return getHeavy(serverID, user, type)?.origbinder } else { - return getHeavy(user)?.origbinder + return getHeavy(serverID, user)?.origbinder } }; } diff --git a/functions/getters/heavy/getHeavyBound.js b/functions/getters/heavy/getHeavyBound.js index 6de1be7c..f6113c54 100644 --- a/functions/getters/heavy/getHeavyBound.js +++ b/functions/getters/heavy/getHeavyBound.js @@ -5,19 +5,20 @@ const { getHeavyRestrictions } = require("./getHeavyRestrictions"); /********** * Check if **user** can bind **target** by ID. * + * - (server id) serverID - The server this is running on * - (user id) user - The person attempting the action * - (user id) target - The person receiving the action * --- * ##### Returns true if the user is able to bind the target, false if not **********/ -function getHeavyBound(user, target) { +function getHeavyBound(serverID, user, target) { traceFirstParam(arguments[0]); - if (getHeavy(user) == undefined) { + if (getHeavy(serverID, user) == undefined) { return true; // No need to worry, they are able to do anything! } else { let bound; - let heavyrestrictions = getHeavyRestrictions(user); + let heavyrestrictions = getHeavyRestrictions(serverID, user); // Check if we can touch ourself if (user == target) { return heavyrestrictions.touchself; diff --git a/functions/getters/heavy/getHeavyList.js b/functions/getters/heavy/getHeavyList.js index c1b94d7a..c7d810d5 100644 --- a/functions/getters/heavy/getHeavyList.js +++ b/functions/getters/heavy/getHeavyList.js @@ -1,8 +1,10 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /********* * Get a list of the heavy bondage worn by the user * + * - (server id) serverID - The server this is running on * - (user id) user - The user wearing the heavy bondage * --- * ##### Returns an array of all of the heavy bondage objects worn by the user. All Heavy Bondage objects have: @@ -11,17 +13,9 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * - displayname: The display name of this heavy bondage * - namedcontainerowner?: User ID included in container checks *********/ -function getHeavyList(user) { +function getHeavyList(serverID, user) { traceFirstParam(arguments[0]); - if (process.heavy == undefined) { - process.heavy = {}; - } - if (process.heavy[user]) { - return process.heavy[user]; - } - else { - return []; - } + return getProcessVariable(serverID, user, "heavy"); } exports.getHeavyList = getHeavyList; \ No newline at end of file diff --git a/functions/getters/heavy/getHeavyRestrictions.js b/functions/getters/heavy/getHeavyRestrictions.js index dad478e7..dbb16d79 100644 --- a/functions/getters/heavy/getHeavyRestrictions.js +++ b/functions/getters/heavy/getHeavyRestrictions.js @@ -6,6 +6,7 @@ const { getHeavy } = require("./getHeavy"); /******* * Retrieve a list of restrictions for a user based on current heavy bondage * + * - (server id) serverID - The server this is running on * - (user id) user - The person wearing the heavy bondage * --- * ##### Returns an object with the following properties: @@ -14,20 +15,20 @@ const { getHeavy } = require("./getHeavy"); * - touchothers: If true, the user is able to do actions on others * - touchlist?: If specified, an array of users the user can do actions to *******/ -function getHeavyRestrictions(user) { +function getHeavyRestrictions(serverID, user) { traceFirstParam(arguments[0]); let returnobject = { heavytags: [], touchself: true, touchothers: true, } - if (getHeavy(user) == undefined) { + if (getHeavy(serverID, user) == undefined) { return returnobject; // User is unbound, they can do anything. } else { - process.heavy[user].forEach((heavy) => { + process.heavy[serverID][user].forEach((heavy) => { if (getBaseHeavy(heavy.type).heavytags.includes("arms")) { - if ((heavy.type == "windupclockwork") && (getUserVar(user, "windupcharge") <= 0.0005)) { + if ((heavy.type == "windupclockwork") && (getUserVar(serverID, user, "windupcharge") <= 0.0005)) { returnobject.heavytags.push("arms"); returnobject.touchself = false; returnobject.touchothers = false; @@ -48,8 +49,8 @@ function getHeavyRestrictions(user) { returnobject.touchlist = []; } // Users in a container can ONLY do stuff to OTHERS in that same container. - Object.keys(process.heavy).forEach((k) => { - if (getHeavy(k, heavy.type)) { + Object.keys(process.heavy[serverID]).forEach((k) => { + if (getHeavy(serverID, k, heavy.type)) { returnobject.touchlist.push(k); } }) diff --git a/functions/getters/heavy/getHeavyTagsOnUser.js b/functions/getters/heavy/getHeavyTagsOnUser.js index 6f8a0160..702ea950 100644 --- a/functions/getters/heavy/getHeavyTagsOnUser.js +++ b/functions/getters/heavy/getHeavyTagsOnUser.js @@ -5,18 +5,19 @@ const { getHeavyList } = require("./getHeavyList"); /********* * Gets a list of heavy tags affecting a user * + * - (server id) serverID - The server this is running on * - (user id) user - The user wearing the heavy bondage * --- * ##### Returns an array of "arms", "legs", or "container" *********/ -function getHeavyTagsOnUser(user) { +function getHeavyTagsOnUser(serverID, user) { traceFirstParam(arguments[0]); - if (getHeavyList(user) == undefined) { + if (getHeavyList(serverID, user) == undefined) { return []; // They're not bound by anything lol } else { let tags = []; - getHeavyList(user).forEach((heavy) => { + getHeavyList(serverID, user).forEach((heavy) => { getBaseHeavy(heavy.type).heavytags.forEach((t) => { tags.push(t); }) diff --git a/functions/getters/mitten/getMitten.js b/functions/getters/mitten/getMitten.js index 7aa2e8ec..0354bc90 100644 --- a/functions/getters/mitten/getMitten.js +++ b/functions/getters/mitten/getMitten.js @@ -1,20 +1,19 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /****** * Gets the currently worn mittens for a user. * + * - (server ID) serverID - The server this is running on * - (user ID) userID - The user ID to retrieve the mittens for * --- * ##### Returns the mitten object for the user. All mittens will have: * - mittenname: The ID of the mittens * - origbinder: The person who put the mittens on the user ******/ -function getMitten(userID) { +function getMitten(serverID, userID) { traceFirstParam(arguments[0]); - if (process.mitten == undefined) { - process.mitten = {}; - } - return process.mitten[userID]; + return getProcessVariable(serverID, userID, "mitten"); } exports.getMitten = getMitten; \ No newline at end of file diff --git a/functions/getters/mitten/getMittenBinder.js b/functions/getters/mitten/getMittenBinder.js index 3b3ee211..e84630b2 100644 --- a/functions/getters/mitten/getMittenBinder.js +++ b/functions/getters/mitten/getMittenBinder.js @@ -3,12 +3,13 @@ const { getMitten } = require("./getMitten"); /****** * Gets the person who put mittens on a user. This is used in one place and should be retired. * + * - (server ID) serverID - The server this is running on * - (user ID) userID - The user ID to retrieve the mittens for * --- * ##### Returns the user ID who put the mittens on the user. ******/ -function getMittenBinder(userID) { - return getMitten(userID)?.origbinder; +function getMittenBinder(serverID, userID) { + return getMitten(serverID, userID)?.origbinder; } exports.getMittenBinder = getMittenBinder; \ No newline at end of file diff --git a/functions/getters/mitten/getMittenName.js b/functions/getters/mitten/getMittenName.js index 1646e616..dc6bb4da 100644 --- a/functions/getters/mitten/getMittenName.js +++ b/functions/getters/mitten/getMittenName.js @@ -4,6 +4,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /************ * Gets the full mitten name of the User ID. Optionally will get the full mitten name of mittens by ID. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID to get the collar name of * - (string) mittenname - The collar ID to retrieve the collar name of * ##### *Note: This function should use either/or param, not both.* @@ -12,19 +13,22 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * --- * ###### Note: Needs rework into separate getMittenName and getMittenNameOnUser functions ************/ -function getMittenName(userID, mittenname) { +function getMittenName(serverID, userID, mittenname) { traceFirstParam(arguments[0]); if (process.mitten == undefined) { process.mitten = {}; } + if (process.mitten[serverID] == undefined) { + process.mitten[serverID] = {}; + } let convertmittenarr = {}; for (let i = 0; i < mittentypes.length; i++) { convertmittenarr[mittentypes[i].value] = mittentypes[i].name; } if (mittenname) { return convertmittenarr[mittenname]; - } else if (process.mitten[userID]?.mittenname) { - return convertmittenarr[process.mitten[userID]?.mittenname]; + } else if (process.mitte[serverID][userID]?.mittenname) { + return convertmittenarr[process.mitten[serverID][userID]?.mittenname]; } else { return undefined; } diff --git a/functions/getters/toy/canPlaceToy.js b/functions/getters/toy/canPlaceToy.js index 27a8fcf4..76cd8bb4 100644 --- a/functions/getters/toy/canPlaceToy.js +++ b/functions/getters/toy/canPlaceToy.js @@ -3,15 +3,16 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Check if a toy by ID can be placed on the target by the user * + * - (server id) serverID - The server this is running on * - (user id) userID - The person placing the toy * - (user id) placerID - The person receiving the toy * - (string) toy - The specific kind of toy to place * --- * ##### Returns true if the toy is permitted to be placed ********/ -function canPlaceToy(userID, placerID, toy) { +function canPlaceToy(serverID, userID, placerID, toy) { traceFirstParam(arguments[0]); - return (process.toytypes && process.toytypes[toy] && process.toytypes[toy].canEquip({ userID: userID, placerID: placerID })) + return (process.toytypes && process.toytypes[toy] && process.toytypes[toy].canEquip({ serverID: serverID, userID: userID, placerID: placerID })) } exports.canPlaceToy = canPlaceToy; \ No newline at end of file diff --git a/functions/getters/toy/canRemoveToy.js b/functions/getters/toy/canRemoveToy.js index 1e1b3df6..17b83970 100644 --- a/functions/getters/toy/canRemoveToy.js +++ b/functions/getters/toy/canRemoveToy.js @@ -3,15 +3,16 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Check if a toy by ID can be removed from the target by the user * + * - (server id) serverID - The server this is running on * - (user id) userID - The person removing the toy * - (user id) placerID - The person who has the toy * - (string) toy - The specific kind of toy to remove * --- * ##### Returns true if the toy is permitted to be placed ********/ -function canRemoveToy(userID, placerID, toy) { +function canRemoveToy(serverID, userID, placerID, toy) { traceFirstParam(arguments[0]); - return (process.toytypes && process.toytypes[toy] && process.toytypes[toy].canUnequip({ userID: userID, placerID: placerID })) + return (process.toytypes && process.toytypes[toy] && process.toytypes[toy].canUnequip({ serverID: serverID, userID: userID, placerID: placerID })) } exports.canRemoveToy = canRemoveToy; \ No newline at end of file diff --git a/functions/getters/toy/getSpecificToy.js b/functions/getters/toy/getSpecificToy.js index f55c2f6e..c4e9aaa3 100644 --- a/functions/getters/toy/getSpecificToy.js +++ b/functions/getters/toy/getSpecificToy.js @@ -4,6 +4,7 @@ const { getToys } = require("./getToys"); /********** * Gets a specific toy that a user is wearing * + * - (server id) serverID - The server this is running on * - (user id) user - The user wearing the toys * - (string) toytype - The item ID of the toy to get * --- @@ -14,7 +15,7 @@ const { getToys } = require("./getToys"); **********/ function getSpecificToy(user, toytype) { traceFirstParam(arguments[0]); - return getToys(user).find((toy) => toy.type == toytype); + return getToys(serverID, user).find((toy) => toy.type == toytype); } exports.getSpecificToy = getSpecificToy; \ No newline at end of file diff --git a/functions/getters/toy/getToys.js b/functions/getters/toy/getToys.js index 3c2837eb..d0ed05b2 100644 --- a/functions/getters/toy/getToys.js +++ b/functions/getters/toy/getToys.js @@ -1,8 +1,10 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /********** * Gets all of the toys that a user is wearing * + * - (server id) serverID - The server this is running on * - (user id) user - The user wearing the toys * --- * ##### Returns an array of toy objects. All toys have the following: @@ -10,11 +12,9 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * - intensity: The intensity of the toy 1-20 * - origbinder: The user ID who put the toy on the user **********/ -function getToys(user) { +function getToys(serverID, user) { traceFirstParam(arguments[0]); - if (process.toys == undefined) { process.toys = {} } - if (process.toys[user] == undefined) { process.toys[user] = [] } - return process.toys[user]; + return getProcessVariable(serverID, user, "toys"); } exports.getToys = getToys; \ No newline at end of file diff --git a/functions/getters/toy/userBlockArousingToy.js b/functions/getters/toy/userBlockArousingToy.js index a127618a..6a1a8b7e 100644 --- a/functions/getters/toy/userBlockArousingToy.js +++ b/functions/getters/toy/userBlockArousingToy.js @@ -4,14 +4,15 @@ const { getOption } = require("../config/getOption"); /******** * Determines if a toy is arousing and blocks it on the user if they do not have arousal enabled * + * - (server id) serverID - The server this is running on * - (user id) user - The user receiving the toy * - (string) toy - The type ID of the toy * --- * ##### Returns true if the user has arousal disabled and the toy is arousing, false if permitted or the toy isnt arousing ********/ -function userBlockArousingToy(user, toy) { +function userBlockArousingToy(serverID, user, toy) { traceFirstParam(arguments[0]); - if (toy && (getOption(user, "arousalsystem") == 0) && (process.toytypes[toy].isArousing())) { + if (toy && (getOption(serverID, user, "arousalsystem") == 0) && (process.toytypes[toy].isArousing())) { return true; // Do not add a toy that can increase arousal, thats bad. } else { From c526a96b1732ea43dd27b5066df7e667bc128750 Mon Sep 17 00:00:00 2001 From: Enraa Date: Thu, 18 Jun 2026 01:10:26 -0700 Subject: [PATCH 12/44] Make a move before they can make an act ON YOU --- functions/getters/config/getPronounsSet.js | 1 + .../getters/headwear/getHeadwearBinder.js | 1 + .../getters/wearable/getLockedWearable.js | 9 +++--- functions/getters/wearable/getWearable.js | 8 ++--- functions/other/convertPronounsText.js | 30 +++++++++---------- functions/other/initializeOptions.js | 7 +++-- functions/setters/arousal/addArousal.js | 4 +-- functions/setters/arousal/clearArousal.js | 5 ++-- functions/setters/chastity/assignChastity.js | 10 +++++-- .../setters/chastity/assignChastityBra.js | 10 +++++-- .../setters/chastity/cloneChastityBraKey.js | 5 ++-- .../setters/chastity/cloneChastityKey.js | 5 ++-- functions/setters/chastity/removeChastity.js | 5 ++-- .../setters/config/setProcessVariable.js | 22 ++++++++++++++ 14 files changed, 78 insertions(+), 44 deletions(-) create mode 100644 functions/setters/config/setProcessVariable.js diff --git a/functions/getters/config/getPronounsSet.js b/functions/getters/config/getPronounsSet.js index 5a1178b4..59aa6924 100644 --- a/functions/getters/config/getPronounsSet.js +++ b/functions/getters/config/getPronounsSet.js @@ -1,4 +1,5 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("./getProcessVariable"); /******************************************** * Get a user's pronouns in typical slash format - Ex: "she/her" diff --git a/functions/getters/headwear/getHeadwearBinder.js b/functions/getters/headwear/getHeadwearBinder.js index cbfb4077..129c40bd 100644 --- a/functions/getters/headwear/getHeadwearBinder.js +++ b/functions/getters/headwear/getHeadwearBinder.js @@ -1,4 +1,5 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /******** * Gets the person who put a piece of headwear on the user diff --git a/functions/getters/wearable/getLockedWearable.js b/functions/getters/wearable/getLockedWearable.js index ea41e44a..bbecf11e 100644 --- a/functions/getters/wearable/getLockedWearable.js +++ b/functions/getters/wearable/getLockedWearable.js @@ -1,18 +1,17 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /********** * Gets a list of locked clothing the user is currently wearing * + * - (server id) serverID - The server this is running on * - (user id) userID - The user wearing the clothing * --- * ##### Returns an array with strings of wearable item IDs **********/ -function getLockedWearable(userID) { +function getLockedWearable(serverID, userID) { traceFirstParam(arguments[0]); - if (process.wearable == undefined) { - process.wearable = {}; - } - return process.wearable[userID]?.locked ? process.wearable[userID]?.locked : []; + return getProcessVariable(serverID, userID, "wearable")?.locked ?? []; } exports.getLockedWearable = getLockedWearable; \ No newline at end of file diff --git a/functions/getters/wearable/getWearable.js b/functions/getters/wearable/getWearable.js index 0cbeef61..f3841797 100644 --- a/functions/getters/wearable/getWearable.js +++ b/functions/getters/wearable/getWearable.js @@ -3,16 +3,14 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Gets a list of clothing the user is currently wearing * + * - (server id) serverID - The server this is running on * - (user id) userID - The user wearing the clothing * --- * ##### Returns an array with strings of wearable item IDs **********/ -function getWearable(userID) { +function getWearable(serverID, userID) { traceFirstParam(arguments[0]); - if (process.wearable == undefined) { - process.wearable = {}; - } - return process.wearable[userID]?.wornwearable ? process.wearable[userID]?.wornwearable : []; + return getProcessVariable(serverID, userID, "wearable")?.wornwearable ?? []; } exports.getWearable = getWearable; \ No newline at end of file diff --git a/functions/other/convertPronounsText.js b/functions/other/convertPronounsText.js index bb6ec506..e82dcd28 100644 --- a/functions/other/convertPronounsText.js +++ b/functions/other/convertPronounsText.js @@ -39,18 +39,18 @@ const convertPronounsText = (text, data) => { outtext = ``; } - let user = { subject: getPronouns(interactionuser.id, "subject"), object: getPronouns(interactionuser.id, "object"), possessive: getPronouns(interactionuser.id, "possessive"), possessiveDeterminer: getPronouns(interactionuser.id, "possessiveDeterminer"), reflexive: getPronouns(interactionuser.id, "reflexive"), subjectIs: getPronouns(interactionuser.id, "subjectIs"), subjectWill: getPronouns(interactionuser.id, "subjectWill") }; + let user = { subject: getPronouns(data.serverID, interactionuser.id, "subject"), object: getPronouns(data.serverID, interactionuser.id, "object"), possessive: getPronouns(data.serverID, interactionuser.id, "possessive"), possessiveDeterminer: getPronouns(data.serverID, interactionuser.id, "possessiveDeterminer"), reflexive: getPronouns(data.serverID, interactionuser.id, "reflexive"), subjectIs: getPronouns(data.serverID, interactionuser.id, "subjectIs"), subjectWill: getPronouns(data.serverID, interactionuser.id, "subjectWill") }; let isDoll = false; - if ((getOption(interactionuser.id, "dollforcedit") == "enabled" && getHeadwear(interactionuser.id).find((headwear) => DOLLVISORS.includes(headwear))) || getHeadwear(interactionuser.id).find((headwear) => headwear === "dollmaker_visor")) { + if ((getOption(data.serverID, interactionuser.id, "dollforcedit") == "enabled" && getHeadwear(data.serverID, interactionuser.id).find((headwear) => DOLLVISORS.includes(headwear))) || getHeadwear(data.serverID, interactionuser.id).find((headwear) => headwear === "dollmaker_visor")) { ((user.subject = "it"), (user.object = "it"), (user.possessive = "its"), (user.possessiveDeterminer = "its"), (user.reflexive = "itself"), (user.subjectIs = "it's"), (user.subjectWill = "it'll")); isDoll = true; } - let target = { subject: getPronouns(targetuser.id, "subject"), object: getPronouns(targetuser.id, "object"), possessive: getPronouns(targetuser.id, "possessive"), possessiveDeterminer: getPronouns(targetuser.id, "possessiveDeterminer"), reflexive: getPronouns(targetuser.id, "reflexive"), subjectIs: getPronouns(targetuser.id, "subjectIs"), subjectWill: getPronouns(targetuser.id, "subjectWill") }; + let target = { subject: getPronouns(data.serverID, targetuser.id, "subject"), object: getPronouns(data.serverID, targetuser.id, "object"), possessive: getPronouns(data.serverID, targetuser.id, "possessive"), possessiveDeterminer: getPronouns(data.serverID, targetuser.id, "possessiveDeterminer"), reflexive: getPronouns(data.serverID, targetuser.id, "reflexive"), subjectIs: getPronouns(data.serverID, targetuser.id, "subjectIs"), subjectWill: getPronouns(data.serverID, targetuser.id, "subjectWill") }; let targetDoll = false; - if (getOption(targetuser.id, "dollforcedit") == "enabled" && getHeadwear(targetuser.id).find((headwear) => DOLLVISORS.includes(headwear))) { + if (getOption(data.serverID, targetuser.id, "dollforcedit") == "enabled" && getHeadwear(data.serverID, targetuser.id).find((headwear) => DOLLVISORS.includes(headwear))) { ((target.subject = "it"), (target.object = "it"), (target.possessive = "its"), (target.possessiveDeterminer = "its"), (target.reflexive = "itself"), (target.subjectIs = "it's"), (target.subjectWill = "it'll")); targetDoll = true; } @@ -88,8 +88,8 @@ const convertPronounsText = (text, data) => { if (isDoll) { praiseobject = "doll"; } - if (getOption(data.interactionuser.id, "praiseobject") != "follow") { - praiseobject = getOption(data.interactionuser.id, "praiseobject"); + if (getOption(data.serverID, data.interactionuser.id, "praiseobject") != "follow") { + praiseobject = getOption(data.serverID, data.interactionuser.id, "praiseobject"); } return praiseobject; }); @@ -155,8 +155,8 @@ const convertPronounsText = (text, data) => { if (targetDoll) { praiseobject = "doll"; } - if (getOption(data.targetuser.id, "praiseobject") != "follow") { - praiseobject = getOption(data.targetuser.id, "praiseobject"); + if (getOption(data.serverID, data.targetuser.id, "praiseobject") != "follow") { + praiseobject = getOption(data.serverID, data.targetuser.id, "praiseobject"); } return praiseobject; }); @@ -199,10 +199,10 @@ const convertPronounsText = (text, data) => { }; exports.convertPronounsText = convertPronounsText; -exports.they = (user, capitalise = false) => getPronouns(user, "subject", capitalise); -exports.them = (user, capitalise = false) => getPronouns(user, "object", capitalise); -exports.theirs = (user, capitalise = false) => getPronouns(user, "possessive", capitalise); -exports.their = (user, capitalise = false) => getPronouns(user, "possessiveDeterminer", capitalise); -exports.themself = (user, capitalise = false) => getPronouns(user, "reflexive", capitalise); -exports.theyre = (user, capitalise = false) => getPronouns(user, "subjectIs", capitalise); -exports.theyll = (user, capitalise = false) => getPronouns(user, "subjectWill", capitalise); \ No newline at end of file +exports.they = (serverID, user, capitalise = false) => getPronouns(serverID, user, "subject", capitalise); +exports.them = (serverID, user, capitalise = false) => getPronouns(serverID, user, "object", capitalise); +exports.theirs = (serverID, user, capitalise = false) => getPronouns(serverID, user, "possessive", capitalise); +exports.their = (serverID, user, capitalise = false) => getPronouns(serverID, user, "possessiveDeterminer", capitalise); +exports.themself = (serverID, user, capitalise = false) => getPronouns(serverID, user, "reflexive", capitalise); +exports.theyre = (serverID, user, capitalise = false) => getPronouns(serverID, user, "subjectIs", capitalise); +exports.theyll = (serverID, user, capitalise = false) => getPronouns(serverID, user, "subjectWill", capitalise); \ No newline at end of file diff --git a/functions/other/initializeOptions.js b/functions/other/initializeOptions.js index ca490eaf..1743ee2e 100644 --- a/functions/other/initializeOptions.js +++ b/functions/other/initializeOptions.js @@ -4,19 +4,20 @@ const { markForSave } = require("./markForSave"); /********** * Sets all options to the defaults for a user. * + * - (server id) serverID - The server this is on * - (user id) userID - The user to set defaults for * --- * ##### *No return value* **********/ -function initializeOptions(userID) { +function initializeOptions(serverID, userID) { let pages = ["Me", "Arousal", "General", "Restraint Options", "Extreme", "Content"]; pages.forEach((p) => { let optionspages = Object.keys(configoptions[p]); optionspages.forEach((k) => { if (typeof configoptions[p][k].default == "function") { - process.configs.users[userID][k] = configoptions[p][k].default(userID); + process.configs.users[serverID][userID][k] = configoptions[p][k].default(userID); } else { - process.configs.users[userID][k] = configoptions[p][k].default; + process.configs.users[serverID][userID][k] = configoptions[p][k].default; } }); }); diff --git a/functions/setters/arousal/addArousal.js b/functions/setters/arousal/addArousal.js index 7e7ef9ab..103783ee 100644 --- a/functions/setters/arousal/addArousal.js +++ b/functions/setters/arousal/addArousal.js @@ -23,10 +23,10 @@ function addArousal(serverID, user, change) { console.log(`ERROR - Attempting to add a NaN arousal to user ID ${user}`) change = 0; // set it to 0 } - process.arousal[user].arousal += change; + process.arousal[serverID][user].arousal += change; if (isNaN(getArousal(serverID, user))) { console.log(`ERROR - ${user} is somehow not a number!`) - process.arousal[user].arousal = 0; + process.arousal[serverID][user].arousal = 0; } getCombinedTraits(serverID, user).afterArousalChange({ userID: user, prevArousal: (getArousal(serverID, user) - change), currArousal: getArousal(serverID, user) }); return getArousal(serverID, user); diff --git a/functions/setters/arousal/clearArousal.js b/functions/setters/arousal/clearArousal.js index 08397215..591615b8 100644 --- a/functions/setters/arousal/clearArousal.js +++ b/functions/setters/arousal/clearArousal.js @@ -4,13 +4,14 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* * Sets the user's arousal to 0 * + * - (server id) serverID - The server this is running on * - (user id) user - The person to remove arousal from * --- * ##### *No return value* *********/ -function clearArousal(user) { +function clearArousal(serverID, user) { traceFirstParam(arguments[0]); - process.arousal[user] = { arousal: 0, prev: 0, timestamp: Date.now() }; + process.arousal[serverID][user] = { arousal: 0, prev: 0, timestamp: Date.now() }; markForSave("arousal"); } diff --git a/functions/setters/chastity/assignChastity.js b/functions/setters/chastity/assignChastity.js index 2c3c15e1..cf8577b6 100644 --- a/functions/setters/chastity/assignChastity.js +++ b/functions/setters/chastity/assignChastity.js @@ -6,6 +6,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds or modifies a chastity belt on the user. * + * - (server id) serverID - The server this is running on * - (user id) user - The person wearing the chastity belt * - (user id) keyholder - The person putting the chastity belt on them * - (string) namedchastity? - The chastity item ID, if any @@ -13,13 +14,16 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * --- * ##### Returns true if successful, false if failed to put it on **********/ -function assignChastity(user, keyholder, namedchastity, force = false) { +function assignChastity(serverID, user, keyholder, namedchastity, force = false) { traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } + if (process.chastity[serverID] == undefined) { + process.chastity[serverID] = {}; + } // Get the current and new bases to reference - let oldchastitybase = getChastity(user) ? getBaseChastity(getChastity(user).chastitytype) : undefined; + let oldchastitybase = getChastity(serverID, user) ? getBaseChastity(getChastity(serverID, user).chastitytype) : undefined; let newchastitybase = getBaseChastity(namedchastity ?? "belt_silver") // Stop this function immediately if the current chastity belt can't be removed. @@ -30,7 +34,7 @@ function assignChastity(user, keyholder, namedchastity, force = false) { if (oldchastitybase) { oldchastitybase.onUnequip({ userID: user, keyholderID: keyholder }) } // Assign the new chastity belt to the user - process.chastity[user] = { keyholder: keyholder ? keyholder : "unlocked", timestamp: Date.now(), chastitytype: namedchastity, stateligible: true }; + process.chastity[serverID][user] = { keyholder: keyholder ? keyholder : "unlocked", timestamp: Date.now(), chastitytype: namedchastity, stateligible: true }; // Call the on equip for the new chastity belt! newchastitybase.onEquip({ userID: user, keyholderID: keyholder }) diff --git a/functions/setters/chastity/assignChastityBra.js b/functions/setters/chastity/assignChastityBra.js index 98f1fbff..a5fa28ea 100644 --- a/functions/setters/chastity/assignChastityBra.js +++ b/functions/setters/chastity/assignChastityBra.js @@ -6,6 +6,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds or modifies a chastity bra on the user. * + * - (server id) serverID - The server this is running on * - (user id) user - The person wearing the chastity bra * - (user id) keyholder - The person putting the chastity bra on them * - (string) namedchastity? - The chastity item ID, if any @@ -13,13 +14,16 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * --- * ##### Returns true if successful, false if failed to put it on **********/ -function assignChastityBra(user, keyholder, namedchastity, force = false) { +function assignChastityBra(serverID, user, keyholder, namedchastity, force = false) { traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } + if (process.chastitybra[serverID] == undefined) { + process.chastitybra[serverID] = {}; + } // Get the current and new bases to reference - let oldchastitybase = getChastityBra(user) ? getBaseChastity(getChastityBra(user).chastitytype) : undefined + let oldchastitybase = getChastityBra(serverID, user) ? getBaseChastity(getChastityBra(serverID, user).chastitytype) : undefined let newchastitybase = getBaseChastity(namedchastity ?? "bra_silver") // Stop this function immediately if the current chastity belt can't be removed. @@ -30,7 +34,7 @@ function assignChastityBra(user, keyholder, namedchastity, force = false) { if (oldchastitybase) { oldchastitybase.onUnequip({ userID: user, keyholderID: keyholder }) } // Assign the new chastity belt to the user - process.chastitybra[user] = { keyholder: keyholder ? keyholder : "unlocked", timestamp: Date.now(), chastitytype: namedchastity, stateligible: true }; + process.chastitybra[serverID][user] = { keyholder: keyholder ? keyholder : "unlocked", timestamp: Date.now(), chastitytype: namedchastity, stateligible: true }; // Call the on equip for the new chastity belt! newchastitybase.onEquip({ userID: user, keyholderID: keyholder }) diff --git a/functions/setters/chastity/cloneChastityBraKey.js b/functions/setters/chastity/cloneChastityBraKey.js index fea658f3..6312798f 100644 --- a/functions/setters/chastity/cloneChastityBraKey.js +++ b/functions/setters/chastity/cloneChastityBraKey.js @@ -5,14 +5,15 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Adds a user as a cloned keyholder for the chastity bra * + * - (server id) serverID - The server this is running on * - (user id) chastityuser - The user wearing the chastity bra * - (user id) newKeyholder - The user added to the chastity bra's cloned keys * --- * ##### *No return value* ********/ -function cloneChastityBraKey(chastityuser, newKeyholder) { +function cloneChastityBraKey(serverID, chastityuser, newKeyholder) { traceFirstParam(arguments[0]); - let chastity = getChastityBra(chastityuser); + let chastity = getChastityBra(serverID, chastityuser); if (!chastity.clonedKeyholders) { chastity.clonedKeyholders = []; } diff --git a/functions/setters/chastity/cloneChastityKey.js b/functions/setters/chastity/cloneChastityKey.js index 9f811224..da0cacda 100644 --- a/functions/setters/chastity/cloneChastityKey.js +++ b/functions/setters/chastity/cloneChastityKey.js @@ -5,14 +5,15 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Adds a user as a cloned keyholder for the chastity belt * + * - (server id) serverID - The server this is running on * - (user id) chastityuser - The user wearing the chastity belt * - (user id) newKeyholder - The user added to the chastity belt's cloned keys * --- * ##### *No return value* ********/ -function cloneChastityKey(chastityuser, newKeyholder) { +function cloneChastityKey(serverID, chastityuser, newKeyholder) { traceFirstParam(arguments[0]); - let chastity = getChastity(chastityuser); + let chastity = getChastity(serverID, chastityuser); if (!chastity.clonedKeyholders) { chastity.clonedKeyholders = []; } diff --git a/functions/setters/chastity/removeChastity.js b/functions/setters/chastity/removeChastity.js index 1618b1ab..c41ff326 100644 --- a/functions/setters/chastity/removeChastity.js +++ b/functions/setters/chastity/removeChastity.js @@ -6,18 +6,19 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a chastity belt from the user. * + * - (server id) serverID - The server this is running on * - (user id) user - The person wearing the chastity belt * - (user id) keyholder - The person removing the chastity belt from them * - (boolean) force - If true, forcibly removes this chastity belt * --- * ##### Returns true if successful, false if failed to remove **********/ -function removeChastity(user, keyholder, force = false) { +function removeChastity(serverID, user, keyholder, force = false) { traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } - let chastitybase = getBaseChastity(getChastity(user)?.chastitytype ?? "belt_silver") + let chastitybase = getBaseChastity(getChastity(serverID, user)?.chastitytype ?? "belt_silver") if ((chastitybase && !chastitybase.canUnequip({ userID: user, keyholderID: keyholder })) && !force) return false; diff --git a/functions/setters/config/setProcessVariable.js b/functions/setters/config/setProcessVariable.js new file mode 100644 index 00000000..39a55ef1 --- /dev/null +++ b/functions/setters/config/setProcessVariable.js @@ -0,0 +1,22 @@ +const { markForSave } = require("../../other/markForSave"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); + +/******* + * Set a base object for a user. + * + * - (server ID) serverID - The server this is for + * - (user ID) userID - The user this is for + * - (string) processvar - The specific variable to save as + * - (any) value - The value to set + * --- + * ##### *No return value* + *******/ +function setProcessVariable(serverID, userID, processvar, value) { + traceFirstParam(arguments[0]); + if (process[processvar] == undefined) { process[processvar] = {} } + if (process[processvar][serverID] == undefined) { process[processvar][serverID] = {} } + process[processvar][serverID][userID] = value; + markForSave(processvar); +} + +exports.setProcessVariable = setProcessVariable; \ No newline at end of file From 93a6e3a4f82aef0a7cdad3f91aa71631c82f043c Mon Sep 17 00:00:00 2001 From: Enraa Date: Thu, 18 Jun 2026 20:40:04 -0700 Subject: [PATCH 13/44] Trapped in time --- functions/setters/chastity/removeChastity.js | 18 ++++++++++------ .../setters/chastity/removeChastityBra.js | 21 ++++++++++++------- .../setters/chastity/revokeChastityBraKey.js | 5 +++-- .../setters/chastity/revokeChastityKey.js | 5 +++-- functions/setters/chastity/swapChastity.js | 16 ++++++++------ functions/setters/chastity/swapChastityBra.js | 16 ++++++++------ .../chastity/transferChastityBraKey.js | 11 +++++----- .../setters/chastity/transferChastityKey.js | 11 +++++----- .../collar/addAdditionalCollarEffect.js | 9 ++++---- functions/setters/collar/assignCollar.js | 8 +++++-- functions/setters/collar/cloneCollarKey.js | 5 +++-- 11 files changed, 77 insertions(+), 48 deletions(-) diff --git a/functions/setters/chastity/removeChastity.js b/functions/setters/chastity/removeChastity.js index c41ff326..757066a4 100644 --- a/functions/setters/chastity/removeChastity.js +++ b/functions/setters/chastity/removeChastity.js @@ -12,26 +12,32 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * - (boolean) force - If true, forcibly removes this chastity belt * --- * ##### Returns true if successful, false if failed to remove + * --- + * ##### Fix the timestamp so that it determines the longer timestamp when recording longest chastity! **********/ function removeChastity(serverID, user, keyholder, force = false) { traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } + if (process.chastity[serverID] == undefined) { + process.chastity[serverID] = {}; + } let chastitybase = getBaseChastity(getChastity(serverID, user)?.chastitytype ?? "belt_silver") - if ((chastitybase && !chastitybase.canUnequip({ userID: user, keyholderID: keyholder })) && !force) return false; + if ((chastitybase && !chastitybase.canUnequip({ serverID: serverID, userID: user, keyholderID: keyholder })) && !force) return false; - chastitybase.onUnequip({ userID: user }); + chastitybase.onUnequip({ serverID: serverID, userID: user }); - if (process.chastity[user]?.stateligible) { + if (process.chastity[serverID][user]?.stateligible) { if (process.userstats == undefined) { process.userstats = {} } - if (process.userstats[user] == undefined) { process.userstats[user] = {} } - process.userstats[user].chastitywornduration = (Date.now() - process.chastity[user].timestamp) + if (process.userstats[serverID] == undefined) { process.userstats = {} } + if (process.userstats[serverID][user] == undefined) { process.userstats[serverID][user] = {} } + process.userstats[serverID][user].chastitywornduration = (Date.now() - process.chastity[serverID][user].timestamp) markForSave("userstats"); } - delete process.chastity[user]; + delete process.chastity[serverID][user]; markForSave("chastity"); return true; diff --git a/functions/setters/chastity/removeChastityBra.js b/functions/setters/chastity/removeChastityBra.js index 90500a18..68d22958 100644 --- a/functions/setters/chastity/removeChastityBra.js +++ b/functions/setters/chastity/removeChastityBra.js @@ -6,31 +6,36 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a chastity bra from the user. * + * - (server id) serverID - The server this is running on * - (user id) user - The person wearing the chastity bra * - (user id) keyholder - The person removing the chastity bra from them * - (boolean) force - If true, forcibly removes this chastity bra * --- * ##### Returns true if successful, false if failed to remove **********/ -function removeChastityBra(user, keyholder, force = false) { +function removeChastityBra(serverID, user, keyholder, force = false) { traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } - let chastitybase = getBaseChastity(getChastityBra(user)?.chastitytype ?? "bra_silver") + if (process.chastitybra[serverID] == undefined) { + process.chastitybra[serverID] = {}; + } + let chastitybase = getBaseChastity(getChastityBra(serverID, user)?.chastitytype ?? "bra_silver") - if ((chastitybase && !chastitybase.canUnequip({ userID: user, keyholderID: keyholder })) && !force) return false; + if ((chastitybase && !chastitybase.canUnequip({ serverID: serverID, userID: user, keyholderID: keyholder })) && !force) return false; - chastitybase.onUnequip({ userID: user }); + chastitybase.onUnequip({ serverID: serverID, userID: user }); - if (process.chastitybra[user]?.stateligible) { + if (process.chastitybra[serverID][user]?.stateligible) { if (process.userstats == undefined) { process.userstats = {} } - if (process.userstats[user] == undefined) { process.userstats[user] = {} } - process.userstats[user].chastitybrawornduration = (Date.now() - process.chastitybra[user].timestamp) + if (process.userstats[serverID] == undefined) { process.userstats[serverID] = {} } + if (process.userstats[serverID][user] == undefined) { process.userstats[serverID][user] = {} } + process.userstats[serverID][user].chastitybrawornduration = (Date.now() - process.chastitybra[serverID][user].timestamp) markForSave("userstats"); } - delete process.chastitybra[user]; + delete process.chastitybra[serverID][user]; markForSave("chastitybra"); return true; diff --git a/functions/setters/chastity/revokeChastityBraKey.js b/functions/setters/chastity/revokeChastityBraKey.js index 19bd6033..957eb567 100644 --- a/functions/setters/chastity/revokeChastityBraKey.js +++ b/functions/setters/chastity/revokeChastityBraKey.js @@ -5,14 +5,15 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******* * Removes a cloned key from a chastity bra * + * - (server id) serverID - The server this is running on * - (user id) chastityuser - The user wearing the chastity bra * - (user id) newKeyholder - The user to remove from the cloned key list * --- * ##### *No return value* *******/ -function revokeChastityBraKey(chastityuser, newKeyholder) { +function revokeChastityBraKey(serverID, chastityuser, newKeyholder) { traceFirstParam(arguments[0]); - let chastity = getChastityBra(chastityuser); + let chastity = getChastityBra(serverID, chastityuser); if (!chastity.clonedKeyholders) { chastity.clonedKeyholders = []; } diff --git a/functions/setters/chastity/revokeChastityKey.js b/functions/setters/chastity/revokeChastityKey.js index d1b22c6b..2037172c 100644 --- a/functions/setters/chastity/revokeChastityKey.js +++ b/functions/setters/chastity/revokeChastityKey.js @@ -5,14 +5,15 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******* * Removes a cloned key from a chastity belt * + * - (server id) serverID - The server this is running on * - (user id) chastityuser - The user wearing the chastity belt * - (user id) newKeyholder - The user to remove from the cloned key list * --- * ##### *No return value* *******/ -function revokeChastityKey(chastityuser, newKeyholder) { +function revokeChastityKey(serverID, chastityuser, newKeyholder) { traceFirstParam(arguments[0]); - let chastity = getChastity(chastityuser); + let chastity = getChastity(serverID, chastityuser); if (!chastity.clonedKeyholders) { chastity.clonedKeyholders = []; } diff --git a/functions/setters/chastity/swapChastity.js b/functions/setters/chastity/swapChastity.js index 89b0a700..86d54d34 100644 --- a/functions/setters/chastity/swapChastity.js +++ b/functions/setters/chastity/swapChastity.js @@ -6,23 +6,27 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /*********** * Changes a chastity belt on the user in place * + * - (server id) serverID - The server this is running on * - (user id) user - The user wearing the chastity belt * - (user id) keyholder - The user trying to change the belt * - (string) namedchastity - The chastity belt ID to change to * --- * ##### Returns true if successful, false if unable to change ***********/ -function swapChastity(user, keyholder, namedchastity) { +function swapChastity(serverID, user, keyholder, namedchastity) { traceFirstParam(arguments[0]); if (process.chastity == undefined) { process.chastity = {}; } - let chastitybase = getBaseChastity(getChastity(user).chastitytype ?? "belt_silver") - if (chastitybase && !chastitybase.canUnequip({ userID: user, keyholderID: keyholder })) return false; - chastitybase.onUnequip({ userID: user }); - process.chastity[user].chastitytype = namedchastity; + if (process.chastity[serverID] == undefined) { + process.chastity[serverID] = {}; + } + let chastitybase = getBaseChastity(getChastity(serverID, user).chastitytype ?? "belt_silver") + if (chastitybase && !chastitybase.canUnequip({ serverID: serverID, userID: user, keyholderID: keyholder })) return false; + chastitybase.onUnequip({ serverID: serverID, userID: user }); + process.chastity[serverID][user].chastitytype = namedchastity; let newchastitybase = getBaseChastity(namedchastity) - newchastitybase.onEquip({ userID: user }); + newchastitybase.onEquip({ serverID: serverID, userID: user }); markForSave("chastity"); return true; } diff --git a/functions/setters/chastity/swapChastityBra.js b/functions/setters/chastity/swapChastityBra.js index 504234da..9d038813 100644 --- a/functions/setters/chastity/swapChastityBra.js +++ b/functions/setters/chastity/swapChastityBra.js @@ -6,23 +6,27 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /*********** * Changes a chastity bra on the user in place * + * - (server id) serverID - The server this is running on * - (user id) user - The user wearing the chastity bra * - (user id) keyholder - The user trying to change the bra * - (string) namedchastity - The chastity bra ID to change to * --- * ##### Returns true if successful, false if unable to change ***********/ -function swapChastityBra(user, keyholder, namedchastity) { +function swapChastityBra(serverID, user, keyholder, namedchastity) { traceFirstParam(arguments[0]); if (process.chastitybra == undefined) { process.chastitybra = {}; } - let chastitybase = getBaseChastity(getChastityBra(user).chastitytype ?? "bra_silver") - if (chastitybase && !chastitybase.canUnequip({ userID: user, keyholderID: keyholder })) return false; - chastitybase.onUnequip({ userID: user }); - process.chastitybra[user].chastitytype = namedchastity; + if (process.chastitybra[serverID] == undefined) { + process.chastitybra[serverID] = {}; + } + let chastitybase = getBaseChastity(getChastityBra(serverID, user).chastitytype ?? "bra_silver") + if (chastitybase && !chastitybase.canUnequip({ serverID: serverID, userID: user, keyholderID: keyholder })) return false; + chastitybase.onUnequip({ serverID: serverID, userID: user }); + process.chastitybra[serverID][user].chastitytype = namedchastity; let newchastitybase = getBaseChastity(namedchastity) - newchastitybase.onEquip({ userID: user }); + newchastitybase.onEquip({ serverID: serverID, userID: user }); markForSave("chastitybra"); return true; } diff --git a/functions/setters/chastity/transferChastityBraKey.js b/functions/setters/chastity/transferChastityBraKey.js index 2866b27b..a92348ff 100644 --- a/functions/setters/chastity/transferChastityBraKey.js +++ b/functions/setters/chastity/transferChastityBraKey.js @@ -5,17 +5,18 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Changes the primary keyholder for a user's chastity bra. Removes cloned keys. * + * - (server id) serverID - The server this is running on * - (user id) lockedUser - The person wearing the chastity bra * - (user id) newKeyholder - The next person to hold the key * --- * ##### Returns true if successful, false if lockedUser is not wearing a chastity bra ********/ -function transferChastityBraKey(lockedUser, newKeyholder) { +function transferChastityBraKey(serverID, lockedUser, newKeyholder) { traceFirstParam(arguments[0]); - if (getChastityBra(lockedUser)) { - if (getChastityBra(lockedUser).keyholder != newKeyholder) { - getChastityBra(lockedUser).keyholder = newKeyholder; - getChastityBra(lockedUser).clonedKeyholders = []; + if (getChastityBra(serverID, lockedUser)) { + if (getChastityBra(serverID, lockedUser).keyholder != newKeyholder) { + getChastityBra(serverID, lockedUser).keyholder = newKeyholder; + getChastityBra(serverID, lockedUser).clonedKeyholders = []; markForSave("chastitybra"); return true; } diff --git a/functions/setters/chastity/transferChastityKey.js b/functions/setters/chastity/transferChastityKey.js index 87109565..ff8aa7a4 100644 --- a/functions/setters/chastity/transferChastityKey.js +++ b/functions/setters/chastity/transferChastityKey.js @@ -5,17 +5,18 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Changes the primary keyholder for a user's chastity belt. Removes cloned keys. * + * - (server id) serverID - The server this is running on * - (user id) lockedUser - The person wearing the chastity belt * - (user id) newKeyholder - The next person to hold the key * --- * ##### Returns true if successful, false if lockedUser is not wearing a chastity belt ********/ -function transferChastityKey(lockedUser, newKeyholder) { +function transferChastityKey(serverID, lockedUser, newKeyholder) { traceFirstParam(arguments[0]); - if (getChastity(lockedUser)) { - if (getChastity(lockedUser).keyholder != newKeyholder) { - getChastity(lockedUser).keyholder = newKeyholder; - getChastity(lockedUser).clonedKeyholders = []; + if (getChastity(serverID, lockedUser)) { + if (getChastity(serverID, lockedUser).keyholder != newKeyholder) { + getChastity(serverID, lockedUser).keyholder = newKeyholder; + getChastity(serverID, lockedUser).clonedKeyholders = []; markForSave("chastity"); return true; } diff --git a/functions/setters/collar/addAdditionalCollarEffect.js b/functions/setters/collar/addAdditionalCollarEffect.js index f51da644..017d5b84 100644 --- a/functions/setters/collar/addAdditionalCollarEffect.js +++ b/functions/setters/collar/addAdditionalCollarEffect.js @@ -5,17 +5,18 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /****** * Adds an additional Collar effect to the user's collar, if they are wearing a collar. * + * - (server id) serverID - The server this is running on * - (user id) user - The user wearing the collar. * - (string) type - The collar effect to add * --- * ##### *No return value* *******/ -function addAdditionalCollarEffect(user, type) { +function addAdditionalCollarEffect(serverID, user, type) { traceFirstParam(arguments[0]); try { - if (getCollar(user)) { - if (!getCollar(user).additionalcollars) { getCollar(user).additionalcollars = [] } - getCollar(user).additionalcollars.push(type) + if (getCollar(serverID, user)) { + if (!getCollar(serverID, user).additionalcollars) { getCollar(serverID, user).additionalcollars = [] } + getCollar(serverID, user).additionalcollars.push(type) markForSave("collar"); } } diff --git a/functions/setters/collar/assignCollar.js b/functions/setters/collar/assignCollar.js index 4bbbf0e4..6329f7eb 100644 --- a/functions/setters/collar/assignCollar.js +++ b/functions/setters/collar/assignCollar.js @@ -4,6 +4,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds or modifies a collar on the user. * + * - (server id) serverID - The server this is running on * - (user id) user - The person wearing the collar * - (user id) keyholder - The person putting the collar on them * - (object) restraints - The restraint bypasses (mitten, chastity, heavy, mask) permitted on the collar @@ -12,12 +13,15 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * --- * ##### *No return value* **********/ -function assignCollar(user, keyholder, restraints, only, customcollar) { +function assignCollar(serverID, user, keyholder, restraints, only, customcollar) { traceFirstParam(arguments[0]); if (process.collar == undefined) { process.collar = {}; } - process.collar[user] = { + if (process.collar[serverID] == undefined) { + process.collar[serverID] = {}; + } + process.collar[serverID][user] = { keyholder: keyholder, keyholder_only: only, mitten: restraints?.mitten, diff --git a/functions/setters/collar/cloneCollarKey.js b/functions/setters/collar/cloneCollarKey.js index 2617ca0b..9c9ab333 100644 --- a/functions/setters/collar/cloneCollarKey.js +++ b/functions/setters/collar/cloneCollarKey.js @@ -5,14 +5,15 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Adds a user as a cloned keyholder for the collar * + * - (server id) serverID - The server this is running on * - (user id) collarUser - The user wearing the collar * - (user id) newKeyholder - The user added to the collar's cloned keys * --- * ##### *No return value* ********/ -function cloneCollarKey(collarUser, newKeyholder) { +function cloneCollarKey(serverID, collarUser, newKeyholder) { traceFirstParam(arguments[0]); - let collar = getCollar(collarUser); + let collar = getCollar(serverID, collarUser); if (!collar.clonedKeyholders) { collar.clonedKeyholders = []; } From d1694b25832ec0f93a14846e0df8350f9507d4ab Mon Sep 17 00:00:00 2001 From: Enraa Date: Fri, 19 Jun 2026 00:15:56 -0700 Subject: [PATCH 14/44] If I could tell her of my jealousy... --- .../collar/removeAdditionalCollarEffect.js | 11 ++-- functions/setters/collar/removeCollar.js | 8 ++- functions/setters/collar/revokeCollarKey.js | 5 +- functions/setters/collar/transferCollarKey.js | 11 ++-- functions/setters/config/assignOutfit.js | 35 +++++----- functions/setters/config/createWebhook.js | 2 + functions/setters/config/deleteWebhook.js | 2 + functions/setters/config/discardKey.js | 18 ++--- functions/setters/config/recordMessage.js | 4 +- functions/setters/config/renameOutfit.js | 14 ++-- functions/setters/config/restoreOutfit.js | 66 +++++++++---------- functions/setters/config/setOption.js | 12 ++-- functions/setters/config/setPronouns.js | 10 ++- functions/setters/config/setUserVar.js | 12 ++-- functions/setters/config/statsAddCounter.js | 10 +-- functions/setters/config/statsSetCounter.js | 8 ++- functions/setters/corset/assignCorset.js | 25 +++---- functions/setters/corset/removeCorset.js | 8 ++- functions/setters/delve/setDelveFloorState.js | 12 ++-- functions/setters/delve/setNextDelveRoom.js | 11 ++-- functions/setters/delve/setResolve.js | 8 ++- functions/setters/gag/assignGag.js | 3 +- functions/setters/gag/removeGag.js | 5 +- .../setters/headwear/addLockedHeadgear.js | 14 ++-- functions/setters/headwear/assignHeadwear.js | 23 ++++--- functions/setters/headwear/removeHeadwear.js | 40 ++++++----- .../setters/headwear/removeLockedHeadgear.js | 18 +++-- functions/setters/heavy/assignHeavy.js | 23 ++++--- functions/setters/heavy/removeHeavy.js | 32 +++++---- functions/setters/mitten/assignMitten.js | 15 +++-- functions/setters/mitten/removeMitten.js | 8 ++- functions/setters/toy/assignToy.js | 27 ++++---- functions/setters/toy/removeToy.js | 18 ++--- .../setters/wearable/addLockedWearable.js | 14 ++-- functions/setters/wearable/assignWearable.js | 12 ++-- .../setters/wearable/removeLockedWearable.js | 18 +++-- functions/setters/wearable/removeWearable.js | 28 ++++---- 37 files changed, 350 insertions(+), 240 deletions(-) diff --git a/functions/setters/collar/removeAdditionalCollarEffect.js b/functions/setters/collar/removeAdditionalCollarEffect.js index 857f2c6d..ecdb1939 100644 --- a/functions/setters/collar/removeAdditionalCollarEffect.js +++ b/functions/setters/collar/removeAdditionalCollarEffect.js @@ -5,20 +5,21 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******* * Removes an additional Collar effect from the user's collar, if they are wearing a collar. * + * - (server id) serverID - The server this is running on * - (user id) user - The user wearing the collar. * - (string) type - The collar effect to remove * --- * ##### *No return value* *******/ -function removeAdditionalCollarEffect(user, type) { +function removeAdditionalCollarEffect(serverID, user, type) { traceFirstParam(arguments[0]); try { if (getCollar(user)) { - if (getCollar(user).additionalcollars && getCollar(user).additionalcollars.includes(type)) { - getCollar(user).additionalcollars.splice(getCollar(user).additionalcollars.indexOf(type), 1); + if (getCollar(serverID, user).additionalcollars && getCollar(serverID, user).additionalcollars.includes(type)) { + getCollar(serverID, user).additionalcollars.splice(getCollar(serverID, user).additionalcollars.indexOf(type), 1); } - if (getCollar(user).additionalcollars && getCollar(user).additionalcollars.length == 0) { - delete getCollar(user).additionalcollars; + if (getCollar(serverID, user).additionalcollars && getCollar(serverID, user).additionalcollars.length == 0) { + delete getCollar(serverID, user).additionalcollars; } markForSave("collar"); } diff --git a/functions/setters/collar/removeCollar.js b/functions/setters/collar/removeCollar.js index 6e376708..65b56e90 100644 --- a/functions/setters/collar/removeCollar.js +++ b/functions/setters/collar/removeCollar.js @@ -4,16 +4,20 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Removes a collar from a user * + * - (server id) serverID - The server this is running on * - (user id) user - The user wearing the collar * --- * ##### *No return value* ********/ -function removeCollar(user) { +function removeCollar(serverID, user) { traceFirstParam(arguments[0]); if (process.collar == undefined) { process.collar = {}; } - delete process.collar[user]; + if (process.collar[serverID] == undefined) { + process.collar[serverID] = {}; + } + delete process.collar[serverID][user]; markForSave("collar"); } diff --git a/functions/setters/collar/revokeCollarKey.js b/functions/setters/collar/revokeCollarKey.js index 7ca0bb80..ae13e3fc 100644 --- a/functions/setters/collar/revokeCollarKey.js +++ b/functions/setters/collar/revokeCollarKey.js @@ -5,14 +5,15 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******* * Removes a cloned key from a collar * + * - (server id) serverID - The server this is running on * - (user id) collarUser - The user wearing the collar * - (user id) newKeyholder - The user to remove from the cloned key list * --- * ##### *No return value* *******/ -function revokeCollarKey(collarUser, newKeyholder) { +function revokeCollarKey(serverID, collarUser, newKeyholder) { traceFirstParam(arguments[0]); - let collar = getCollar(collarUser); + let collar = getCollar(serverID, collarUser); if (!collar.clonedKeyholders) { collar.clonedKeyholders = []; } diff --git a/functions/setters/collar/transferCollarKey.js b/functions/setters/collar/transferCollarKey.js index 77cb7fee..3cad6753 100644 --- a/functions/setters/collar/transferCollarKey.js +++ b/functions/setters/collar/transferCollarKey.js @@ -5,18 +5,19 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Changes the primary keyholder for a user's collar. Removes cloned keys. * + * - (server id) serverID - The server this is running on * - (user id) lockedUser - The person wearing the collar * - (user id) newKeyholder - The next person to hold the key * --- * ##### Returns true if successful, false if lockedUser is not wearing a collar ********/ -function transferCollarKey(lockedUser, newKeyholder) { +function transferCollarKey(serverID, lockedUser, newKeyholder) { traceFirstParam(arguments[0]); - if (getCollar(lockedUser)) { - if (getCollar(lockedUser).keyholder != newKeyholder) { - getCollar(lockedUser).keyholder = newKeyholder; + if (getCollar(serverID, lockedUser)) { + if (getCollar(serverID, lockedUser).keyholder != newKeyholder) { + getCollar(serverID, lockedUser).keyholder = newKeyholder; // Erase cloned keys in this process! - getCollar(lockedUser).clonedKeyholders = []; + getCollar(serverID, lockedUser).clonedKeyholders = []; markForSave("collar"); return true; } diff --git a/functions/setters/config/assignOutfit.js b/functions/setters/config/assignOutfit.js index 3aef1e26..0f5dcf4e 100644 --- a/functions/setters/config/assignOutfit.js +++ b/functions/setters/config/assignOutfit.js @@ -7,6 +7,7 @@ const { getHeavy } = require("../../getters/heavy/getHeavy"); const { getMitten } = require("../../getters/mitten/getMitten"); const { getToys } = require("../../getters/toy/getToys"); const { getLockedWearable } = require("../../getters/wearable/getLockedWearable"); +const { getHeadwear } = require("../../getters/headwear/getHeadwear"); const { getWearable } = require("../../getters/wearable/getWearable"); const { markForSave } = require("../../other/markForSave"); const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); @@ -14,66 +15,70 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* * Assigns an outfit to a slot for a user * + * - (server id) serverID - The server this is running on * - (user id) userID - The user whose outfit is getting saved * - (integer) slot - The slot number to save into * - (string bitarray) options - The 8 digit bit array * --- * ##### *No return value* **********/ -function assignOutfit(userID, slot, options) { +function assignOutfit(serverID, userID, slot, options) { traceFirstParam(arguments[0]); if (process.outfits == undefined) { process.outfits = {}; } - if (process.outfits[userID] == undefined) { - process.outfits[userID] = []; + if (process.outfits[serverID] == undefined) { + process.outfits[serverID] = {}; + } + if (process.outfits[serverID][userID] == undefined) { + process.outfits[serverID][userID] = []; } let storedobject = {}; if (typeof options == "string") { // These go in order based on inspect text. let optionbit = 0; if (options.charAt(optionbit) == 1) { - storedobject.gag = getGags(userID).length > 0 ? getGags(userID) : undefined; + storedobject.gag = getGags(serverID, userID).length > 0 ? getGags(serverID, userID) : undefined; } optionbit++; if (options.charAt(optionbit) == 1) { - storedobject.headwear = process.headwear[userID]; // Oops. + storedobject.headwear = getHeadwear(serverID, userID) } optionbit++; if (options.charAt(optionbit) == 1) { - storedobject.mitten = getMitten(userID); + storedobject.mitten = getMitten(serverID, userID); } optionbit++; if (options.charAt(optionbit) == 1) { - storedobject.wearable = getWearable(userID).length > 0 ? getWearable(userID) : undefined; - storedobject.lockedwearable = getLockedWearable(userID).length > 0 ? getLockedWearable(userID) : undefined; + storedobject.wearable = getWearable(serverID, userID).length > 0 ? getWearable(serverID, userID) : undefined; + storedobject.lockedwearable = getLockedWearable(serverID, userID).length > 0 ? getLockedWearable(serverID, userID) : undefined; } optionbit++; if (options.charAt(optionbit) == 1) { - storedobject.vibe = getToys(userID); + storedobject.vibe = getToys(serverID, userID); } optionbit++; if (options.charAt(optionbit) == 1) { - storedobject.chastity = getChastity(userID); + storedobject.chastity = getChastity(serverID, userID); } optionbit++; if (options.charAt(optionbit) == 1) { - storedobject.chastitybra = getChastityBra(userID); + storedobject.chastitybra = getChastityBra(serverID, userID); } optionbit++; if (options.charAt(optionbit) == 1) { - storedobject.corset = getCorset(userID); + storedobject.corset = getCorset(serverID, userID); } optionbit++; if (options.charAt(optionbit) == 1) { - storedobject.heavy = getHeavy(userID); + storedobject.heavy = getHeavy(serverID, userID); } optionbit++; if (options.charAt(optionbit) == 1) { - storedobject.collar = getCollar(userID); + storedobject.collar = getCollar(serverID, userID); } if (Object.keys(storedobject).length > 0) { - process.outfits[userID][slot] = JSON.parse(JSON.stringify(storedobject)); + process.outfits[serverID][userID][slot] = JSON.parse(JSON.stringify(storedobject)); markForSave("outfits"); } } diff --git a/functions/setters/config/createWebhook.js b/functions/setters/config/createWebhook.js index 8d881184..09ffd4dc 100644 --- a/functions/setters/config/createWebhook.js +++ b/functions/setters/config/createWebhook.js @@ -1,5 +1,7 @@ const { markForSave } = require("../../other/markForSave"); +// Since channels are unique regardless of the server, we don't really need to delineate them. + /******** * (async) Creates a webhook for a channel. * diff --git a/functions/setters/config/deleteWebhook.js b/functions/setters/config/deleteWebhook.js index ebc45f67..65c7fb84 100644 --- a/functions/setters/config/deleteWebhook.js +++ b/functions/setters/config/deleteWebhook.js @@ -1,3 +1,5 @@ +// Since channels are unique regardless of the server, we don't really need to delineate them. + /******** * (async) Delete a webhook for a channel. * diff --git a/functions/setters/config/discardKey.js b/functions/setters/config/discardKey.js index f24c33a4..3ffa95ab 100644 --- a/functions/setters/config/discardKey.js +++ b/functions/setters/config/discardKey.js @@ -5,36 +5,38 @@ const { statsAddCounter } = require("./statsAddCounter"); /******* * Discards a key held by keyholderid. Cloned keys are destroyed. * + * - (server id) serverID - The server this is running on * - (user id) userid - The user wearing the keyed bondage * - (user id) keyholderid - The user whose keys are being discarded * - (string) device - "collar", "chastity belt", or "chastity bra" * --- * ##### Returns "keyholder" or "clone", depending on which key was discarded *******/ -function discardKey(userid, keyholderid, device) { +function discardKey(serverID, userid, keyholderid, device) { traceFirstParam(arguments[0]); // If it isnt one of the three devices we know about, go away if ((device != "collar") && (device != "chastity belt") && (device != "chastity bra")) { console.log(`Unknown device ${device}. Use "collar", "chastity belt" or "chastity bra"`) return false } - statsAddCounter(keyholderid, "fumbledkeys") - statsAddCounter(userid, "restraintkeysfumbled") + statsAddCounter(serverID, keyholderid, "fumbledkeys") + statsAddCounter(serverID, userid, "restraintkeysfumbled") let processvar = "collar"; if (device == "chastity belt") { processvar = "chastity" } if (device == "chastity bra") { processvar = "chastitybra" } // If this is undefined, we have some big problems lol let typelocked = "none"; if (process[processvar] == undefined) { process[processvar] = {} } - if (process[processvar][userid]) { - if (process[processvar][userid].keyholder == keyholderid) { + if (process[processvar][serverID] == undefined) { process[processvar][serverID] = {} } + if (process[processvar][serverID][userid]) { + if (process[processvar][serverID][userid].keyholder == keyholderid) { // Lost primary keys - process[processvar][userid].fumbled = Date.now(); + process[processvar][serverID][userid].fumbled = Date.now(); typelocked = "keyholder"; } - else if (process[processvar][userid].clonedKeyholders.includes(keyholderid)) { + else if (process[processvar][serverID][userid].clonedKeyholders.includes(keyholderid)) { // Lost a clone. Clones should be destroyed. - process[processvar][userid].clonedKeyholders.splice(process[processvar][userid].clonedKeyholders.indexOf(keyholderid), 1) + process[processvar][serverID][userid].clonedKeyholders.splice(process[processvar][serverID][userid].clonedKeyholders.indexOf(keyholderid), 1) typelocked = "clone"; } } diff --git a/functions/setters/config/recordMessage.js b/functions/setters/config/recordMessage.js index c7ff54da..a6d84a85 100644 --- a/functions/setters/config/recordMessage.js +++ b/functions/setters/config/recordMessage.js @@ -1,6 +1,8 @@ const { getOption } = require("../../getters/config/getOption") const { markForSave } = require("../../other/markForSave") +// Message IDs are unique, so we do not need to delineate these. Use msg.guild.id for getOption. + /********* * Records a message for Edit Message app command * @@ -11,7 +13,7 @@ const { markForSave } = require("../../other/markForSave") * ##### *No return value* *********/ function recordMessage (msg, modifiedmsg, reply) { - if (getOption(msg?.author?.id, "recordmessages") == "disabled") { return } + if (msg?.guild?.id && getOption(msg?.guild?.id, msg?.author?.id, "recordmessages") == "disabled") { return } if (process.recordedmessages == undefined) { process.recordedmessages = {} } if (modifiedmsg?.id && msg?.content && msg?.author?.id && msg?.createdTimestamp) { process.recordedmessages[modifiedmsg.id] = { diff --git a/functions/setters/config/renameOutfit.js b/functions/setters/config/renameOutfit.js index 23c0e490..c0a26afb 100644 --- a/functions/setters/config/renameOutfit.js +++ b/functions/setters/config/renameOutfit.js @@ -4,22 +4,26 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Renames an outfit for a user * + * - (server ID) serverID - The server this is running on * - (user id) userID - The user whose outfit is being renamed * - (integer) slot - The slot number to rename * - (string) newname - The name to change the slot to * --- * ##### *No return value* ********/ -function renameOutfit(userID, slot, newname) { +function renameOutfit(serverID, userID, slot, newname) { traceFirstParam(arguments[0]); if (process.outfits == undefined) { process.outfits = {}; } - if (process.outfits[userID] == undefined) { - process.outfits[userID] = []; + if (process.outfits[serverID] == undefined) { + process.outfits[serverID] = {}; } - if (process.outfits[userID][slot]) { - process.outfits[userID][slot].outfitname = newname; + if (process.outfits[serverID][userID] == undefined) { + process.outfits[serverID][userID] = []; + } + if (process.outfits[serverID][userID][slot]) { + process.outfits[serverID][userID][slot].outfitname = newname; } markForSave("outfits"); } diff --git a/functions/setters/config/restoreOutfit.js b/functions/setters/config/restoreOutfit.js index 6291f162..ed4579cd 100644 --- a/functions/setters/config/restoreOutfit.js +++ b/functions/setters/config/restoreOutfit.js @@ -29,78 +29,78 @@ function restoreOutfit(serverID, userID, storedobject) { Object.keys(storedobject).forEach((k) => { // I could use a switch statement here but I feel like using if conditionals. if (k == "wearable") { - getWearable(userID); - getLockedWearable(userID); - if (!getHeavy(userID)) { - process.wearable[userID] = { wornwearable: storedobject.wearable, locked: storedobject.lockedwearable }; + getWearable(serverID, userID); + getLockedWearable(serverID, userID); + if (!getHeavy(serverID, userID)) { + process.wearable[serverID][userID] = { wornwearable: storedobject.wearable, locked: storedobject.lockedwearable }; markForSave("wearable"); } } if (k == "gag") { - getGags(userID); - if (!getHeavy(userID) && !getMitten(userID)) { - process.gags[userID] = storedobject.gag; + getGags(serverID, userID); + if (!getHeavy(serverID, userID) && !getMitten(serverID, userID)) { + process.gags[serverID][userID] = storedobject.gag; markForSave("gags"); } } if (k == "mitten") { - getMitten(userID); - if (!getHeavy(userID) && !getMitten(userID)) { - process.mitten[userID] = storedobject.mitten; + getMitten(serverID, userID); + if (!getHeavy(serverID, userID) && !getMitten(serverID, userID)) { + process.mitten[serverID][userID] = storedobject.mitten; markForSave("mitten"); } } if (k == "headwear") { - getHeadwear(userID); - if (!getHeavy(userID) && !getMitten(userID)) { - process.headwear[userID] = storedobject.headwear; + getHeadwear(serverID, userID); + if (!getHeavy(serverID, userID) && !getMitten(serverID, userID)) { + process.headwear[serverID][userID] = storedobject.headwear; markForSave("headwear"); } } if (k == "collar") { - getCollar(userID); - if (!getHeavy(userID) && (canAccessCollar(userID, userID, true).access || !canAccessCollar(userID, userID, true).hascollar)) { - process.collar[userID] = storedobject.collar; + getCollar(serverID, userID); + if (!getHeavy(serverID, userID) && (canAccessCollar(serverID, userID, userID, true).access || !canAccessCollar(serverID, userID, userID, true).hascollar)) { + process.collar[serverID][userID] = storedobject.collar; markForSave("collar"); } } if (k == "heavy") { - getHeavy(userID); - if (!getHeavy(userID)) { + getHeavy(serverID, userID); + if (!getHeavy(serverID, userID)) { if (!Array.isArray(storedobject.heavy)) { console.log("Loading a heavy that is not an array") console.log(storedobject.heavy) - process.heavy[userID] = [storedobject.heavy]; + process.heavy[serverID][userID] = [storedobject.heavy]; } else { - process.heavy[userID] = storedobject.heavy; + process.heavy[serverID][userID] = storedobject.heavy; } markForSave("heavy"); } } if (k == "corset") { - getCorset(userID); - if (!getHeavy(userID) && (canAccessChastity(userID, userID, true).access || !canAccessChastity(userID, userID, true).hasbelt)) { - process.corset[userID] = storedobject.corset; + getCorset(serverID, userID); + if (!getHeavy(serverID, userID) && (canAccessChastity(serverID, userID, userID, true).access || !canAccessChastity(serverID, userID, userID, true).hasbelt)) { + process.corset[serverID][userID] = storedobject.corset; markForSave("corset"); } } if (k == "chastity") { - getChastity(userID); - if (!getHeavy(userID) && (canAccessChastity(userID, userID, true).access || !canAccessChastity(userID, userID, true).hasbelt)) { - process.chastity[userID] = storedobject.chastity; - if (process.chastity[userID].stateligible) { - process.chastity[userID].stateligible = false; + getChastity(serverID, userID); + if (!getHeavy(serverID, userID) && (canAccessChastity(serverID, userID, userID, true).access || !canAccessChastity(serverID, userID, userID, true).hasbelt)) { + process.chastity[serverID][userID] = storedobject.chastity; + if (process.chastity[serverID][userID].stateligible) { + process.chastity[serverID][userID].stateligible = false; } markForSave("chastity"); } } if (k == "chastitybra") { - getChastityBra(userID); - if (!getHeavy(userID) && (canAccessChastityBra(userID, userID, true).access || !canAccessChastityBra(userID, userID, true).hasbelt)) { - process.chastitybra[userID] = storedobject.chastitybra; - if (process.chastitybra[userID].stateligible) { - process.chastitybra[userID].stateligible = false; + getChastityBra(serverID, userID); + if (!getHeavy(serverID, userID) && (canAccessChastityBra(serverID, userID, userID, true).access || !canAccessChastityBra(serverID, userID, userID, true).hasbelt)) { + process.chastitybra[serverID][userID] = storedobject.chastitybra; + if (process.chastitybra[serverID][userID].stateligible) { + process.chastitybra[serverID][userID].stateligible = false; } markForSave("chastitybra"); } diff --git a/functions/setters/config/setOption.js b/functions/setters/config/setOption.js index d727d4a1..1fe98f36 100644 --- a/functions/setters/config/setOption.js +++ b/functions/setters/config/setOption.js @@ -4,13 +4,14 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Sets the configured option for the user ID as set in /config * + * - (server ID) serverID - The server this is running on * - (user ID) userID - The person to modify the config of * - (string) option - The string name of the config option * - (any) choice - The value to set to the option * --- * ##### *No return value* ********/ -function setOption(userID, option, choice) { +function setOption(serverID, userID, option, choice) { traceFirstParam(arguments[0]); if (process.configs == undefined) { process.configs = {}; @@ -18,10 +19,13 @@ function setOption(userID, option, choice) { if (process.configs.users == undefined) { process.configs.users = {}; } - if (process.configs.users[userID] == undefined) { - process.configs.users[userID] = {}; + if (process.configs.users[serverID] == undefined) { + process.configs.users[serverID] = {}; } - process.configs.users[userID][option] = choice; + if (process.configs.users[serverID][userID] == undefined) { + process.configs.users[serverID][userID] = {}; + } + process.configs.users[serverID][userID][option] = choice; markForSave("configs"); } diff --git a/functions/setters/config/setPronouns.js b/functions/setters/config/setPronouns.js index a9df365e..18b319e3 100644 --- a/functions/setters/config/setPronouns.js +++ b/functions/setters/config/setPronouns.js @@ -6,19 +6,23 @@ const { setOption } = require("./setOption"); /********* * Sets pronouns for a user * + * - (server id) serverID - The server this is on * - (user id) user - The person setting pronouns * - (string) pronouns - "she/her", "he/him", "they/them", "it/its" * --- * ##### *No return value* *********/ -function setPronouns(user, pronouns) { +function setPronouns(serverID, user, pronouns) { traceFirstParam(arguments[0]); if (process.pronouns == undefined) { process.pronouns = {}; } + if (process.pronouns[serverID] == undefined) { + process.pronouns[serverID] = {}; + } - process.pronouns[user] = pronounsMap.get(pronouns); - setOption(user, "pronouns", (pronouns.split("/")[0])) + process.pronouns[serverID][user] = pronounsMap.get(pronouns); + setOption(serverID, user, "pronouns", (pronouns.split("/")[0])) markForSave("pronouns"); }; diff --git a/functions/setters/config/setUserVar.js b/functions/setters/config/setUserVar.js index 1bac8368..9ebfb592 100644 --- a/functions/setters/config/setUserVar.js +++ b/functions/setters/config/setUserVar.js @@ -4,21 +4,25 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Set a temporary user variable by key * + * - (server id) serverID - The server this is running on * - (user id) user - The User whose key to search for * - (string) key - The specific key to retrieve * - (any) value - The data to store in this user var * --- * ##### *No return value* **********/ -function setUserVar(user, key, value) { +function setUserVar(serverID, user, key, value) { traceFirstParam(arguments[0]); if (process.usercontext == undefined) { process.usercontext = {}; } - if (process.usercontext[user] == undefined) { - process.usercontext[user] = {}; + if (process.usercontext[serverID] == undefined) { + process.usercontext[serverID] = {}; } - process.usercontext[user][key] = value; + if (process.usercontext[serverID][user] == undefined) { + process.usercontext[serverID][user] = {}; + } + process.usercontext[serverID][user][key] = value; markForSave("usercontext"); } diff --git a/functions/setters/config/statsAddCounter.js b/functions/setters/config/statsAddCounter.js index e1ccba7b..b32b28e1 100644 --- a/functions/setters/config/statsAddCounter.js +++ b/functions/setters/config/statsAddCounter.js @@ -4,18 +4,20 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds a point to a counter by name in user's stats. Specify amount for custom amount. * + * - (server id) serverID - The server this is running on * - (user id) user - User to increment for * - (string) countername - ID of the counter to increment * - (number) amount - Amount to increment the counter by. Default to 1 * --- * ##### *No return value* **********/ -function statsAddCounter(user, countername, amount = 1) { +function statsAddCounter(serverID, user, countername, amount = 1) { traceFirstParam(arguments[0]); if (process.userstats == undefined) { process.userstats = {} } - if (process.userstats[user] == undefined) { process.userstats[user] = {} } - let newcount = (process.userstats[user][countername] ?? 0) + amount; - process.userstats[user][countername] = newcount; + if (process.userstats[serverID] == undefined) { process.userstats[serverID] = {} } + if (process.userstats[serverID][user] == undefined) { process.userstats[serverID][user] = {} } + let newcount = (process.userstats[serverID][user][countername] ?? 0) + amount; + process.userstats[serverID][user][countername] = newcount; markForSave("userstats"); } diff --git a/functions/setters/config/statsSetCounter.js b/functions/setters/config/statsSetCounter.js index 690f020f..a4df9891 100644 --- a/functions/setters/config/statsSetCounter.js +++ b/functions/setters/config/statsSetCounter.js @@ -4,15 +4,17 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Set the counter for a user by name. Specify Value * + * - (server id) serverID - The server this is running on * - (user id) user - User to increment for * - (string) countername - ID of the counter to increment * - (any) value - Value to store in countername **********/ -function statsSetCounter(user, countername, value) { +function statsSetCounter(serverID, user, countername, value) { traceFirstParam(arguments[0]); if (process.userstats == undefined) { process.userstats = {} } - if (process.userstats[user] == undefined) { process.userstats[user] = {} } - process.userstats[user][countername] = value; + if (process.userstats[serverID] == undefined) { process.userstats[serverID] = {} } + if (process.userstats[serverID][user] == undefined) { process.userstats[serverID][user] = {} } + process.userstats[serverID][user][countername] = value; markForSave("userstats"); } diff --git a/functions/setters/corset/assignCorset.js b/functions/setters/corset/assignCorset.js index 7dd47040..6a18dfd3 100644 --- a/functions/setters/corset/assignCorset.js +++ b/functions/setters/corset/assignCorset.js @@ -8,6 +8,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds or modifies a corset on the user. * + * - (server id) serverID - The server this is running on * - (user id) user - The person wearing the corset * - (string) type - The type of corset applied to the wearer * - (integer) tightness - How tight the corset should be (1-10) @@ -15,18 +16,19 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * --- * ##### *No return value* **********/ -function assignCorset(user, type, tightness, origbinder) { +function assignCorset(serverID, user, type, tightness, origbinder) { traceFirstParam(arguments[0]); if (process.corset == undefined) process.corset = {}; - const old = Object.assign({}, process.corset[user]); - const currentBreath = process.corset[user] ? getBreath(user) : null; + if (process.corset[serverID] == undefined) process.corset[serverID] = {}; + const old = Object.assign({}, process.corset[serverID][user]); + const currentBreath = process.corset[serverID][user] ? getBreath(serverID, user) : null; let originalbinder = old?.origbinder; if (old && old.type != type) { // Call the unequip function on the old corset - getBaseCorset(old?.type)?.onUnequip({ userID: user, oldcorset: old }); + getBaseCorset(old?.type)?.onUnequip({ serverID: serverID, userID: user, oldcorset: old }); } const newMaxBreath = getBaseCorset(type)?.getMaxBreath({ tightness: 0 }) ?? getBaseCorset("corset_leather").getMaxBreath({ tightness: 0 }); - process.corset[user] = { + process.corset[serverID][user] = { tightness: tightness ?? old?.tightness ?? 5, breath: currentBreath ? Math.min(currentBreath, newMaxBreath) : newMaxBreath, timestamp: Date.now(), @@ -34,19 +36,20 @@ function assignCorset(user, type, tightness, origbinder) { type: type, }; if (old.type == type) { - getBaseCorset(old?.type)?.onAdjustTightness({ userID: user, oldTightness: old.tightness, newTightness: tightness }); + getBaseCorset(old?.type)?.onAdjustTightness({ serverID: serverID, userID: user, oldTightness: old.tightness, newTightness: tightness }); } - if (getChastity(user) && getBaseChastity(getChastity(user).chastitytype)) { - getBaseChastity(getChastity(user).chastitytype).onCorsetChange({ userID: user, keyholderID: origbinder, oldcorset: old }) + if (getChastity(serverID, user) && getBaseChastity(getChastity(serverID, user).chastitytype)) { + getBaseChastity(getChastity(serverID, user).chastitytype).onCorsetChange({ serverID: serverID, userID: user, keyholderID: origbinder, oldcorset: old }) } if (old.type != type) { - getBaseCorset(type)?.onEquip({ userID: user }); + getBaseCorset(type)?.onEquip({ serverID: serverID, userID: user }); } // Increment the worn corset counter if (process.userstats == undefined) { process.userstats = {} } - if (process.userstats[user] == undefined) { process.userstats[user] = {} } + if (process.userstats[serverID] == undefined) { process.userstats[serverID] = {} } + if (process.userstats[serverID][user] == undefined) { process.userstats[serverID][user] = {} } - process.userstats[user].worncorsets = (process.userstats[user].worncorsets ?? 0) + 1; + process.userstats[serverID][user].worncorsets = (process.userstats[serverID][user].worncorsets ?? 0) + 1; markForSave("corset"); markForSave("userstats"); diff --git a/functions/setters/corset/removeCorset.js b/functions/setters/corset/removeCorset.js index a8cb12c4..e1991646 100644 --- a/functions/setters/corset/removeCorset.js +++ b/functions/setters/corset/removeCorset.js @@ -4,14 +4,18 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******** * Removes a corset from a user * + * - (server id) serverID - The server this is running on * - (user id) user - The user wearing the corset * --- * ##### *No return value* + * --- + * ##### Needs adjustment to fire the removed corset's onUnequip function ********/ -function removeCorset(user) { +function removeCorset(serverID, user) { traceFirstParam(arguments[0]); if (process.corset == undefined) process.corset = {}; - delete process.corset[user]; + if (process.corset[serverID] == undefined) process.corset[serverID] = {}; + delete process.corset[serverID][user]; markForSave("corset"); }; diff --git a/functions/setters/delve/setDelveFloorState.js b/functions/setters/delve/setDelveFloorState.js index bbaa438d..9ae4da0e 100644 --- a/functions/setters/delve/setDelveFloorState.js +++ b/functions/setters/delve/setDelveFloorState.js @@ -4,6 +4,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******* * Set a floor prop on the floordata array. This is data only used by the floor itself. * + * - (server ID) serverID - The server this is running on * - (user ID) user - The user ID doing the delve * - (integer) floor - Floor number they are on * - (string) prop - Name of the property to save @@ -11,14 +12,15 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * --- * ##### *No return value* *******/ -function setDelveFloorState(user, floor, prop, value) { +function setDelveFloorState(serverID, user, floor, prop, value) { traceFirstParam(arguments[0]); if (process.delveuserdata == undefined) { process.delveuserdata = {} } - if (process.delveuserdata[user]) { + if (process.delveuserdata[serverID] == undefined) { process.delveuserdata[serverID] = {} } + if (process.delveuserdata[serverID][user]) { // They started a delve, now check what floor they're on - if (process.delveuserdata[user].floordata == undefined) { process.delveuserdata[user].floordata = [] } - if (process.delveuserdata[user].floordata[floor] == undefined) { process.delveuserdata[user].floordata[floor] = {} } - process.delveuserdata[user].floordata[floor][prop] = value; + if (process.delveuserdata[serverID][user].floordata == undefined) { process.delveuserdata[serverID][user].floordata = [] } + if (process.delveuserdata[serverID][user].floordata[floor] == undefined) { process.delveuserdata[serverID][user].floordata[floor] = {} } + process.delveuserdata[serverID][user].floordata[floor][prop] = value; markForSave("delveuserdata"); } } diff --git a/functions/setters/delve/setNextDelveRoom.js b/functions/setters/delve/setNextDelveRoom.js index 42a5aced..8e385ee5 100644 --- a/functions/setters/delve/setNextDelveRoom.js +++ b/functions/setters/delve/setNextDelveRoom.js @@ -6,25 +6,26 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* * Sets the next Delve room by choice. If choice is not specified, the user is starting a new delve. This will always default to the delveentrance room. * + * - (server ID) serverID - The server this is running on * - (user ID) user - The user ID doing the delve * - (string) choice - The prop name in delveroomchoices * --- * ##### *No return value* *********/ -function setNextDelveRoom(user, choice) { +function setNextDelveRoom(serverID, user, choice) { traceFirstParam(arguments[0]); - if ((getCurrentFloor(user) == undefined)) { - process.delveuserdata[user] = { + if ((getCurrentFloor(serverID, user) == undefined)) { + process.delveuserdata[serverID][user] = { floorarr: ["delveentrance"], floorscompleted: -1, floor: 0, tempbuffs: [], - resolve: 10 + Math.round(getDelvePlayerStats(user).stamina / 2) + resolve: 10 + Math.round(getDelvePlayerStats(serverID, user).stamina / 2) } markForSave("delveuserdata"); } else { - process.delveuserdata[user].floorarr.push(choice); + process.delveuserdata[serverID][user].floorarr.push(choice); } } diff --git a/functions/setters/delve/setResolve.js b/functions/setters/delve/setResolve.js index c1dd7336..1c0ca1b2 100644 --- a/functions/setters/delve/setResolve.js +++ b/functions/setters/delve/setResolve.js @@ -3,14 +3,16 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /******* * Modifies the user's current Resolve, reducing it to 0 at minimum if it goes past that. * + * - (server id) serverID - The server this is running on * - (user id) user - User ID doing the Delve * - (integer) resolveamt - Amount of resolve to add or remove *******/ -function modifyResolve(user, resolveamt) { +function modifyResolve(serverID, user, resolveamt) { traceFirstParam(arguments[0]); if (process.delveuserdata == undefined) { process.delveuserdata = {} } - if (process.delveuserdata[user]) { - process.delveuserdata[user].resolve = Math.max(parseInt(process.delveuserdata[user].resolve) + resolveamt, 0); + if (process.delveuserdata[serverID] == undefined) { process.delveuserdata[serverID] = {} } + if (process.delveuserdata[serverID][user]) { + process.delveuserdata[serverID][user].resolve = Math.max(parseInt(process.delveuserdata[serverID][user].resolve) + resolveamt, 0); } } diff --git a/functions/setters/gag/assignGag.js b/functions/setters/gag/assignGag.js index 2c06e280..2eba3cd1 100644 --- a/functions/setters/gag/assignGag.js +++ b/functions/setters/gag/assignGag.js @@ -5,6 +5,7 @@ const { statsAddCounter } = require("../config/statsAddCounter"); /********** * Adds or modifies a gag on the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The person wearing the gag * - (string) gagtype - The type of gag applied to the wearer * - (integer) intensity - How tight the gag is applied to the wearer @@ -32,7 +33,7 @@ function assignGag(serverID, userID, gagtype = "ball", intensity = 5, origbinder } process.gags[serverID][userID].push({ gagtype: gagtype, intensity: intensity, origbinder: originalbinder }); - statsAddCounter(userID, "worngags") + statsAddCounter(serverID, userID, "worngags") markForSave("gags"); markForSave("userstats"); diff --git a/functions/setters/gag/removeGag.js b/functions/setters/gag/removeGag.js index 3d69009f..66c0c667 100644 --- a/functions/setters/gag/removeGag.js +++ b/functions/setters/gag/removeGag.js @@ -4,13 +4,14 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a gag from the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The person wearing the gag * - (string) specificgag - The type of gag to remove * - (boolean) force - If true, forcibly removes the gag even past the headgear * --- * ##### *No return value* **********/ -function deleteGag(userID, specificgag, force = false) { +function deleteGag(serverID, userID, specificgag, force = false) { traceFirstParam(arguments[0]); if (process.gags == undefined) { process.gags = {}; @@ -18,7 +19,7 @@ function deleteGag(userID, specificgag, force = false) { // Remove all gags if none is specified. if (!specificgag && process.gags[serverID] && process.gags[serverID][userID]) { let lockedheadgears = []; - if (process.headwear[serverID] && process.headwear[serverID][userID]) { lockedheadgears = Object.keys(process.headwear[userID]) } + if (process.headwear[serverID] && process.headwear[serverID][userID]) { lockedheadgears = Object.keys(process.headwear[serverID][userID]) } if ((lockedheadgears.length <= 1) || force) { // They dont have anything locked on their head, business as usual. process.gags[serverID][userID].forEach((g) => { diff --git a/functions/setters/headwear/addLockedHeadgear.js b/functions/setters/headwear/addLockedHeadgear.js index 0501bd4e..7bb17f8d 100644 --- a/functions/setters/headwear/addLockedHeadgear.js +++ b/functions/setters/headwear/addLockedHeadgear.js @@ -4,21 +4,25 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds a locked headwear item on the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The person wearing the collar * - (string) headwear - Headwear item ID * --- * ##### *No return value* **********/ -function addLockedHeadgear(userID, headwear) { +function addLockedHeadgear(serverID, userID, headwear) { traceFirstParam(arguments[0]); if (process.headwear == undefined) { process.headwear = {}; } - if (process.headwear[userID]) { - if (process.headwear[userID].locked == undefined) { - process.headwear[userID].locked = [headwear]; + if (process.headwear[serverID] == undefined) { + process.headwear[serverID] = {}; + } + if (process.headwear[serverID][userID]) { + if (process.headwear[serverID][userID].locked == undefined) { + process.headwear[serverID][userID].locked = [headwear]; } else { - process.headwear[userID].locked.push(headwear); + process.headwear[serverID][userID].locked.push(headwear); } } markForSave("headwear"); diff --git a/functions/setters/headwear/assignHeadwear.js b/functions/setters/headwear/assignHeadwear.js index c0f98b39..dcd4c863 100644 --- a/functions/setters/headwear/assignHeadwear.js +++ b/functions/setters/headwear/assignHeadwear.js @@ -5,33 +5,38 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds or modifies a headwear on the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The person wearing the headgear * - (string) headwear - Headwear item ID * - (user id) origbinder - The person doing the action * --- * ##### *No return value* **********/ -function assignHeadwear(userID, headwear, origbinder) { +function assignHeadwear(serverID, userID, headwear, origbinder) { traceFirstParam(arguments[0]); if (process.headwear == undefined) { process.headwear = {}; } - let originalbinder = process.headwear[userID]?.origbinder; - if (process.headwear[userID]) { - process.headwear[userID].wornheadwear.push(headwear); + if (process.headwear[serverID] == undefined) { + process.headwear[serverID] = {}; + } + let originalbinder = process.headwear[serverID][userID]?.origbinder; + if (process.headwear[serverID][userID]) { + process.headwear[serverID][userID].wornheadwear.push(headwear); } else { - process.headwear[userID] = { wornheadwear: [headwear], origbinder: originalbinder ?? origbinder }; + process.headwear[serverID][userID] = { wornheadwear: [headwear], origbinder: originalbinder ?? origbinder }; } - originalbinder = ((process.headwear[userID] && process.headwear[userID][headwear] && process.headwear[userID][headwear].origbinder) ?? origbinder) ?? userID; - process.headwear[userID][headwear] = { + originalbinder = ((process.headwear[serverID][userID] && process.headwear[serverID][userID][headwear] && process.headwear[serverID][userID][headwear].origbinder) ?? origbinder) ?? userID; + process.headwear[serverID][userID][headwear] = { origbinder: originalbinder ?? userID, lockable: getBaseHeadwear(headwear).lockable } // Increment the worn corset counter if (process.userstats == undefined) { process.userstats = {} } - if (process.userstats[userID] == undefined) { process.userstats[userID] = {} } + if (process.userstats[serverID] == undefined) { process.userstats[serverID] = {} } + if (process.userstats[serverID][userID] == undefined) { process.userstats[serverID][userID] = {} } - process.userstats[userID].wornmasks = (process.userstats[userID].wornmasks ?? 0) + 1; + process.userstats[serverID][userID].wornmasks = (process.userstats[serverID][userID].wornmasks ?? 0) + 1; markForSave("headwear"); markForSave("userstats"); diff --git a/functions/setters/headwear/removeHeadwear.js b/functions/setters/headwear/removeHeadwear.js index 33dc8aa8..85ccc672 100644 --- a/functions/setters/headwear/removeHeadwear.js +++ b/functions/setters/headwear/removeHeadwear.js @@ -5,52 +5,56 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a headwear from the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The person wearing the headwear * - (string) headwear - The type of headwear to remove * - (boolean) force - If true, forcibly removes all headwear * --- * ##### *No return value* **********/ -function deleteHeadwear(userID, headwear, force = true) { +function deleteHeadwear(serverID, userID, headwear, force = true) { traceFirstParam(arguments[0]); if (process.headwear == undefined) { process.headwear = {}; } - if (!process.headwear[userID]) { + if (process.headwear[serverID] == undefined) { + process.headwear[serverID] = {}; + } + if (!process.headwear[serverID][userID]) { return false; } - if (headwear && process.headwear[userID].wornheadwear.includes(headwear) && !getLockedHeadgear(userID).includes(headwear)) { + if (headwear && process.headwear[serverID][userID].wornheadwear.includes(headwear) && !getLockedHeadgear(serverID, userID).includes(headwear)) { if (process.headtypes[headwear] && process.headtypes[headwear].onUnlock) { process.headtypes[headwear].onUnlock({ userID: userID }); } - process.headwear[userID].wornheadwear.splice(process.headwear[userID].wornheadwear.indexOf(headwear), 1); - delete process.headwear[userID][headwear]; // Removed origbinders for specific headgears - if (process.headwear[userID].wornheadwear.length == 0) { - delete process.headwear[userID]; + process.headwear[serverID][userID].wornheadwear.splice(process.headwear[serverID][userID].wornheadwear.indexOf(headwear), 1); + delete process.headwear[serverID][userID][headwear]; // Removed origbinders for specific headgears + if (process.headwear[serverID][userID].wornheadwear.length == 0) { + delete process.headwear[serverID][userID]; } - } else if (process.headwear[userID]) { - let locks = getLockedHeadgear(userID); + } else if (process.headwear[serverID][userID]) { + let locks = getLockedHeadgear(serverID, userID); let savedheadgear = []; let origbounds = {}; - process.headwear[userID].wornheadwear.forEach((g) => { + process.headwear[serverID][userID].wornheadwear.forEach((g) => { if (locks.includes(g)) { savedheadgear.push(g); - if (process.headwear[userID][g]) { - origbounds[g] = Object.assign({}, process.headwear[userID][g]) // deep clone the origbound object + if (process.headwear[serverID][userID][g]) { + origbounds[g] = Object.assign({}, process.headwear[serverID][userID][g]) // deep clone the origbound object } - delete process.headwear[userID][g]; + delete process.headwear[serverID][userID][g]; } }); - process.headwear[userID].wornheadwear = savedheadgear; + process.headwear[serverID][userID].wornheadwear = savedheadgear; Object.keys(origbounds).forEach((k) => { // Bring back the objects! - process.headwear[userID][k] = origbounds[k]; + process.headwear[serverID][userID][k] = origbounds[k]; }) - if (process.headwear[userID].wornheadwear.length == 0) { - delete process.headwear[userID]; + if (process.headwear[serverID][userID].wornheadwear.length == 0) { + delete process.headwear[serverID][userID]; } } - if (force) { delete process.headwear[userID] } + if (force) { delete process.headwear[serverID][userID] } markForSave("headwear"); }; diff --git a/functions/setters/headwear/removeLockedHeadgear.js b/functions/setters/headwear/removeLockedHeadgear.js index 256deaa6..e4ce1ca0 100644 --- a/functions/setters/headwear/removeLockedHeadgear.js +++ b/functions/setters/headwear/removeLockedHeadgear.js @@ -4,25 +4,29 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a locked headwear item from the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The person wearing the headgear * - (string) headwear - Headwear item ID * --- * ##### *No return value* **********/ -function removeLockedHeadgear(userID, headwear) { +function removeLockedHeadgear(serverID, userID, headwear) { traceFirstParam(arguments[0]); if (process.headwear == undefined) { process.headwear = {}; } - if (process.headwear[userID]) { - if (process.headwear[userID].locked == undefined) { + if (process.headwear[serverID] == undefined) { + process.headwear[serverID] = {}; + } + if (process.headwear[serverID][userID]) { + if (process.headwear[serverID][userID].locked == undefined) { return; } else { - if (process.headwear[userID].locked.includes(headwear)) { - process.headwear[userID].locked.splice(process.headwear[userID].locked.indexOf(headwear), 1); + if (process.headwear[serverID][userID].locked.includes(headwear)) { + process.headwear[serverID][userID].locked.splice(process.headwear[serverID][userID].locked.indexOf(headwear), 1); } - if (process.headwear[userID].locked.length == 0) { - delete process.headwear[userID].locked; + if (process.headwear[serverID][userID].locked.length == 0) { + delete process.headwear[serverID][userID].locked; } } } diff --git a/functions/setters/heavy/assignHeavy.js b/functions/setters/heavy/assignHeavy.js index 0660f698..1a11bfc9 100644 --- a/functions/setters/heavy/assignHeavy.js +++ b/functions/setters/heavy/assignHeavy.js @@ -5,6 +5,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /************** * Adds a heavy bondage to a user. * + * - (server id) serverID - The server this is running on * - (user id) user - The user to wear the heavy bondage * - (string) type - The specific heavy bondage type * - (user id) origbinder - The person applying the heavy bondage @@ -12,7 +13,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * --- * ##### *No return value* **************/ -function assignHeavy(user, type, origbinder, customname) { +function assignHeavy(serverID, user, type, origbinder, customname) { traceFirstParam(arguments[0]); let namedcontainerowner; if ((type === "dominants_lap") || (type === "engulfing_slime")) { @@ -21,18 +22,21 @@ function assignHeavy(user, type, origbinder, customname) { if (process.heavy == undefined) { process.heavy = {}; } - if (process.heavy[user] == undefined) { - process.heavy[user] = []; + if (process.heavy[serverID] == undefined) { + process.heavy[serverID] = {}; } - if (process.heavy[user].length > 0) { - let existingheavy = process.heavy[user].find((h) => h.type === type) + if (process.heavy[serverID][user] == undefined) { + process.heavy[serverID][user] = []; + } + if (process.heavy[serverID][user].length > 0) { + let existingheavy = process.heavy[serverID][user].find((h) => h.type === type) if (existingheavy) { existingheavy.origbinder = origbinder; existingheavy.displayname = customname ?? getHeavyName(type); existingheavy.namedcontainerowner = namedcontainerowner; } else { - process.heavy[user].push({ + process.heavy[serverID][user].push({ type: type, origbinder: origbinder, displayname: customname ?? getHeavyName(type), @@ -41,7 +45,7 @@ function assignHeavy(user, type, origbinder, customname) { } } else { - process.heavy[user].push({ + process.heavy[serverID][user].push({ type: type, origbinder: origbinder, displayname: customname ?? getHeavyName(type), @@ -51,9 +55,10 @@ function assignHeavy(user, type, origbinder, customname) { // Increment the worn heavy bondage counter if (process.userstats == undefined) { process.userstats = {} } - if (process.userstats[user] == undefined) { process.userstats[user] = {} } + if (process.userstats[serverID] == undefined) { process.userstats[serverID] = {} } + if (process.userstats[serverID][user] == undefined) { process.userstats[serverID][user] = {} } - process.userstats[user].wornheavy = (process.userstats[user].wornheavy ?? 0) + 1; + process.userstats[serverID][user].wornheavy = (process.userstats[serverID][user].wornheavy ?? 0) + 1; markForSave("heavy"); markForSave("userstats"); diff --git a/functions/setters/heavy/removeHeavy.js b/functions/setters/heavy/removeHeavy.js index e6b45bb7..1ced40a6 100644 --- a/functions/setters/heavy/removeHeavy.js +++ b/functions/setters/heavy/removeHeavy.js @@ -4,37 +4,43 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********* * Remove Heavy Bondage from user. If **type** is not specified, will remove the first heavy bondage in the list. * + * - (server id) serverID - The server this is running on * - (user id) user - The user to remove heavy bondage for * - (string) type - The specific heavy bondage to remove * - (boolean) force? - If true, removes all heavy bondage + * --- + * ##### There is currently a bug with onremove functions that should be investigated. *********/ -const removeHeavy = (user, type, force) => { +function removeHeavy(serverID, user, type, force) { traceFirstParam(arguments[0]); if (process.heavy == undefined) { process.heavy = {}; } - if (process.heavy[user] && process.heavy[user].typeval && process.onremovefunctions && process.onremovefunctions.heavy && process.onremovefunctions.heavy[process.heavy[user].typeval]) { - process.onremovefunctions.heavy[process.heavy[user].typeval](user); + if (process.heavy[serverID] == undefined) { + process.heavy[serverID] = {}; + } + if (process.heavy[serverID][user] && process.heavy[serverID][user].typeval && process.onremovefunctions && process.onremovefunctions.heavy && process.onremovefunctions.heavy[process.heavy[serverID][user].typeval]) { + process.onremovefunctions.heavy[process.heavy[serverID][user].typeval](user); } - if (process.heavy[user]) { + if (process.heavy[serverID][user]) { if (type) { - let find = process.heavy[user].findIndex((h) => h.type === type) + let find = process.heavy[serverID][user].findIndex((h) => h.type === type) if (find > -1) { - if (process.heavy[user][find] && process.onremovefunctions && process.onremovefunctions.heavy && process.onremovefunctions.heavy[process.heavy[user][find].type]) { - process.onremovefunctions.heavy[process.heavy[user][find].type](user); + if (process.heavy[serverID][user][find] && process.onremovefunctions && process.onremovefunctions.heavy && process.onremovefunctions.heavy[process.heavy[serverID][user][find].type]) { + process.onremovefunctions.heavy[process.heavy[serverID][user][find].type](user); } - process.heavy[user].splice(find,1); + process.heavy[serverID][user].splice(find,1); } } else { - if (process.heavy[user][0] && process.onremovefunctions && process.onremovefunctions.heavy && process.onremovefunctions.heavy[process.heavy[user][0].type]) { - process.onremovefunctions.heavy[process.heavy[user][0].type](user); + if (process.heavy[serverID][user][0] && process.onremovefunctions && process.onremovefunctions.heavy && process.onremovefunctions.heavy[process.heavy[serverID][user][0].type]) { + process.onremovefunctions.heavy[process.heavy[serverID][user][0].type](user); } - process.heavy[user].splice(0,1); + process.heavy[serverID][user].splice(0,1); } } - if ((process.heavy[user]?.length == 0) || force) { - delete process.heavy[user] + if ((process.heavy[serverID][user]?.length == 0) || force) { + delete process.heavy[serverID][user] } markForSave("heavy"); }; diff --git a/functions/setters/mitten/assignMitten.js b/functions/setters/mitten/assignMitten.js index 662c8c74..df2d6d88 100644 --- a/functions/setters/mitten/assignMitten.js +++ b/functions/setters/mitten/assignMitten.js @@ -4,27 +4,32 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds or modifies mittens on the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The person wearing the mittens * - (string) mittentype - The type of mittens applied to the wearer * - (user id) origbinder - Who's adding/modifying the mittens * --- * ##### *No return value* **********/ -function assignMitten(userID, mittentype, origbinder) { +function assignMitten(serverID, userID, mittentype, origbinder) { traceFirstParam(arguments[0]); if (process.mitten == undefined) { process.mitten = {}; } - let originalbinder = process.mitten[userID]?.origbinder; - process.mitten[userID] = { + if (process.mitten[serverID] == undefined) { + process.mitten[serverID] = {}; + } + let originalbinder = process.mitten[serverID][userID]?.origbinder; + process.mitten[serverID][userID] = { mittenname: mittentype, origbinder: originalbinder ?? origbinder, // Preserve original binder until it is removed. }; if (process.userstats == undefined) { process.userstats = {} } - if (process.userstats[userID] == undefined) { process.userstats[userID] = {} } + if (process.userstats[serverID] == undefined) { process.userstats[serverID] = {} } + if (process.userstats[serverID][userID] == undefined) { process.userstats[serverID][userID] = {} } - process.userstats[userID].wornmittens = (process.userstats[userID].wornmittens ?? 0) + 1; + process.userstats[serverID][userID].wornmittens = (process.userstats[serverID][userID].wornmittens ?? 0) + 1; markForSave("mitten"); markForSave("userstats"); diff --git a/functions/setters/mitten/removeMitten.js b/functions/setters/mitten/removeMitten.js index 0205eb94..c7606dfe 100644 --- a/functions/setters/mitten/removeMitten.js +++ b/functions/setters/mitten/removeMitten.js @@ -4,16 +4,20 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes mittens from the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The person wearing the mittens * --- * ##### *No return value* **********/ -function deleteMitten(userID) { +function deleteMitten(serverID, userID) { traceFirstParam(arguments[0]); if (process.mitten == undefined) { process.mitten = {}; } - delete process.mitten[userID]; + if (process.mitten[serverID] == undefined) { + process.mitten[serverID] = {}; + } + delete process.mitten[serverID][userID]; markForSave("mitten"); }; diff --git a/functions/setters/toy/assignToy.js b/functions/setters/toy/assignToy.js index fc9fd271..9a9c3f0e 100644 --- a/functions/setters/toy/assignToy.js +++ b/functions/setters/toy/assignToy.js @@ -6,6 +6,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds or modifies a toy on the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The person wearing the toy * - (user id) keyholder - The person putting the toy on the user * - (integer) intensity - The strength of the toy @@ -16,22 +17,22 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * --- * ###### Needs cleanup and review on the origbinder param **********/ -function assignToy (user, keyholder, intensity, toytype = "vibe_bullet", origbinder) { +function assignToy(serverID, user, keyholder, intensity, toytype = "vibe_bullet", origbinder) { traceFirstParam(arguments[0]); let vibe = process.toytypes[toytype]; if (!vibe) { return "NoToy" } - if ((getOption(user, "arousalsystem") == 0) && (vibe.isArousing())) { + if ((getOption(serverID, user, "arousalsystem") == 0) && (vibe.isArousing())) { return "NoArousal"; // Do not add a toy that can increase arousal, thats bad. } if (process.toys == undefined) { process.toys = {} } - if (process.toys[user] == undefined) { process.toys[user] = [] } - let toy = process.toys[user].find((toy) => toy.type == toytype) - console.log(process.toys[user]) + if (process.toys[serverID] == undefined) { process.toys[serverID] = {} } + if (process.toys[serverID][user] == undefined) { process.toys[serverID][user] = [] } + let toy = process.toys[serverID][user].find((toy) => toy.type == toytype) // Toy already exists, modify it to the new intensity, if allowed. if (toy) { - if (vibe.canModify({ userID: user, keyholderID: keyholder ?? user })) { - if (vibe.blocker({ userID: user }) && getBaseChastity(vibe.blocker({ userID: user }).chastitytype)) { - getBaseChastity(vibe.blocker({ userID: user }).chastitytype).onToyChange({ userID: user, keyholderID: keyholder ?? user, currentToys: process.toys[user], newToy: { type: toytype, intensity: intensity, origbinder: origbinder }, action: "modify" }) + if (vibe.canModify({ serverID: serverID, userID: user, keyholderID: keyholder ?? user })) { + if (vibe.blocker({ serverID: serverID, userID: user }) && getBaseChastity(vibe.blocker({ serverID: serverID, userID: user }).chastitytype)) { + getBaseChastity(vibe.blocker({ serverID: serverID, userID: user }).chastitytype).onToyChange({ serverID: serverID, userID: user, keyholderID: keyholder ?? user, currentToys: process.toys[serverID][user], newToy: { type: toytype, intensity: intensity, origbinder: origbinder }, action: "modify" }) } toy.intensity = intensity markForSave("toys"); @@ -43,16 +44,16 @@ function assignToy (user, keyholder, intensity, toytype = "vibe_bullet", origbin } // Toy does not exist, add it! else { - if (vibe.canEquip({ userID: user, keyholderID: keyholder ?? user })) { - if (vibe.blocker({ userID: user }) && getBaseChastity(vibe.blocker({ userID: user }).chastitytype)) { - getBaseChastity(vibe.blocker({ userID: user }).chastitytype).onToyChange({ userID: user, keyholderID: keyholder ?? user, currentToys: process.toys[user], newToy: { type: toytype, intensity: intensity, origbinder: origbinder }, action: "add" }) + if (vibe.canEquip({ serverID: serverID, userID: user, keyholderID: keyholder ?? user })) { + if (vibe.blocker({ serverID: serverID, userID: user }) && getBaseChastity(vibe.blocker({ serverID: serverID, userID: user }).chastitytype)) { + getBaseChastity(vibe.blocker({ serverID: serverID, userID: user }).chastitytype).onToyChange({ serverID: serverID, userID: user, keyholderID: keyholder ?? user, currentToys: process.toys[serverID][user], newToy: { type: toytype, intensity: intensity, origbinder: origbinder }, action: "add" }) } - process.toys[user].push({ + process.toys[serverID][user].push({ type: toytype, intensity: intensity, origbinder: origbinder }) - vibe.onEquip({ userID: user, intensity: intensity }) + vibe.onEquip({ serverID: serverID, userID: user, intensity: intensity }) markForSave("toys"); return "Success" } diff --git a/functions/setters/toy/removeToy.js b/functions/setters/toy/removeToy.js index 06d57b1a..24935d7e 100644 --- a/functions/setters/toy/removeToy.js +++ b/functions/setters/toy/removeToy.js @@ -5,6 +5,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a toy from the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The person wearing the toy * - (user id) keyholder - The person removing the toy * - (string) toytype - The toy ID to remove @@ -12,22 +13,23 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * --- * ##### *No return value* **********/ -function removeToy(user, keyholder, toytype, force = false) { +function removeToy(serverID, user, keyholder, toytype, force = false) { traceFirstParam(arguments[0]); if (process.toys == undefined) { process.toys = {} } - if (process.toys[user] == undefined) { process.toys[user] = [] } - let index = process.toys[user].findIndex((toy) => toy.type == toytype) + if (process.toys[serverID] == undefined) { process.toys[serverID] = {} } + if (process.toys[serverID][user] == undefined) { process.toys[serverID][user] = [] } + let index = process.toys[serverID][user].findIndex((toy) => toy.type == toytype) if (index > -1) { let vibe = process.toytypes[toytype]; - if (vibe && vibe.blocker({ userID: user }) && getBaseChastity(vibe.blocker({ userID: user }).chastitytype)) { - getBaseChastity(vibe.blocker({ userID: user }).chastitytype).onToyChange({ userID: user, keyholderID: keyholder ?? user, currentToys: process.toys[user], newToy: { type: toytype, intensity: vibe.intensity, origbinder: vibe.origbinder }, action: "remove"}) + if (vibe && vibe.blocker({ serverID: serverID, userID: user }) && getBaseChastity(vibe.blocker({ serverID: serverID, userID: user }).chastitytype)) { + getBaseChastity(vibe.blocker({ serverID: serverID, userID: user }).chastitytype).onToyChange({ serverID: serverID, userID: user, keyholderID: keyholder ?? user, currentToys: process.toys[serverID][user], newToy: { type: toytype, intensity: vibe.intensity, origbinder: vibe.origbinder }, action: "remove"}) } if (vibe && vibe.onUnequip) { - vibe.onUnequip({ userID: user }); + vibe.onUnequip({ serverID: serverID, userID: user }); } - process.toys[user].splice(index, 1); + process.toys[serverID][user].splice(index, 1); } - if (force) { delete process.toys[user] } + if (force) { delete process.toys[serverID][user] } markForSave("toys"); } diff --git a/functions/setters/wearable/addLockedWearable.js b/functions/setters/wearable/addLockedWearable.js index ee4106df..a8623f30 100644 --- a/functions/setters/wearable/addLockedWearable.js +++ b/functions/setters/wearable/addLockedWearable.js @@ -4,21 +4,25 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Adds a locked clothing item on the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The person wearing the clothing * - (string) wearable - Wearable item ID * --- * ##### *No return value* **********/ -function addLockedWearable(userID, wearable) { +function addLockedWearable(serverID, userID, wearable) { traceFirstParam(arguments[0]); if (process.wearable == undefined) { process.wearable = {}; } - if (process.wearable[userID]) { - if (process.wearable[userID].locked == undefined) { - process.wearable[userID].locked = [wearable]; + if (process.wearable[serverID] == undefined) { + process.wearable[serverID] = {}; + } + if (process.wearable[serverID][userID]) { + if (process.wearable[serverID][userID].locked == undefined) { + process.wearable[serverID][userID].locked = [wearable]; } else { - process.wearable[userID].locked.push(wearable); + process.wearable[serverID][userID].locked.push(wearable); } } markForSave("wearable"); diff --git a/functions/setters/wearable/assignWearable.js b/functions/setters/wearable/assignWearable.js index 5bd1b461..9925f702 100644 --- a/functions/setters/wearable/assignWearable.js +++ b/functions/setters/wearable/assignWearable.js @@ -4,20 +4,24 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /************** * Adds a wearable clothing item to a user. * + * - (server id) serverID - The server this is running on * - (user id) user - The user to wear the clothing * - (string) wearable - The specific wearable type * --- * ##### *No return value* **************/ -function assignWearable(user, wearable) { +function assignWearable(serverID, user, wearable) { traceFirstParam(arguments[0]); if (process.wearable == undefined) { process.wearable = {}; } - if (process.wearable[user]) { - process.wearable[user].wornwearable.push(wearable); + if (process.wearable[serverID] == undefined) { + process.wearable[serverID] = {}; + } + if (process.wearable[serverID][user]) { + process.wearable[serverID][user].wornwearable.push(wearable); } else { - process.wearable[user] = { wornwearable: [wearable] }; + process.wearable[serverID][user] = { wornwearable: [wearable] }; } markForSave("wearable"); }; diff --git a/functions/setters/wearable/removeLockedWearable.js b/functions/setters/wearable/removeLockedWearable.js index e2601921..4c23e3b4 100644 --- a/functions/setters/wearable/removeLockedWearable.js +++ b/functions/setters/wearable/removeLockedWearable.js @@ -4,25 +4,29 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a locked clothing item from the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The person wearing the clothing * - (string) wearable - Headwear item ID * --- * ##### *No return value* **********/ -function removeLockedWearable(userID, wearable) { +function removeLockedWearable(serverID, userID, wearable) { traceFirstParam(arguments[0]); if (process.wearable == undefined) { process.wearable = {}; } - if (process.wearable[userID]) { - if (process.wearable[userID].locked == undefined) { + if (process.wearable[serverID] == undefined) { + process.wearable[serverID] = {}; + } + if (process.wearable[serverID][userID]) { + if (process.wearable[serverID][userID].locked == undefined) { return; } else { - if (process.wearable[userID].locked.includes(wearable)) { - process.wearable[userID].locked.splice(process.wearable[userID].locked.indexOf(wearable), 1); + if (process.wearable[serverID][userID].locked.includes(wearable)) { + process.wearable[serverID][userID].locked.splice(process.wearable[serverID][userID].locked.indexOf(wearable), 1); } - if (process.wearable[userID].locked.length == 0) { - delete process.wearable[userID].locked; + if (process.wearable[serverID][userID].locked.length == 0) { + delete process.wearable[serverID][userID].locked; } } } diff --git a/functions/setters/wearable/removeWearable.js b/functions/setters/wearable/removeWearable.js index 229edbb5..6bd897f6 100644 --- a/functions/setters/wearable/removeWearable.js +++ b/functions/setters/wearable/removeWearable.js @@ -5,35 +5,39 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); /********** * Removes a clothing from the user. * + * - (server id) serverID - The server this is running on * - (user id) userID - The person wearing the clothing * - (string) wearable - The type of clothing to remove * --- * ##### *No return value* **********/ -function deleteWearable(userID, wearable) { +function deleteWearable(serverID, userID, wearable) { traceFirstParam(arguments[0]); if (process.wearable == undefined) { process.wearable = {}; } - if (!process.wearable[userID]) { + if (process.wearable[serverID] == undefined) { + process.wearable[serverID] = {}; + } + if (!process.wearable[serverID][userID]) { return false; } - if (wearable && process.wearable[userID].wornwearable.includes(wearable) && !getLockedWearable(userID).includes(wearable)) { - process.wearable[userID].wornwearable.splice(process.wearable[userID].wornwearable.indexOf(wearable), 1); - if (process.wearable[userID].wornwearable.length == 0) { - delete process.wearable[userID]; + if (wearable && process.wearable[serverID][userID].wornwearable.includes(wearable) && !getLockedWearable(serverID, userID).includes(wearable)) { + process.wearable[serverID][userID].wornwearable.splice(process.wearable[serverID][userID].wornwearable.indexOf(wearable), 1); + if (process.wearable[serverID][userID].wornwearable.length == 0) { + delete process.wearable[serverID][userID]; } - } else if (process.wearable[userID]) { - let locks = getLockedWearable(userID); + } else if (process.wearable[serverID][userID]) { + let locks = getLockedWearable(serverID, userID); let savedheadgear = []; - process.wearable[userID].wornwearable.forEach((g) => { + process.wearable[serverID][userID].wornwearable.forEach((g) => { if (locks.includes(g)) { savedheadgear.push(g); } }); - process.wearable[userID].wornwearable = savedheadgear; - if (process.wearable[userID].wornwearable.length == 0) { - delete process.wearable[userID]; + process.wearable[serverID][userID].wornwearable = savedheadgear; + if (process.wearable[serverID][userID].wornwearable.length == 0) { + delete process.wearable[serverID][userID]; } } markForSave("wearable"); From 4ae45edce4d76f641f3032c3547f7698b1386281 Mon Sep 17 00:00:00 2001 From: Enraa Date: Fri, 19 Jun 2026 01:37:55 -0700 Subject: [PATCH 15/44] a --- functions/collarfunctions.js | 72 +++++++++++++++++++----------------- functions/configfunctions.js | 43 ++++++++------------- 2 files changed, 54 insertions(+), 61 deletions(-) diff --git a/functions/collarfunctions.js b/functions/collarfunctions.js index 7f094a30..ca5bcc88 100644 --- a/functions/collarfunctions.js +++ b/functions/collarfunctions.js @@ -1,3 +1,4 @@ +import { Poll } from 'discord.js'; const fs = require("fs"); const path = require("path"); const https = require("https"); @@ -46,51 +47,56 @@ function loadCollarTypes() { } // Called to prompt the wearer if it is okay to clone a key. -async function promptCloneCollarKey(user, target, clonekeyholder) { +async function promptCloneCollarKey(serverID, user, target, clonekeyholder) { traceFirstParam(arguments[0]); return new Promise(async (res, rej) => { - let buttons = [new ButtonBuilder().setCustomId("denyButton").setLabel("Deny").setStyle(ButtonStyle.Danger), new ButtonBuilder().setCustomId("acceptButton").setLabel("Allow").setStyle(ButtonStyle.Success)]; - let bondageaccess = `${getCollarPerm(target.id, "mitten") ? "mitten you, " : ""}${getCollarPerm(target.id, "chastity") ? "put you in chastity, " : ""}${getCollarPerm(target.id, "chastity") ? "put heavy bondage on you, " : ""}`.slice(0, -2); - let dmchannel = await target.createDM(); - await dmchannel.send({ content: `${user} would like to give ${clonekeyholder} a copy of your collar key. Do you want to allow this?${bondageaccess.length > 0 ? `\n\n**Note: ${clonekeyholder} will have access to ${bondageaccess}.**` : ""}`, components: [new ActionRowBuilder().addComponents(...buttons)] }).then((mess) => { - // Create a collector for up to 5 minutes - const collector = mess.createMessageComponentCollector({ componentType: ComponentType.Button, time: 300_000, max: 1 }); + try { + let buttons = [new ButtonBuilder().setCustomId("denyButton").setLabel("Deny").setStyle(ButtonStyle.Danger), new ButtonBuilder().setCustomId("acceptButton").setLabel("Allow").setStyle(ButtonStyle.Success)]; + let bondageaccess = `${getCollarPerm(serverID, target.id, "mitten") ? "mitten you, " : ""}${getCollarPerm(serverID, target.id, "chastity") ? "put you in chastity, " : ""}${getCollarPerm(serverID, target.id, "chastity") ? "put heavy bondage on you, " : ""}${getCollarPerm(serverID, target.id, "mask") ? "put headgear on you, " : ""}`.slice(0, -2); + let dmchannel = await target.createDM(); + await dmchannel.send({ content: `${user} would like to give ${clonekeyholder} a copy of your collar key. Do you want to allow this?${bondageaccess.length > 0 ? `\n\n**Note: ${clonekeyholder} will have access to ${bondageaccess}.**` : ""}`, components: [new ActionRowBuilder().addComponents(...buttons)] }).then((mess) => { + // Create a collector for up to 5 minutes + const collector = mess.createMessageComponentCollector({ componentType: ComponentType.Button, time: 300_000, max: 1 }); - collector.on("collect", async (i) => { - console.log(i); - if (i.customId == "acceptButton") { - await mess.delete().then(() => { - i.reply(`Confirmed - ${clonekeyholder} will receive a copied key for your collar!`); - }); - res(true); - } else { - await mess.delete().then(() => { - i.reply(`Rejected - ${clonekeyholder} will NOT receive a copied key for your collar!`); - }); - rej(true); - } - }); + collector.on("collect", async (i) => { + console.log(i); + if (i.customId == "acceptButton") { + await mess.delete().then(() => { + i.reply(`Confirmed - ${clonekeyholder} will receive a copied key for your collar!`); + }); + res(true); + } else { + await mess.delete().then(() => { + i.reply(`Rejected - ${clonekeyholder} will NOT receive a copied key for your collar!`); + }); + rej(true); + } + }); - collector.on("end", async (collected) => { - // timed out - if (collected.length == 0) { - await mess.delete().then(() => { - i.reply(`Timed Out - ${clonekeyholder} will NOT receive a copied key for your collar!`); - }); - rej(true); - } - }); - }); + collector.on("end", async (collected) => { + // timed out + if (collected.length == 0) { + await mess.delete().then(() => { + i.reply(`Timed Out - ${clonekeyholder} will NOT receive a copied key for your collar!`); + }); + rej(true); + } + }); + }); + } + catch (err) { + console.log(err); + } }); } // Called to prompt the wearer if it is okay to give a key. -async function promptTransferCollarKey(user, target, newKeyholder) { +async function promptTransferCollarKey(serverID, user, target, newKeyholder) { traceFirstParam(arguments[0]); return new Promise(async (res, rej) => { try { let buttons = [new ButtonBuilder().setCustomId("denyButton").setLabel("Deny").setStyle(ButtonStyle.Danger), new ButtonBuilder().setCustomId("acceptButton").setLabel("Allow").setStyle(ButtonStyle.Success)]; - let bondageaccess = `${getCollarPerm(target.id, "mitten") ? "mitten you, " : ""}${getCollarPerm(target.id, "chastity") ? "put you in chastity, " : ""}${getCollarPerm(target.id, "chastity") ? "put heavy bondage on you, " : ""}`.slice(0, -2); + let bondageaccess = `${getCollarPerm(serverID, target.id, "mitten") ? "mitten you, " : ""}${getCollarPerm(serverID, target.id, "chastity") ? "put you in chastity, " : ""}${getCollarPerm(serverID, target.id, "chastity") ? "put heavy bondage on you, " : ""}${getCollarPerm(serverID, target.id, "mask") ? "put headgear on you, " : ""}`.slice(0, -2); let dmchannel = await target.createDM(); await dmchannel.send({ content: `${user} would like to give ${newKeyholder} your collar key. Do you want to allow this?${bondageaccess.length > 0 ? `\n\n**Note: ${newKeyholder} will have access to ${bondageaccess}.**` : ""}`, components: [new ActionRowBuilder().addComponents(...buttons)] }).then((mess) => { // Create a collector for up to 5 minutes diff --git a/functions/configfunctions.js b/functions/configfunctions.js index 1b1cb85b..d553e37d 100644 --- a/functions/configfunctions.js +++ b/functions/configfunctions.js @@ -27,31 +27,18 @@ function generateConfigModal(interaction, menuset = "General", page, statustext) keys.forEach(async (k) => { if (configoptions[menuset][k].menutype == "choice") { let buttonsection = new SectionBuilder() - .addTextDisplayComponents((textdisplay) => textdisplay.setContent(`## ${configoptions[menuset][k].name}\n${configoptions[menuset][k].desc}\n-# ā€Ž ⤷ ${configoptions[menuset][k].choices.find((f) => f.value == getOption(interaction.user.id, k))?.helptext}`)) + .addTextDisplayComponents((textdisplay) => textdisplay.setContent(`## ${configoptions[menuset][k].name}\n${configoptions[menuset][k].desc}\n-# ā€Ž ⤷ ${configoptions[menuset][k].choices.find((f) => f.value == getOption(interaction.guildId, interaction.user.id, k))?.helptext}`)) .setButtonAccessory((button) => button .setCustomId(`config_pageopt_${menuset}_${page}_${k}`) - .setLabel(configoptions[menuset][k].choices.find((f) => f.value == getOption(interaction.user.id, k))?.name ?? "Undefined") - .setStyle(configoptions[menuset][k].choices.find((f) => f.value == getOption(interaction.user.id, k))?.style ?? ButtonStyle.Danger) - .setDisabled(configoptions[menuset][k].disabled(interaction.user.id)), + .setLabel(configoptions[menuset][k].choices.find((f) => f.value == getOption(interaction.guildId, interaction.user.id, k))?.name ?? "Undefined") + .setStyle(configoptions[menuset][k].choices.find((f) => f.value == getOption(interaction.guildId, interaction.user.id, k))?.style ?? ButtonStyle.Danger) + .setDisabled(configoptions[menuset][k].disabled(interaction.guildId, interaction.user.id)), ); pagecomponents.push(buttonsection); } else if (configoptions[menuset][k].menutype == "choice_textentry") { - /*else if (configoptions[menuset][k].menutype == "choice_extreme") { - let buttonsection = new SectionBuilder() - .addTextDisplayComponents( - (textdisplay) => textdisplay.setContent(`## ${configoptions[menuset][k].name}\n${configoptions[menuset][k].desc}\n-# ā€Ž ⤷ ${configoptions[menuset][k].choices.find((f) => f.value == getOption(interaction.user.id,k))?.helptext}`) - ) - .setButtonAccessory((button) => - button.setCustomId(`config_pageopt_${menuset}_${k}`) - .setLabel(configoptions[menuset][k].choices.find((f) => f.value == getOption(interaction.user.id,k))?.name ?? "Undefined") - .setStyle(configoptions[menuset][k].choices.find((f) => f.value == getOption(interaction.user.id,k))?.style ?? ButtonStyle.Danger) - .setDisabled(configoptions[menuset][k].disabled(interaction.user.id)) - ) - pagecomponents.push(buttonsection) - }*/ - let helpertext = `${configoptions[menuset][k].choices[0].helptext}${configoptions[menuset][k].textvaluedisplay(getOption(interaction.user.id, k))}`; - if (getOption(interaction.user.id, k) == undefined) { + let helpertext = `${configoptions[menuset][k].choices[0].helptext}${configoptions[menuset][k].textvaluedisplay(getOption(interaction.guildId, interaction.user.id, k))}`; + if (getOption(interaction.guildId, interaction.user.id, k) == undefined) { helpertext = `${configoptions[menuset][k].choices[0].helptextnone}`; } let buttonsection = new SectionBuilder() @@ -61,16 +48,16 @@ function generateConfigModal(interaction, menuset = "General", page, statustext) .setCustomId(`config_tentrypageopt_${menuset}_${k}_${page}`) .setLabel(configoptions[menuset][k].choices[0].name ?? "Undefined") .setStyle(configoptions[menuset][k].choices[0].style ?? ButtonStyle.Danger) - .setDisabled(configoptions[menuset][k].disabled(interaction.user.id)), + .setDisabled(configoptions[menuset][k].disabled(interaction.guildId, interaction.user.id)), ); pagecomponents.push(buttonsection); } else if (configoptions[menuset][k].menutype == "choice_userentry") { - let userarr = getOption(interaction.user.id, k) ?? []; + let userarr = getOption(interaction.guildId, interaction.user.id, k) ?? []; let helpertext = `No Users` if (userarr.length > 0) { helpertext = `${userarr.map((u) => `<@${u}>`).join(", ")}`; } - if (getOption(interaction.user.id, k) == undefined) { + if (getOption(interaction.guildId, interaction.user.id, k) == undefined) { helpertext = `${configoptions[menuset][k].choices[0].helptextnone}`; } let buttonsection = new SectionBuilder() @@ -80,19 +67,19 @@ function generateConfigModal(interaction, menuset = "General", page, statustext) .setCustomId(`config_uentrypageopt_${menuset}_${k}_${page}`) .setLabel(configoptions[menuset][k].choices[0].name ?? "Undefined") .setStyle(configoptions[menuset][k].choices[0].style ?? ButtonStyle.Danger) - .setDisabled(configoptions[menuset][k].disabled(interaction.user.id)), + .setDisabled(configoptions[menuset][k].disabled(interaction.guildId, interaction.user.id)), ); pagecomponents.push(buttonsection); } if (configoptions[menuset][k].menutype == "choice_dollcolor") { let buttonsection = new SectionBuilder() - .addTextDisplayComponents((textdisplay) => textdisplay.setContent(`## ${configoptions[menuset][k].name}\n${configoptions[menuset][k].desc}\`\`\`ansi\n[1;${getOption(interaction.user.id, k)}m${getOption(interaction.user.id, "dollvisorname")}: It is speaking.\`\`\``)) + .addTextDisplayComponents((textdisplay) => textdisplay.setContent(`## ${configoptions[menuset][k].name}\n${configoptions[menuset][k].desc}\`\`\`ansi\n[1;${getOption(interaction.guildId, interaction.user.id, k)}m${getOption(interaction.guildId, interaction.user.id, "dollvisorname")}: It is speaking.\`\`\``)) .setButtonAccessory((button) => button .setCustomId(`config_pageopt_${menuset}_${page}_${k}`) - .setLabel(configoptions[menuset][k].choices.find((f) => f.value == getOption(interaction.user.id, k))?.name ?? "Undefined") - .setStyle(configoptions[menuset][k].choices.find((f) => f.value == getOption(interaction.user.id, k))?.style ?? ButtonStyle.Danger) - .setDisabled(configoptions[menuset][k].disabled(interaction.user.id)), + .setLabel(configoptions[menuset][k].choices.find((f) => f.value == getOption(interaction.guildId, interaction.user.id, k))?.name ?? "Undefined") + .setStyle(configoptions[menuset][k].choices.find((f) => f.value == getOption(interaction.guildId, interaction.user.id, k))?.style ?? ButtonStyle.Danger) + .setDisabled(configoptions[menuset][k].disabled(interaction.guildId, interaction.user.id)), ); pagecomponents.push(buttonsection); } else if (configoptions[menuset][k].menutype == "choice_server_refreshcmd") { @@ -264,7 +251,7 @@ function generateConfigModal(interaction, menuset = "General", page, statustext) Object.keys(configoptions).forEach((k) => { if ((k != "Server") && (k != "Bot")) { if (k == "Pishock Config") { - if ((getOption(interaction.user.id, "shockermodel") == "pishock")) { + if ((getOption(interaction.guildId, interaction.user.id, "shockermodel") == "pishock")) { let opt = new StringSelectMenuOptionBuilder().setLabel(k).setValue(`menuopt_${k}`); menupageoptionsarr.push(opt); } From 8c360b0913d9e5fd4b720d13f3daea04da283944 Mon Sep 17 00:00:00 2001 From: Enraa Date: Fri, 19 Jun 2026 17:27:31 -0700 Subject: [PATCH 16/44] Update corsetfunctions.js --- functions/corsetfunctions.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/functions/corsetfunctions.js b/functions/corsetfunctions.js index f53c31a7..23f3b869 100644 --- a/functions/corsetfunctions.js +++ b/functions/corsetfunctions.js @@ -143,7 +143,7 @@ function corsetLimitWords(text, parent, user, msgModified, serverID) { // Bad bottom for shouting! Corsets should make you SILENT. Double all breath used. let globalMultiplier = scriptLevel > 0 ? 2 : 1; - const corset = calcBreath(user); + const corset = calcBreath(serverID, user); const basecorset = getBaseCorset(corset.type); // Tightlaced bottoms must only whisper @@ -234,7 +234,7 @@ function corsetLimitWords(text, parent, user, msgModified, serverID) { } } - basecorset.afterUsingBreath({ userID: user, corset: corset }); + basecorset.afterUsingBreath({ serverID: serverID, userID: user, corset: corset }); let outtext = (silence ? chars.slice(0, silenceIdx + 1) : chars).join(""); @@ -254,21 +254,22 @@ function corsetLimitWords(text, parent, user, msgModified, serverID) { // calculates current breath and returns corset. Does not save to file. (server id, user id) function calcBreath(serverID, user) { traceFirstParam(arguments[0]); - const corset = getCorset(user); + const corset = getCorset(serverID, user); const basecorset = getBaseCorset(corset.type); if (!corset) return null; if (corset.breath < basecorset.getMinBreath({ tightness: corset.tightness })) corset.breath = basecorset.getMinBreath({ tightness: corset.tightness }); const now = Date.now(); let recoveryCoefficient = 1; if (process.gags == undefined) process.gags = {}; - if (process.gags[user] && process.gags[user].length > 0) { - process.gags[user].forEach((g) => { + if (process.gags[serverID] == undefined) process.gags[serverID] = {}; + if (process.gags[serverID][user] && process.gags[serverID][user].length > 0) { + process.gags[serverID][user].forEach((g) => { if (process.gagtypes && process.gagtypes[g.gagtype]?.breathRecovery) { recoveryCoefficient *= process.gagtypes[g.gagtype]?.breathRecovery(user, g.intensity ?? 5) } }) } - let userheadwear = getHeadwear(user); + let userheadwear = getHeadwear(serverID, user); if (userheadwear.includes("gasmask") || userheadwear.includes("gasmasklinked") || userheadwear.includes("gasmask_hornygas") || userheadwear.includes("gasmask_truthgas")) { // It is harder to breathe in a gasmask or share air recoveryCoefficient = recoveryCoefficient * 0.7 @@ -290,7 +291,7 @@ function tryExpendBreath(serverID, user, exertion) { const corset = calcBreath(serverID, user); const basecorset = getBaseCorset(corset.type ?? "corset_leather"); corset.breath -= exertion; - basecorset.afterUsingBreath({ userID: user, corset: corset }); + basecorset.afterUsingBreath({ serverID: serverID, userID: user, corset: corset }); markForSave("corset"); return corset.breath > 0; } From 3e2067c8701076b921eda65901ad3f6327dcf89a Mon Sep 17 00:00:00 2001 From: Enraa Date: Fri, 19 Jun 2026 19:42:43 -0700 Subject: [PATCH 17/44] Wailing your sorrow is only my way --- functions/delvefunctions.js | 239 +++++++++--------- functions/dollfunctions.js | 36 +-- .../chastity/getChastityBraTempTimelock.js | 12 +- .../chastity/getChastityTempTimelock.js | 11 +- .../getters/collar/getCollarTempTimelock.js | 11 +- 5 files changed, 161 insertions(+), 148 deletions(-) diff --git a/functions/delvefunctions.js b/functions/delvefunctions.js index c456ec6b..830d55f4 100644 --- a/functions/delvefunctions.js +++ b/functions/delvefunctions.js @@ -19,6 +19,7 @@ const { modifyResolve } = require("./setters/delve/setResolve") const { getDelveFloorState } = require("./getters/delve/getDelveFloorState") const { markForSave } = require("./other/markForSave") const { traceFirstParam } = require("./other/TESTS/traceFirstParam") +const { setNextDelveRoom } = require("../functions/setters/delve/setNextDelveRoom"); /***************** * Players will utilize their condition as returned by gags, masks, heavy bondage and the like. @@ -80,10 +81,10 @@ const delveroomchoices = { hintdesc: "BUG", shortdesc: "An ornate door stands in front of you, an entrance to an underground crypt and it's lined with images of restraints.", longdesc: "You arrive at the entrance of the Deepbound Palace. It's smooth wall is decorated by images of people wearing restraints and a mural above the door depicting several kneeling submissives around a woman sitting in a chair. She is clad with what you recognize to be a black minidress in the image. The door handle is unremarkable, but it reminds you of a handle for a flogger.", - extradesc: (userID, text, delvedata, resolve) => { return text }, + extradesc: (serverID, userID, text, delvedata, resolve) => { return text }, revisitshortdesc: "You step back out of the bondage crypt and into the sunlight.", revisitlongdesc: "You're standing just inside the entrance to the bondage crypt. The pitter patter of the rain can be heard outside, along with the hint of light from the entrance of the Deepbound Palace. The sounds of the outdoor world are already so far away, so you might as well head back inside!", - revisitextradesc: (userID, text, delvedata, resolve) => { return text }, + revisitextradesc: (serverID, userID, text, delvedata, resolve) => { return text }, choices: [ { name: "Proceed Into the Dungeon", @@ -92,13 +93,13 @@ const delveroomchoices = { shortoutcome_failure: "Undeterred by the obvious glitches in reality, you proceed. (Failure path, report)", longoutcome_failure: "Despite your senses telling you everything is wrong, you still continue forth. A sickening thought in the back of your head worries that this particular iteration of the Deepbound Palace may be cursed, but that is a problem for the developers of this place to sort out later. (Failure path, report)", statweight: {}, - statspecial: (userID, delvedata, resolve) => { return delvedata.stats }, - successfunction: (userID, delvedata, resolve) => { return true }, - failurefunction: (userID, delvedata, resolve) => { return true } + statspecial: (serverID, userID, delvedata, resolve) => { return delvedata.stats }, + successfunction: (serverID, userID, delvedata, resolve) => { return true }, + failurefunction: (serverID, userID, delvedata, resolve) => { return true } } ], weight: 0, - weightspecial: (userID, weight) => { return weight }, + weightspecial: (serverID, userID, weight) => { return weight }, weightforce: () => { return 0 }, accentcolor: 0xFFFFFF }, @@ -108,10 +109,10 @@ const delveroomchoices = { hintdesc: "Bright Pink Glitchy Room BUG", shortdesc: "You encounter a room full of pink squares and exclamation marks. You shouldn't be here. (Bug, report!)", longdesc: "Gone is the dungeon aesthetic, replaced by a room full of odd looking pink squares over where objects on a table in the center of the room would be. The room is completely silent, even devoid of the sounds of your own breathing. You get the irking feeling that you really should not be here. (This is a bug, please report!)", - extradesc: (userID, text, delvedata, resolve) => { return text }, + extradesc: (serverID, userID, text, delvedata, resolve) => { return text }, revisitshortdesc: "You return to the pink square room. It remains in it's dormant state and it's still unsettling.", revisitlongdesc: "You return to the pink square room that definitely does not belong in the Deepbound Palace. You can't detect even a hint of life or anything within these walls.", - revisitextradesc: (userID, text, delvedata, resolve) => { return text }, + revisitextradesc: (serverID, userID, text, delvedata, resolve) => { return text }, choices: [ { name: "Proceed Onwards", @@ -120,13 +121,13 @@ const delveroomchoices = { shortoutcome_failure: "Undeterred by the obvious glitches in reality, you proceed. (Failure path, report)", longoutcome_failure: "Despite your senses telling you everything is wrong, you still continue forth. A sickening thought in the back of your head worries that this particular iteration of the Deepbound Palace may be cursed, but that is a problem for the developers of this place to sort out later. (Failure path, report)", statweight: {}, - statspecial: (userID, delvedata, resolve) => { return delvedata.stats }, - successfunction: (userID, delvedata, resolve) => { return true }, - failurefunction: (userID, delvedata, resolve) => { return true } + statspecial: (serverID, userID, delvedata, resolve) => { return delvedata.stats }, + successfunction: (serverID, userID, delvedata, resolve) => { return true }, + failurefunction: (serverID, userID, delvedata, resolve) => { return true } } ], weight: 0, - weightspecial: (userID, weight) => { return weight }, + weightspecial: (serverID, userID, weight) => { return weight }, weightforce: () => { return 0 }, accentcolor: 0xFF4444 }, @@ -135,10 +136,10 @@ const delveroomchoices = { hintdesc: "Echoing Corridor", shortdesc: "You encounter a long, empty hallway devoid of obstacles or inhabitants.", longdesc: "You turn a corner and encounter a long hallway, stretching so far back that the end of it is swallowed by the inky black void of darkness. The floor is plain and sturdy, while the walls textured only by the carved rock of the dungeon. Nothing is out of place and you can proeed without worry. ", - extradesc: (userID, text, delvedata, resolve) => { return text }, + extradesc: (serverID, userID, text, delvedata, resolve) => { return text }, revisitshortdesc: "You return to the long, empty corridor.", revisitlongdesc: "You step back into the long, empty corridor. No inhabitants nor obstacles have shown up since the last time you were here. It still seems to stretch into a void infinity over the plain floor and carved rock walls.", - revisitextradesc: (userID, text, delvedata, resolve) => { return text }, + revisitextradesc: (serverID, userID, text, delvedata, resolve) => { return text }, choices: [ { name: "Proceed Carefree", @@ -147,13 +148,13 @@ const delveroomchoices = { shortoutcome_failure: "This cannot fail. (This is a bug, please report!)", longoutcome_failure: "Despite a 100% success rate, you somehow failed. (This is a bug, please report!)", statweight: {}, - statspecial: (userID, delvedata, resolve) => { return delvedata.stats }, - successfunction: (userID, delvedata, resolve) => { return true }, - failurefunction: (userID, delvedata, resolve) => { return true } + statspecial: (serverID, userID, delvedata, resolve) => { return delvedata.stats }, + successfunction: (serverID, userID, delvedata, resolve) => { return true }, + failurefunction: (serverID, userID, delvedata, resolve) => { return true } } ], weight: 10, - weightspecial: (userID, weight) => { return weight }, + weightspecial: (serverID, userID, weight) => { return weight }, weightforce: undefined, accentcolor: 0x0099ff }, @@ -162,11 +163,11 @@ const delveroomchoices = { hintdesc: "Simple Room with Chest", shortdesc: "You step into a room with nothing but a singular chest.", longdesc: "You open a door that leads into a room with nothing but a singular chest in the center. It lies on top of a raised stone step, facing you with a white light casting over it. It's as if you were intended to open it... if you dare. What could possibly go wrong?", - extradesc: (userID, text, delvedata, resolve) => { return text }, + extradesc: (serverID, userID, text, delvedata, resolve) => { return text }, revisitshortdesc: "You return to the room .", revisitlongdesc: "You return to the room with a light casting down upon the", - revisitextradesc: (userID, text, delvedata, resolve) => { - if (getDelveFloorState(userID, delvedata.floor).opened) { + revisitextradesc: (serverID, userID, text, delvedata, resolve) => { + if (getDelveFloorState(serverID, userID, delvedata.floor).opened) { return `${text} open chest. You've obtained your loot, so there's little reason for you to remain here!` } else { @@ -181,12 +182,12 @@ const delveroomchoices = { shortoutcome_failure: "This cannot fail. (This is a bug, please report!)", longoutcome_failure: "Despite a 100% success rate, you somehow failed. (This is a bug, please report!)", statweight: {}, - statspecial: (userID, delvedata, resolve) => { return delvedata.stats }, - successfunction: (userID, delvedata, resolve) => { + statspecial: (serverID, userID, delvedata, resolve) => { return delvedata.stats }, + successfunction: (serverID, userID, delvedata, resolve) => { delvedata.extratext = "You obtain some loot!" return true }, - failurefunction: (userID, delvedata, resolve) => { return true } + failurefunction: (serverID, userID, delvedata, resolve) => { return true } }, { name: "Ignore it", @@ -195,13 +196,13 @@ const delveroomchoices = { shortoutcome_failure: "This cannot fail. (This is a bug, please report!)", longoutcome_failure: "Despite a 100% success rate, you somehow failed. (This is a bug, please report!)", statweight: {}, - statspecial: (userID, delvedata, resolve) => { return delvedata.stats }, - successfunction: (userID, delvedata, resolve) => { return true }, - failurefunction: (userID, delvedata, resolve) => { return true } + statspecial: (serverID, userID, delvedata, resolve) => { return delvedata.stats }, + successfunction: (serverID, userID, delvedata, resolve) => { return true }, + failurefunction: (serverID, userID, delvedata, resolve) => { return true } } ], weight: 4, - weightspecial: (userID, weight) => { return weight }, + weightspecial: (serverID, userID, weight) => { return weight }, weightforce: undefined, accentcolor: 0x0099ff }, @@ -210,11 +211,11 @@ const delveroomchoices = { hintdesc: "Simple Room with Chest", shortdesc: "You step into a room with nothing but a singular chest.", longdesc: "You open a door that leads into a room with nothing but a singular chest in the center. It lies on top of a raised stone step, facing you with a white light casting over it. It's as if you were intended to open it... if you dare. What could possibly go wrong?", - extradesc: (userID, text, delvedata, resolve) => { return text }, + extradesc: (serverID, userID, text, delvedata, resolve) => { return text }, revisitshortdesc: "You return to the room .", revisitlongdesc: "You return to the room with a light casting down upon the", - revisitextradesc: (userID, text, delvedata, resolve) => { - if (getDelveFloorState(userID, delvedata.floor).opened) { + revisitextradesc: (serverID, userID, text, delvedata, resolve) => { + if (getDelveFloorState(serverID, userID, delvedata.floor).opened) { return `${text} vestige of the toothy mimic. You shudder remembering what it did to you...` } else { @@ -229,7 +230,7 @@ const delveroomchoices = { shortoutcome_failure: "This cannot fail. (This is a bug, please report!)", longoutcome_failure: "Despite a 100% success rate, you somehow failed. (This is a bug, please report!)", statweight: {}, - statspecial: (userID, delvedata, resolve) => { return delvedata.stats }, + statspecial: (serverID, userID, delvedata, resolve) => { return delvedata.stats }, successfunction: (serverID, userID, delvedata, resolve) => { let extratextt = "You take 3 damage!" // Decide on a restraint to equip on the player @@ -243,100 +244,100 @@ const delveroomchoices = { if (!getGag(serverID, userID, "tape")) { eligiblerestraints.push("tape") } - if (!getChastity(userID) && !getUserTags(userID).includes("chastity")) { + if (!getChastity(serverID, userID) && !getUserTags(serverID, userID).includes("chastity")) { eligiblerestraints.push("chastitybelt") - if (getUserTags(userID, true).includes("chastity")) { + if (getUserTags(serverID, userID, true).includes("chastity")) { // Add two more because it's preferred. eligiblerestraints.push("chastitybelt") eligiblerestraints.push("chastitybelt") } } - if (!getChastityBra(userID) && !getUserTags(userID).includes("chastity")) { + if (!getChastityBra(serverID, userID) && !getUserTags(serverID, userID).includes("chastity")) { eligiblerestraints.push("chastitybra") - if (getUserTags(userID, true).includes("chastity")) { + if (getUserTags(serverID, userID, true).includes("chastity")) { // Add two more because it's preferred. eligiblerestraints.push("chastitybra") eligiblerestraints.push("chastitybra") } } - if (!getHeavy(userID, "armbinder_latex") && !getUserTags(userID).includes("latex")) { + if (!getHeavy(serverID, userID, "armbinder_latex") && !getUserTags(serverID, userID).includes("latex")) { eligiblerestraints.push("armbinderlatex") - if (getUserTags(userID, true).includes("latex")) { + if (getUserTags(serverID, userID, true).includes("latex")) { // Add two more because it's preferred. eligiblerestraints.push("armbinderlatex") eligiblerestraints.push("armbinderlatex") } } - if (!getHeavy(userID, "armbinder_leather") && !getUserTags(userID).includes("leather")) { + if (!getHeavy(serverID, userID, "armbinder_leather") && !getUserTags(serverID, userID).includes("leather")) { eligiblerestraints.push("armbinderleather") - if (getUserTags(userID, true).includes("leather")) { + if (getUserTags(serverID, userID, true).includes("leather")) { // Add two more because it's preferred. eligiblerestraints.push("armbinderleather") eligiblerestraints.push("armbinderleather") } } - if (!getMitten(userID) && !getUserTags(userID).includes("latex")) { + if (!getMitten(serverID, userID) && !getUserTags(serverID, userID).includes("latex")) { eligiblerestraints.push("mittenslatex") - if (getUserTags(userID, true).includes("latex")) { + if (getUserTags(serverID, userID, true).includes("latex")) { // Add two more because it's preferred. eligiblerestraints.push("mittenslatex") eligiblerestraints.push("mittenslatex") } } - if (!getMitten(userID)) { + if (!getMitten(serverID, userID)) { eligiblerestraints.push("mittenstape") } - if (!getMitten(userID)) { + if (!getMitten(serverID, userID)) { eligiblerestraints.push("mittensmaid") } if (eligiblerestraints.length > 0) { let choicerestraint = eligiblerestraints[Math.floor(Math.random() * eligiblerestraints.length)] if (choicerestraint == "ball") { - assignGag(userID, "ball", 5, userID); + assignGag(serverID, userID, "ball", 5, userID); extratextt = `${extratextt}\nThe Mimic equips a **Ball Gag** on you!` } if (choicerestraint == "stuff") { - assignGag(userID, "stuff", 5, userID); + assignGag(serverID, userID, "stuff", 5, userID); extratextt = `${extratextt}\nThe Mimic equips a **Stuff Gag** on you!` } if (choicerestraint == "tape") { - assignGag(userID, "tape", 5, userID); + assignGag(serverID, userID, "tape", 5, userID); extratextt = `${extratextt}\nThe Mimic equips a **Tape Gag** on you!` } if (choicerestraint == "chastitybelt") { - assignChastity(userID, userID, "belt_silver"); + assignChastity(serverID, userID, userID, "belt_silver"); extratextt = `${extratextt}\nThe Mimic equips a **Silver Chastity Belt** on you!` } if (choicerestraint == "chastitybra") { - assignChastityBra(userID, userID, "bra_silver"); + assignChastityBra(serverID, userID, userID, "bra_silver"); extratextt = `${extratextt}\nThe Mimic equips a **Silver Chastity Bra** on you!` } if (choicerestraint == "armbinderlatex") { - assignHeavy(userID, "armbinder_latex", userID); + assignHeavy(serverID, userID, "armbinder_latex", userID); extratextt = `${extratextt}\nThe Mimic equips a **Latex Armbinder** on you!` } if (choicerestraint == "armbinderleather") { - assignHeavy(userID, "armbinder_leather", userID); + assignHeavy(serverID, userID, "armbinder_leather", userID); extratextt = `${extratextt}\nThe Mimic equips a **Leather Armbinder** on you!` } if (choicerestraint == "mittenslatex") { - assignMitten(userID, "mittens_latex") + assignMitten(serverID, userID, "mittens_latex") extratextt = `${extratextt}\nThe Mimic equips a pair of **Latex Mittens** on you!` } if (choicerestraint == "mittenstape") { - assignMitten(userID, "mittens_tape") + assignMitten(serverID, userID, "mittens_tape") extratextt = `${extratextt}\nThe Mimic wraps your hands into **Taped Fists**!` } if (choicerestraint == "mittensmaid") { - assignMitten(userID, "mittens_maid") + assignMitten(serverID, userID, "mittens_maid") extratextt = `${extratextt}\nThe Mimic equips a pair of **Good Maid Mittens** on you!` } } delvedata.extratext = extratextt - modifyResolve(userID, -3); + modifyResolve(serverID, userID, -3); return true }, - failurefunction: (userID, delvedata, resolve) => { return true } + failurefunction: (serverID, userID, delvedata, resolve) => { return true } }, { name: "Ignore it", @@ -345,13 +346,13 @@ const delveroomchoices = { shortoutcome_failure: "This cannot fail. (This is a bug, please report!)", longoutcome_failure: "Despite a 100% success rate, you somehow failed. (This is a bug, please report!)", statweight: {}, - statspecial: (userID, delvedata, resolve) => { return delvedata.stats }, - successfunction: (userID, delvedata, resolve) => { return true }, - failurefunction: (userID, delvedata, resolve) => { return true } + statspecial: (serverID, userID, delvedata, resolve) => { return delvedata.stats }, + successfunction: (serverID, userID, delvedata, resolve) => { return true }, + failurefunction: (serverID, userID, delvedata, resolve) => { return true } } ], weight: 4, - weightspecial: (userID, weight) => { return weight }, + weightspecial: (serverID, userID, weight) => { return weight }, weightforce: undefined, accentcolor: 0x0099ff }, @@ -360,16 +361,16 @@ const delveroomchoices = { hintdesc: "Hazy Vineyard", shortdesc: "You find a room full of foliage including plants with pink flowers. The room gives off a faint pink haze.", longdesc: "You encounter a room full of vines, flowers and plants snaking around stone pillars. The vines look innocuous enough but the flowers are pink and in full bloom as the room gives off a distinctly pink haze. A small whiff makes you feel slightly woozy as you find yourself suddenly considering how you feel about the various bondage restraints you usually encounter in this place.", - extradesc: (userID, text, delvedata, resolve) => { - if (getHeadwear(userID).find((f) => getBaseHeadwear(f)?.tags?.includes("gasmask"))) { + extradesc: (serverID, userID, text, delvedata, resolve) => { + if (getHeadwear(serverID, userID).find((f) => getBaseHeadwear(f)?.tags?.includes("gasmask"))) { text = `${text}\n\nYou are wearing a gasmask, so maintaining a clear head in this place should be trivial.` } return text; }, revisitshortdesc: "You return to the room with the aphrodisiac spores.", revisitlongdesc: "You return to the room that houses the vines and aphrodisiac spores.", - revisitextradesc: (userID, text, delvedata, resolve) => { - if (getDelveFloorState(userID, delvedata.floor).burned) { + revisitextradesc: (serverID, userID, text, delvedata, resolve) => { + if (getDelveFloorState(serverID, userID, delvedata.floor).burned) { // They burned the room, so there should be smouldering vines here. text = `${text} The air has a heavy stench of burned perfume. Fortunately, the aphrodisiac in this state doesn't appear to affect you in the slightest as you look upon the smouldering ruin.` } @@ -388,12 +389,12 @@ const delveroomchoices = { statweight: { dexterity: 10, }, - statspecial: (userID, delvedata, resolve) => { - if (getHeadwear(userID).find((f) => getBaseHeadwear(f)?.tags?.includes("gasmask"))) { + statspecial: (serverID, userID, delvedata, resolve) => { + if (getHeadwear(serverID, userID).find((f) => getBaseHeadwear(f)?.tags?.includes("gasmask"))) { // If they are wearing a gasmask, they will always succeed. delvedata.stats = {}; // This makes it 100% } - else if (getHeavyRestrictions(userID)?.touchself && !getHeavyRestrictions(userID)?.touchothers) { + else if (getHeavyRestrictions(serverID, userID)?.touchself && !getHeavyRestrictions(serverID, userID)?.touchothers) { // If their legs are bound, they will auto fail this. delvedata.stats = { dexterity: 99 @@ -401,9 +402,9 @@ const delveroomchoices = { } return delvedata.stats }, - successfunction: (userID, delvedata, resolve) => { return true }, - failurefunction: (userID, delvedata, resolve) => { - addArousal(userID, 20) + successfunction: (serverID, userID, delvedata, resolve) => { return true }, + failurefunction: (serverID, userID, delvedata, resolve) => { + addArousal(serverID, userID, 20) resolve = Math.max(resolve - 5, 0) } }, @@ -416,18 +417,18 @@ const delveroomchoices = { statweight: { intelligence: 10, }, - statspecial: (userID, delvedata, resolve) => { return delvedata.stats }, - successfunction: (userID, delvedata, resolve) => { - getDelveFloorState(userID, delvedata.floor).burned = true; + statspecial: (serverID, userID, delvedata, resolve) => { return delvedata.stats }, + successfunction: (serverID, userID, delvedata, resolve) => { + getDelveFloorState(serverID, userID, delvedata.floor).burned = true; }, - failurefunction: (userID, delvedata, resolve) => { - addArousal(userID, 20) + failurefunction: (serverID, userID, delvedata, resolve) => { + addArousal(serverID, userID, 20) resolve = Math.max(resolve - 5, 0) } } ], weight: 5, - weightspecial: (userID, weight) => { return weight }, + weightspecial: (serverID, userID, weight) => { return weight }, weightforce: undefined, accentcolor: 0x0099ff }, @@ -441,11 +442,11 @@ const delveroomchoices = { *******/ async function generateDelveModal(serverID, user, floor, incomingdelvedata) { traceFirstParam(arguments[0]); - let floordata = delveroomchoices[process.delveuserdata[user]?.floorarr[floor]] ?? delveroomchoices["errorroom"] - let delveuserdata = process.delveuserdata[user] + let floordata = delveroomchoices[process.delveuserdata[serverID][user]?.floorarr[floor]] ?? delveroomchoices["errorroom"] + let delveuserdata = process.delveuserdata[serverID][user] - let floortext = floordata[`${ getCurrentFloor(user) > delveuserdata.floorscompleted ? "" : "revisit" }longdesc`] - floortext = floordata[`${ getCurrentFloor(user) > delveuserdata.floorscompleted ? "" : "revisit" }extradesc`](user, floortext, { floor: floor }) + let floortext = floordata[`${ getCurrentFloor(serverID, user) > delveuserdata.floorscompleted ? "" : "revisit" }longdesc`] + floortext = floordata[`${ getCurrentFloor(serverID, user) > delveuserdata.floorscompleted ? "" : "revisit" }extradesc`](serverID, user, floortext, { floor: floor }) floortext = `## ${floordata.name}\n\n${floortext}` if (incomingdelvedata && incomingdelvedata.completedtext) { floortext = `## ${floordata.name}\n\n${incomingdelvedata.completedtext}` } @@ -454,7 +455,7 @@ async function generateDelveModal(serverID, user, floor, incomingdelvedata) { // Alternatively, select 3 random floors by vaguedescription to display if the current floor is completed, but floors length is not longer. let roomchoices = []; let directiontext = []; - if (getCurrentFloor(user) > delveuserdata.floorscompleted) { + if (getCurrentFloor(serverID, user) > delveuserdata.floorscompleted) { // This floor has not been cleared for (let i = 0; i < floordata.choices.length; i++) { // Calculate the success chance for this action. @@ -463,14 +464,14 @@ async function generateDelveModal(serverID, user, floor, incomingdelvedata) { // Success is given by 0.5 + (playerskill - skillcheck) * 0.2. Skill checks will be multiplied to get the final result, clamped 0.0-1.0. // For example, if a choice requires 12 intelligence and the player has 11 intelligence, the success chance will be 30%. // If the choice also requires 10 dexterity and they have 12 dexterity, then the skill chance will be 0.3 * 0.9, or 27%. - let playerstats = getDelvePlayerStats(user); + let playerstats = getDelvePlayerStats(serverID, user); let floorstats = floordata.choices[i].statweight; let delvedata = { stats: floorstats, playerstats: playerstats, delveuserdata: delveuserdata } - floorstats = floordata.choices[i].statspecial(user, delvedata); // Modify the stats! + floorstats = floordata.choices[i].statspecial(serverID, user, delvedata); // Modify the stats! @@ -491,18 +492,18 @@ async function generateDelveModal(serverID, user, floor, incomingdelvedata) { } roomchoices.push(new ButtonBuilder() - .setCustomId(`delve_${user}_${floor}_button${i}`) + .setCustomId(`delve_${serverID}_${user}_${floor}_button${i}`) .setLabel(`${floordata.choices[i].name} (${successchance * 100}% chance)`) .setStyle(buttoncolor) ) } } // Else, if theyve completed the primary action, generate a list of buttons as options where to go - else if ((delveuserdata.floorarr.length - 1) == getCurrentFloor(user)) { + else if ((delveuserdata.floorarr.length - 1) == getCurrentFloor(serverID, user)) { roomchoices = chooseNextRooms(user, 3); roomchoices = roomchoices.map((r) => { return new ButtonBuilder() - .setCustomId(`delve_${user}_${floor}_newroom_${r}`) + .setCustomId(`delve_${serverID}_${user}_${floor}_newroom_${r}`) .setLabel(delveroomchoices[r].hintdesc) .setStyle(ButtonStyle.Success) }) @@ -515,22 +516,22 @@ async function generateDelveModal(serverID, user, floor, incomingdelvedata) { let moveroomchoices = [ // Previous Floor new ButtonBuilder() - .setCustomId(`delve_${user}_${floor}_backbutton`) + .setCustomId(`delve_${serverID}_${user}_${floor}_backbutton`) .setLabel("Previous Floor") .setStyle(ButtonStyle.Secondary) .setDisabled((floor <= 0)), // Disable if we're at the entrance! // Floor Counter new ButtonBuilder() - .setCustomId(`delve_${user}_${floor}_floorcounter`) + .setCustomId(`delve_${serverID}_${user}_${floor}_floorcounter`) .setLabel(`Floor ${floor}`) .setStyle(ButtonStyle.Secondary) .setDisabled(true), // Next Floor new ButtonBuilder() - .setCustomId(`delve_${user}_${floor}_nextbutton`) + .setCustomId(`delve_${serverID}_${user}_${floor}_nextbutton`) .setLabel(`Next Floor`) .setStyle(ButtonStyle.Secondary) - .setDisabled((floor >= process.delveuserdata[user].floorscompleted) && ((process.delveuserdata[user].floorarr.length - 1) <= parseInt(process.delveuserdata[user].floor))) // Disable if current floor is NOT completed + .setDisabled((floor >= process.delveuserdata[serverID][user].floorscompleted) && ((process.delveuserdata[serverID][user].floorarr.length - 1) <= parseInt(process.delveuserdata[serverID][user].floor))) // Disable if current floor is NOT completed ]; let outcontainer = new ContainerBuilder() @@ -550,7 +551,7 @@ async function generateDelveModal(serverID, user, floor, incomingdelvedata) { } if (roomchoices.length > 0) { - let optiontext = (getCurrentFloor(user) > delveuserdata.floorscompleted) ? `You decide to...` : `In the next room you see a...` + let optiontext = (getCurrentFloor(serverID, user) > delveuserdata.floorscompleted) ? `You decide to...` : `In the next room you see a...` outcontainer.addTextDisplayComponents((td) => td.setContent(optiontext), ) @@ -560,9 +561,9 @@ async function generateDelveModal(serverID, user, floor, incomingdelvedata) { outcontainer.addSeparatorComponents((sep) => sep); } - if (delveModalStats(user).length > 0) { + if (delveModalStats(serverID, user).length > 0) { outcontainer.addTextDisplayComponents((td) => - td.setContent(delveModalStats(user)) + td.setContent(delveModalStats(serverID, user)) ) } @@ -585,7 +586,7 @@ function chooseNextRooms(serverID, user, roomnumber) { let forcerooms = {}; let outrooms = []; Object.keys(delveroomchoices).forEach((r) => { - let weight = delveroomchoices[r].weightspecial(user, delveroomchoices[r].weight) + let weight = delveroomchoices[r].weightspecial(serverID, user, delveroomchoices[r].weight) let weightforce = delveroomchoices[r].weightforce ? delveroomchoices[r].weightforce() : false; if (weightforce) { forcerooms[r] = { @@ -659,10 +660,10 @@ function delveModalStats(serverID, user) { traceFirstParam(arguments[0]); let outtext = `**Player:** <@${user}>`; if (getResolve(user)) { - outtext = `${outtext}\n**Resolve:** ${getResolve(user)}` + outtext = `${outtext}\n**Resolve:** ${getResolve(serverID, user)}` } - if (process.delveuserdata[user] && (process.delveuserdata[user].floorscompleted != undefined)) { - outtext = `${outtext}\n**Floors Completed:** ${Math.max(process.delveuserdata[user].floorscompleted, 0)}` + if (process.delveuserdata[serverID][user] && (process.delveuserdata[serverID][user].floorscompleted != undefined)) { + outtext = `${outtext}\n**Floors Completed:** ${Math.max(process.delveuserdata[serverID][user].floorscompleted, 0)}` } return outtext; } @@ -675,13 +676,13 @@ function delveModalStats(serverID, user) { async function handleDelveSlashCommand(interaction) { let subc = interaction.options.getSubcommand(); if (subc == "run") { - let currfloor = getCurrentFloor(interaction.user.id); + let currfloor = getCurrentFloor(interaction.guildId, interaction.user.id); if (currfloor === undefined) { // They are NOT on a delve right now. We should have one generated. - setNextDelveRoom(interaction.user.id); + setNextDelveRoom(interaction.guildId, interaction.user.id); } - console.log(getCurrentFloor(interaction.user.id)) - interaction.reply(await generateDelveModal(interaction.user.id, getCurrentFloor(interaction.user.id))) + console.log(getCurrentFloor(interaction.guildId, interaction.user.id)) + interaction.reply(await generateDelveModal(interaction.guildId, interaction.user.id, getCurrentFloor(interaction.guildId, interaction.user.id))) } else if (subc == "inventory") { interaction.reply(`The Inventory command has not been implemented yet.`) @@ -713,22 +714,22 @@ async function handleDelveInteraction(interaction) { let buttonfloor = buttonparts[2] // Navigation buttons if (buttonparts[3] && (buttonparts[3] == "backbutton")) { - process.delveuserdata[interaction.user.id].floor = parseInt(buttonfloor) - 1 - interaction.editReply(await generateDelveModal(interaction.user.id, parseInt(buttonfloor) - 1)) + process.delveuserdata[interaction.guildId][interaction.user.id].floor = parseInt(buttonfloor) - 1 + interaction.editReply(await generateDelveModal(interaction.guildId, interaction.user.id, parseInt(buttonfloor) - 1)) return; } if (buttonparts[3] && (buttonparts[3] == "nextbutton")) { - process.delveuserdata[interaction.user.id].floor = parseInt(buttonfloor) + 1 - interaction.editReply(await generateDelveModal(interaction.user.id, parseInt(buttonfloor) + 1)) + process.delveuserdata[interaction.guildId][interaction.user.id].floor = parseInt(buttonfloor) + 1 + interaction.editReply(await generateDelveModal(interaction.guildId, interaction.user.id, parseInt(buttonfloor) + 1)) return } // Room choice buttons if (buttonparts[3] && (buttonparts[3].startsWith("button"))) { let choicenum = buttonparts[3].slice(-1); // Get num at end of 3rd part let delvedata = {}; - if (process.delveuserdata && process.delveuserdata[interaction.user.id] && process.delveuserdata[interaction.user.id].floorarr && process.delveuserdata[interaction.user.id].floorarr[buttonfloor]) { - let floordata = delveroomchoices[process.delveuserdata[interaction.user.id].floorarr[buttonfloor]] - let playerstats = getDelvePlayerStats(interaction.user.id); + if (process.delveuserdata && process.delveuserdata[interaction.guildId][interaction.user.id] && process.delveuserdata[interaction.guildId][interaction.user.id].floorarr && process.delveuserdata[interaction.guildId][interaction.user.id].floorarr[buttonfloor]) { + let floordata = delveroomchoices[process.delveuserdata[interaction.guildId][interaction.user.id].floorarr[buttonfloor]] + let playerstats = getDelvePlayerStats(interaction.guildId, interaction.user.id); let floorstats = floordata.choices[choicenum].statweight; delvedata = { stats: floorstats, @@ -736,7 +737,7 @@ async function handleDelveInteraction(interaction) { floor: parseInt(buttonfloor), //delveuserdata: delveuserdata } - floorstats = floordata.choices[choicenum].statspecial(interaction.user.id, delvedata); // Modify the stats! + floorstats = floordata.choices[choicenum].statspecial(interaction.guildId, interaction.user.id, delvedata); // Modify the stats! let successchance = 1.0; Object.keys(floorstats).forEach((stat) => { @@ -748,32 +749,32 @@ async function handleDelveInteraction(interaction) { let randomroll = Math.random(); if (randomroll < successchance) { // Successful! - if (floordata.choices[choicenum].successfunction) { floordata.choices[choicenum].successfunction(interaction.user.id, delvedata) } + if (floordata.choices[choicenum].successfunction) { floordata.choices[choicenum].successfunction(interaction.guildId, interaction.user.id, delvedata) } if (floordata.choices[choicenum].longoutcome_success) { delvedata.completedtext = floordata.choices[choicenum].longoutcome_success } } else { // Failed - if (floordata.choices[choicenum].failurefunction) { floordata.choices[choicenum].failurefunction(interaction.user.id, delvedata) } + if (floordata.choices[choicenum].failurefunction) { floordata.choices[choicenum].failurefunction(interaction.guildId, interaction.user.id, delvedata) } if (floordata.choices[choicenum].longoutcome_success) { delvedata.completedtext = floordata.choices[choicenum].longoutcome_failure } } } else { // Successful! - if (floordata.choices[choicenum].successfunction) { floordata.choices[choicenum].successfunction(interaction.user.id, delvedata) } + if (floordata.choices[choicenum].successfunction) { floordata.choices[choicenum].successfunction(interaction.guildId, interaction.user.id, delvedata) } if (floordata.choices[choicenum].longoutcome_success) { delvedata.completedtext = floordata.choices[choicenum].longoutcome_success } } } // Now increment the floor completed counter. - process.delveuserdata[interaction.user.id].floorscompleted = parseInt(process.delveuserdata[interaction.user.id].floorscompleted) + 1; + process.delveuserdata[interaction.guildId][interaction.user.id].floorscompleted = parseInt(process.delveuserdata[interaction.guildId][interaction.user.id].floorscompleted) + 1; console.log(delvedata); - interaction.editReply(await generateDelveModal(interaction.user.id, buttonfloor, delvedata)) + interaction.editReply(await generateDelveModal(interaction.guildId, interaction.user.id, buttonfloor, delvedata)) return } if (buttonparts[3] && (buttonparts[3].startsWith("newroom"))) { - if (process.delveuserdata && process.delveuserdata[interaction.user.id] && process.delveuserdata[interaction.user.id].floorarr) { - process.delveuserdata[interaction.user.id].floorarr.push(buttonparts[4]) - process.delveuserdata[interaction.user.id].floor = parseInt(buttonfloor) + 1 - interaction.editReply(await generateDelveModal(interaction.user.id, parseInt(buttonfloor) + 1)) + if (process.delveuserdata && process.delveuserdata[interaction.guildId] && process.delveuserdata[interaction.guildId][interaction.user.id] && process.delveuserdata[interaction.guildId][interaction.user.id].floorarr) { + process.delveuserdata[interaction.guildId][interaction.user.id].floorarr.push(buttonparts[4]) + process.delveuserdata[interaction.guildId][interaction.user.id].floor = parseInt(buttonfloor) + 1 + interaction.editReply(await generateDelveModal(interaction.guildId, interaction.user.id, parseInt(buttonfloor) + 1)) } } } @@ -785,7 +786,7 @@ async function handleDelveInteraction(interaction) { ********/ async function generateDelveStatModal(interaction, menu) { let pagecomponents = []; - let currstats = getDelvePlayerStats(interaction.user.id); + let currstats = getDelvePlayerStats(interaction.guildId, interaction.user.id); let unallocatedtext = (currstats.unallocated > 0) ? `\n**Unallocated Points:** ${currstats.unallocated}` : "" let maintextdisplay = `## Delve Stats\n**Player:** <@${interaction.user.id}>\n**Level:** ${currstats.level}${unallocatedtext}\n` let maintd = new TextDisplayBuilder().setContent(maintextdisplay) diff --git a/functions/dollfunctions.js b/functions/dollfunctions.js index 7372a848..e2c6308a 100644 --- a/functions/dollfunctions.js +++ b/functions/dollfunctions.js @@ -189,18 +189,19 @@ function checkDollification(serverID, userID) { } let isDoll = false; // Dollify a valid doll if needed - if (isValidDoll(userID)) { + if (isValidDoll(serverID, userID)) { // If user is NOT a doll, make them a doll. - if (!process.dolls[userID]) { - process.dolls[userID] = { violations: 0, punishmentLevel: 0, goodDollStreak: 0 }; + if (process.dolls[serverID] == undefined) { process.dolls[serverID] = {} } + if (!process.dolls[serverID][userID]) { + process.dolls[serverID][userID] = { violations: 0, punishmentLevel: 0, goodDollStreak: 0 }; // Save the doll to the database. markForSave("dolls"); } isDoll = true; // Undollify if needed } else { - if (process.dolls[userID]) { - delete process.dolls[userID]; + if (process.dolls[serverID][userID]) { + delete process.dolls[serverID][userID]; // Save the doll to the database. markForSave("dolls"); } @@ -215,7 +216,7 @@ function isValidDoll(serverID, userID) { traceFirstParam(arguments[0]); // TODO - Control harness + collar required for dollification? - return getHeadwear(userID).find((headwear) => DOLLVISORS.includes(headwear)); + return getHeadwear(serverID, userID).find((headwear) => DOLLVISORS.includes(headwear)); } /********************************************** @@ -227,7 +228,10 @@ function rewardDoll(serverID, userID) { if (process.dolls == undefined) { process.dolls = {}; } - let doll = process.dolls[userID]; + if (process.dolls[serverID] == undefined) { + process.dolls[serverID] = {}; + } + let doll = process.dolls[serverID][userID]; if (doll) { doll.goodDollStreak++; // Reward the doll @@ -255,15 +259,15 @@ async function textGarbleDOLL(msg, modifiedmessage, outtextin) { // Handle Dollification let modified = modifiedmessage; let outtext = outtextin; - let dollified = checkDollification(msg.author.id); + let dollified = checkDollification(msg.guild.id, msg.author.id); let dollIDDisplay; let dollID = ``; - let dollIDOverride = getOption(msg.author.id, "dollvisorname"); - let dollIDColor = getOption(msg.author.id, "dollvisorcolor") ?? 34; - let dollProtocol = !(getOption(msg.author.id, "dollforcedprotocol") == "disabled"); // Enabled for any level that isn't disabled - let dollProtocolLevel = getOption(msg.author.id, "dollforcedprotocol"); - let dollPunishThresh = getOption(msg.author.id, "dollpunishthresh"); - let dollmaker = getHeadwear(msg.member.id).find((headwear) => headwear === "dollmaker_visor"); + let dollIDOverride = getOption(msg.guild.id, msg.author.id, "dollvisorname"); + let dollIDColor = getOption(msg.guild.id, msg.author.id, "dollvisorcolor") ?? 34; + let dollProtocol = !(getOption(msg.guild.id, msg.author.id, "dollforcedprotocol") == "disabled"); // Enabled for any level that isn't disabled + let dollProtocolLevel = getOption(msg.guild.id, msg.author.id, "dollforcedprotocol"); + let dollPunishThresh = getOption(msg.guild.id, msg.author.id, "dollpunishthresh"); + let dollmaker = getHeadwear(msg.guild.id, msg.member.id).find((headwear) => headwear === "dollmaker_visor"); // This creates a circular, so, access the variable directly. Oh well. let eldritchcorrupted = getGags(msg.guild.id, msg.member.id).find((gag) => gag === "eldritch"); let dollProtocolViolations = 0; @@ -513,9 +517,9 @@ async function textGarbleDOLL(msg, modifiedmessage, outtextin) { } function textGarbleDrone(text, parent, msg, msgTreeMods) { - if (getHeadwear(msg.member.id).includes("drone_visor")) { + if (getHeadwear(msg.guild.id, msg.member.id).includes("drone_visor")) { //let supplieddronespeech = (text.startsWith(`${getOption(msg.member.id, "dronevisorname")}`)) - let outtext = `${getOption(msg.member.id, "dronevisorname")} :: Code ${(msg.type == "19") ? "250" : "050"} :: ${(msg.type == "19") ? "Response" : "Statement"}, ${text}` + let outtext = `${getOption(msg.guild.id, msg.member.id, "dronevisorname")} :: Code ${(msg.type == "19") ? "250" : "050"} :: ${(msg.type == "19") ? "Response" : "Statement"}, ${text}` msgTreeMods.modified = true; return ("`" + outtext + "`") } diff --git a/functions/getters/chastity/getChastityBraTempTimelock.js b/functions/getters/chastity/getChastityBraTempTimelock.js index 2ee39168..d6e1d50f 100644 --- a/functions/getters/chastity/getChastityBraTempTimelock.js +++ b/functions/getters/chastity/getChastityBraTempTimelock.js @@ -1,20 +1,22 @@ -const { getOption } = require("../config/getOption"); +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getChastityBra } = require("./getChastityBra"); /*********** * Returns UNIX timestring of the wearer's fumbled unlock time. As this is small, the default return is using relative time instead of date stamps. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID wearing the chastity bra. * - (boolean) UNIXTimestring? - If true, returns a Discord UNIX timestring instead * --- * ##### Returns an integer with the fumbled or a string with the fumbled unlock time for Discord. ***********/ -function getChastityBraTempTimelock(user, UNIXTimestring) { +function getChastityBraTempTimelock(serverID, user, UNIXTimestring) { + traceFirstParam(arguments[0]); if (!UNIXTimestring) { - return getChastityBra(user)?.temporarykeyholdertime; + return getChastityBra(serverID, user)?.temporarykeyholdertime; } else { - if (getChastityBra(user)?.temporarykeyholdertime) { - return ``; + if (getChastityBra(serverID, user)?.temporarykeyholdertime) { + return ``; } else { return null; } diff --git a/functions/getters/chastity/getChastityTempTimelock.js b/functions/getters/chastity/getChastityTempTimelock.js index eb6a4239..e314accc 100644 --- a/functions/getters/chastity/getChastityTempTimelock.js +++ b/functions/getters/chastity/getChastityTempTimelock.js @@ -1,19 +1,22 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getChastity } = require("./getChastity"); /*********** * Returns UNIX timestring of the wearer's fumbled unlock time. As this is small, the default return is using relative time instead of date stamps. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID wearing the chastity belt. * - (boolean) UNIXTimestring? - If true, returns a Discord UNIX timestring instead * --- * ##### Returns an integer with the fumbled or a string with the fumbled unlock time for Discord. ***********/ -function getChastityTempTimelock(user, UNIXTimestring) { +function getChastityTempTimelock(serverID, user, UNIXTimestring) { + traceFirstParam(arguments[0]); if (!UNIXTimestring) { - return getChastity(user)?.temporarykeyholdertime; + return getChastity(serverID, user)?.temporarykeyholdertime; } else { - if (getChastity(user)?.temporarykeyholdertime) { - return ``; + if (getChastity(serverID, user)?.temporarykeyholdertime) { + return ``; } else { return null; } diff --git a/functions/getters/collar/getCollarTempTimelock.js b/functions/getters/collar/getCollarTempTimelock.js index 239de716..4d76a428 100644 --- a/functions/getters/collar/getCollarTempTimelock.js +++ b/functions/getters/collar/getCollarTempTimelock.js @@ -1,19 +1,22 @@ +const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { getCollar } = require("./getCollar"); /*********** * Returns UNIX timestring of the wearer's fumbled unlock time. As this is small, the default return is using relative time instead of date stamps. * + * - (server id) serverID - The server this is running on * - (user id) user - The User ID wearing the collar. * - (boolean) UNIXTimestring? - If true, returns a Discord UNIX timestring instead * --- * ##### Returns an integer with the fumbled or a string with the fumbled unlock time for Discord. ***********/ -function getCollarTempTimelock(user, UNIXTimestring) { +function getCollarTempTimelock(serverID, user, UNIXTimestring) { + traceFirstParam(arguments[0]); if (!UNIXTimestring) { - return getCollar(user)?.temporarykeyholdertime; + return getCollar(serverID, user)?.temporarykeyholdertime; } else { - if (getCollar(user)?.temporarykeyholdertime) { - return ``; + if (getCollar(serverID, user)?.temporarykeyholdertime) { + return ``; } else { return null; } From eccdb381bb1378577403c4fface267ef1b9e9bd2 Mon Sep 17 00:00:00 2001 From: Enraa Date: Fri, 19 Jun 2026 20:46:21 -0700 Subject: [PATCH 18/44] to comfort you... --- functions/eventhandling.js | 57 ++++++++++---------- functions/gagfunctions.js | 96 +++++++++++++++++----------------- functions/headwearfunctions.js | 8 +-- 3 files changed, 82 insertions(+), 79 deletions(-) diff --git a/functions/eventhandling.js b/functions/eventhandling.js index d1245a83..2c314447 100644 --- a/functions/eventhandling.js +++ b/functions/eventhandling.js @@ -5,6 +5,9 @@ const { getHeavy } = require("./getters/heavy/getHeavy"); const { getWearable } = require("./getters/wearable/getWearable"); const { getToys } = require("./getters/toy/getToys"); const { getCollar } = require("./getters/collar/getCollar"); +const { getGags } = require("./getters/gag/getGags"); +const { getMitten } = require("./getters/mitten/getMitten"); +const { getHeavyList } = require("./getters/heavy/getHeavyList"); /********* @@ -25,65 +28,65 @@ async function emitEvent(type, userid, serverid, data, delay = 0) { if (delay) { await new Promise(res => setTimeout(res, delay)) } // Gags - if (process.gags && process.gags[serverid] && process.gags[serverid][userid]) { - process.gags[serverid][userid].forEach((g) => { + if (getGags(serverid, userid)) { + getGags(serverid, userid).forEach((g) => { if (process.eventfunctions && process.eventfunctions.gags && process.eventfunctions.gags[g.gagtype] && process.eventfunctions.gags[g.gagtype][type]) { - process.eventfunctions.gags[g.gagtype][type](userid, data); + process.eventfunctions.gags[g.gagtype][type](serverid, userid, data); } }); } // Headwear - if (process.headwear) { - getHeadwear(userid).forEach((h) => { + if (getHeadwear(serverid, userid)) { + getHeadwear(serverid, userid).forEach((h) => { if (process.eventfunctions && process.eventfunctions.headwear && process.eventfunctions.headwear[h] && process.eventfunctions.headwear[h][type]) { - process.eventfunctions.headwear[h][type](userid, data); + process.eventfunctions.headwear[h][type](serverid, userid, data); } }); } // Mittens - if (process.mitten) { - if (process.mitten[userid]) { - if (process.eventfunctions && process.eventfunctions.mitten && process.eventfunctions.mitten[process.mitten[userid].mittenname] && process.eventfunctions.mitten[process.mitten[userid].mittenname][type]) { - process.eventfunctions.mitten[process.mitten[userid].mittenname][type](userid, data); + if (getMitten(serverid, userid)) { + if (getMitten(serverid, userid)) { + if (process.eventfunctions && process.eventfunctions.mitten && process.eventfunctions.mitten[getMitten(serverid, userid).mittenname] && process.eventfunctions.mitten[process.mitten[userid].mittenname][type]) { + process.eventfunctions.mitten[getMitten(serverid, userid).mittenname][type](serverid, userid, data); } } } // Heavy Bondage - if (process.heavy) { - if (getHeavy(userid)) { - process.heavy[userid].forEach((heavy) => { + if (getHeavy(serverid, userid)) { + if (getHeavy(serverid, userid)) { + getHeavyList(serverid, userid).forEach((heavy) => { if (process.eventfunctions && process.eventfunctions.heavy && process.eventfunctions.heavy[heavy.type] && process.eventfunctions.heavy[heavy.type][type]) { - process.eventfunctions.heavy[heavy.type][type](userid, data); + process.eventfunctions.heavy[heavy.type][type](serverid, userid, data); } }) } } // Wearables - if (process.wearable) { - getWearable(userid).forEach((h) => { + if (getWearable(serverid, userid)) { + getWearable(serverid, userid).forEach((h) => { if (process.eventfunctions && process.eventfunctions.wearable && process.eventfunctions.wearable[h] && process.eventfunctions.wearable[h][type]) { - process.eventfunctions.wearable[h][type](userid, data); + process.eventfunctions.wearable[h][type](serverid, userid, data); } }); } // Toys - if (process.toys) { - getToys(userid).forEach((h) => { + if (getToys(serverid, userid)) { + getToys(serverid, userid).forEach((h) => { if (process.eventfunctions && process.eventfunctions.toys && process.eventfunctions.toys[h.type] && process.eventfunctions.toys[h.type][type]) { - process.eventfunctions.toys[h.type][type](userid, data); + process.eventfunctions.toys[h.type][type](serverid, userid, data); } }); } // Collars - if (process.collar) { - if (getCollar(userid)) { - if (process.eventfunctions && process.eventfunctions.collar && process.eventfunctions.collar[getCollar(userid).collartype] && process.eventfunctions.collar[getCollar(userid).collartype][type]) { - process.eventfunctions.collar[getCollar(userid).collartype][type](userid, data); + if (getCollar(serverid, userid)) { + if (getCollar(serverid, userid)) { + if (process.eventfunctions && process.eventfunctions.collar && process.eventfunctions.collar[getCollar(serverid, userid).collartype] && process.eventfunctions.collar[getCollar(serverid, userid).collartype][type]) { + process.eventfunctions.collar[getCollar(serverid, userid).collartype][type](serverid, userid, data); } - if (getCollar(userid).additionalcollars) { - getCollar(userid).additionalcollars.forEach((ac) => { + if (getCollar(serverid, userid).additionalcollars) { + getCollar(serverid, userid).additionalcollars.forEach((ac) => { if (process.eventfunctions && process.eventfunctions.collar && process.eventfunctions.collar[ac] && process.eventfunctions.collar[ac][type]) { - process.eventfunctions.collar[ac][type](userid, data); + process.eventfunctions.collar[ac][type](serverid, userid, data); } }) } diff --git a/functions/gagfunctions.js b/functions/gagfunctions.js index 3b48cd98..ff900bb4 100644 --- a/functions/gagfunctions.js +++ b/functions/gagfunctions.js @@ -26,6 +26,8 @@ const { convertPronounsText } = require("./other/convertPronounsText.js"); const { getAlternateName } = require("./getters/config/getAlternateName.js"); const { markForSave } = require("./other/markForSave.js"); const { setUserVar } = require("./setters/config/setUserVar.js"); +const { getGags } = require("./getters/gag/getGags.js"); +const { statsAddCounter } = require("./setters/config/statsAddCounter.js"); // Grab all the command files from the commands directory const gagtypes = []; @@ -92,16 +94,19 @@ function punishDoll(serverID, userID, amount) { if (process.dolls == undefined) { process.dolls = {}; } - let doll = process.dolls[userID]; + if (process.dolls[serverID] == undefined) { + process.dolls[serverID] = {}; + } + let doll = process.dolls[serverID][userID]; if (doll) { doll.violations += amount; doll.goodDollStreak = 0; // BAD DOLL console.log("BAD DOLL:"); - console.log(process.dolls[userID]); + console.log(process.dolls[serverID][userID]); // Compute punishments by dividing violations by punishThresh. let punishThresh = getOption(userID, "dollpunishthresh"); - if (getHeadwear(userID).find((headwear) => headwear === "dollmaker_visor")) { + if (getHeadwear(serverID, userID).find((headwear) => headwear === "dollmaker_visor")) { punishThresh = 2; // Forced to 2 if dollmakers visor } let punishments = Math.floor(doll.violations / punishThresh); @@ -125,20 +130,20 @@ function punishDoll(serverID, userID, amount) { break; case 1: // Gag the Doll - assignGag(userID, "ball", 4); + assignGag(serverID, userID, "ball", 4); break; case 2: // Gag and Mitten the Doll - assignGag(userID, "ball", 6); - assignMitten(userID, "mittens_cyberdoll"); + assignGag(serverID, userID, "ball", 6); + assignMitten(serverID, userID, "mittens_cyberdoll"); break; // Drop through to highest punishment. default: case 3: // Gag, Mittens, Heavy - assignGag(userID, "ball", 8); - assignMitten(userID, "mittens_cyberdoll"); - assignHeavy(userID, "hardlight_looselink"); + assignGag(serverID, userID, "ball", 8); + assignMitten(serverID, userID, "mittens_cyberdoll"); + assignHeavy(serverID, userID, "hardlight_looselink"); break; } } @@ -148,7 +153,7 @@ function punishDoll(serverID, userID, amount) { } const messageReplaceEmojiWithText = async (msg) => { - if (!getHeadwearRestrictions(msg.author.id).forcedtextemoji) {return msg.content;} + if (!getHeadwearRestrictions(msg.guild.id, msg.author.id).forcedtextemoji) {return msg.content;} let text = msg.content; @@ -202,8 +207,8 @@ const modifymessage = async (msg, threadId, messageonly) => { let msgTree = new MessageAST(msg.content); // Build AST from message let msgTreeMods = {"modified":false, "emojiModified":false, "corseted":false} // Store a boolean in an object to allow pass by reference. - processHeadwearEmoji(msg.author.id, msgTree, msgTreeMods, getOption(msg.author.id, "dollvisorname")) - processHeadwearTruthgas(msg.author.id, msgTree, msgTreeMods) + processHeadwearEmoji(msg.guild.id, msg.author.id, msgTree, msgTreeMods, getOption(msg.guild.id, msg.author.id, "dollvisorname")) + processHeadwearTruthgas(msg.guild.id, msg.author.id, msgTree, msgTreeMods) await processPregarbleGags(msg, msgTree, msgTreeMods) // Perform early garbles before arousal and corset effects. // See if this message can be skipped. Messages containing only emoji do NOT need to be processed, @@ -252,7 +257,7 @@ const modifymessage = async (msg, threadId, messageonly) => { } // Get the user's current display name based on worn restraints - let userdisplayName = getAlternateName(msg.member); + let userdisplayName = getAlternateName(msg.guild.id, msg.member); if (userdisplayName != msg.member.displayName) { msgTreeMods.modified = true; } @@ -304,20 +309,20 @@ const replaceStutter = (text, parent, msg, msgModified, intensity, arousedtexts) } function textGarbleVibrator(msg, msgTree, msgModified) { - const intensity = getVibeEquivalent(msg.author.id); + const intensity = getVibeEquivalent(msg.guild.id, msg.author.id); if (intensity) { - const arousedtexts = getArousedTexts(msg.author.id); + const arousedtexts = getArousedTexts(msg.guild.id, msg.author.id); msgTree.callFunc(replaceStutter, true, "rawText",[msg, msgModified, intensity, arousedtexts]) } } function textGarbleCorset(msg, msgTree, msgModified, threadId) { // Now corset any words, using an amount to start with. - let corset = getCorset(msg.author.id) + let corset = getCorset(msg.guild.id, msg.author.id) if (corset) { const hadParts = msgTree.toString() != "" - msgTree.callFunc(corsetLimitWords, true, "rawText", [msg.author.id, msgModified]) + msgTree.callFunc(corsetLimitWords, true, "rawText", [msg.author.id, msgModified, msg.guild.id]) if (hadParts && msgTree.toString() == "") { messageSend(msg, silenceMessage(), msg.member.displayAvatarURL(), msg.member.displayName, threadId, msgModified.modified).then(() => msg.delete()); @@ -338,9 +343,9 @@ async function textGarbleGag(msg, msgTree, msgTreeMods) { if (process.gags == undefined) { process.gags = {}; } - if (process.gags[msg.guildId] && process.gags[msg.guildId][msg.author.id] && process.gags[msg.guildId][msg.author.id].length > 0) { + if (getGags(msg.guild.id, msg.author.id).length > 0) { // Go over each gag and if there's a gag file loaded for it, run the messagebegin, garbletext and messageend functions if they exist. - process.gags[msg.guildId][msg.author.id].forEach((gag) => { + getGags(msg.guild.id, msg.author.id).forEach((gag) => { if (process.gagtypes && process.gagtypes[gag.gagtype]) { if (process.gagtypes[gag.gagtype].messagebegin) { let out = process.gagtypes[gag.gagtype].messagebegin(msg, msgTree, msgTreeMods, gag.intensity ?? 5); @@ -370,10 +375,10 @@ async function processPregarbleGags(msg, msgTree, msgTreeMods) { if (process.gags == undefined) { process.gags = {}; } - if (process.gags[msg.guildId] && process.gags[msg.guildId][msg.author.id] && process.gags[msg.guildId][msg.author.id].length > 0) { + if (getGags(msg.guild.id, msg.author.id).length > 0) { let origcontent = msg.content; // Go over each gag and if there's a gag file loaded for it, run the messagebegin, garbletext and messageend functions if they exist. - process.gags[msg.guildId][msg.author.id].forEach(async (gag) => { + getGags(msg.guild.id, msg.author.id).forEach(async (gag) => { if (process.gagtypes && process.gagtypes[gag.gagtype]) { if (process.gagtypes[gag.gagtype].pregarble) { await msgTree.callFunc(process.gagtypes[gag.gagtype].pregarble,true,"rawText",[gag.intensity ?? 5, msg]) // Run garble on all IC segments. @@ -397,7 +402,7 @@ async function appendCollarEffects(msg, outtext, msgTreeMods) { // If they were shocked, then give a shocked message. if (msgTreeMods.shocked) { // Figure out the tone to shock the user with - let tone = getOption(msg.author.id, "shocktone") ?? "playful"; + let tone = getOption(msg.guild.id, msg.author.id, "shocktone") ?? "playful"; if (tone == "both") { if (Math.random() > 0.5) { tone = "playful" @@ -413,7 +418,7 @@ async function appendCollarEffects(msg, outtext, msgTreeMods) { `*USER_TAG eeps when the collar gives USER_THEM a tiny shock!*`, { required: (t) => { - return getHeavyRestrictions(t.interactionuser.id).touchself; + return getHeavyRestrictions(msg.guild.id, t.interactionuser.id).touchself; }, text: `*USER_TAG tries to slip a finger under USER_THEIR collar as it stings USER_THEM!*`, }, @@ -428,7 +433,7 @@ async function appendCollarEffects(msg, outtext, msgTreeMods) { `*USER_TAG's words trail off and USER_THEY squintUSER_S USER_THEIR eyes shut!*`, { required: (t) => { - return getHeavyRestrictions(t.interactionuser.id).touchself; + return getHeavyRestrictions(msg.guild.id, t.interactionuser.id).touchself; }, text: `*USER_TAG's grabs USER_THEIR collar with tears as it shocks USER_THEM!*`, }, @@ -445,30 +450,27 @@ async function appendCollarEffects(msg, outtext, msgTreeMods) { texts.push(t) } }) - appendmessages.push(convertPronounsText(texts[Math.floor(texts.length * Math.random())], { interactionuser: msg.member, targetuser: msg.member })); + appendmessages.push(convertPronounsText(texts[Math.floor(texts.length * Math.random())], { serverID: msg.guild.id, interactionuser: msg.member, targetuser: msg.member })); /*** This code is ugly because I couldn't call the functions due to circulars. * * This should ideally be refactored in the future. */ - if (process.userstats == undefined) { process.userstats = {} } - if (process.userstats[msg.member.id] == undefined) { process.userstats[msg.member.id] = {} } - let newcount = (process.userstats[msg.member.id]["timesshocked"] ?? 0) + 1; - process.userstats[msg.member.id]["timesshocked"] = newcount; + statsAddCounter(msg.guild.id, msg.member.id, "timesshocked") markForSave("userstats"); try { - if (getOption(msg.member.id, "pishockusername") && (typeof getOption(msg.member.id, "pishockusername") == "string") && - getOption(msg.member.id, "pishockname") && (typeof getOption(msg.member.id, "pishockname") == "string") && - getOption(msg.member.id, "pishockcode") && (typeof getOption(msg.member.id, "pishockcode") == "string") && - getOption(msg.member.id, "pishockapikey") && (typeof getOption(msg.member.id, "pishockapikey") == "string")) { + if (getOption(msg.guild.id, msg.member.id, "pishockusername") && (typeof getOption(msg.guild.id, msg.member.id, "pishockusername") == "string") && + getOption(msg.guild.id, msg.member.id, "pishockname") && (typeof getOption(msg.guild.id, msg.member.id, "pishockname") == "string") && + getOption(msg.guild.id, msg.member.id, "pishockcode") && (typeof getOption(msg.guild.id, msg.member.id, "pishockcode") == "string") && + getOption(msg.guild.id, msg.member.id, "pishockapikey") && (typeof getOption(msg.guild.id, msg.member.id, "pishockapikey") == "string")) { // Set up the https request. const reqdata = JSON.stringify({ - Username: getOption(msg.member.id, "pishockusername"), - Name: getOption(msg.member.id, "pishockname"), - Code: getOption(msg.member.id, "pishockcode"), + Username: getOption(msg.guild.id, msg.member.id, "pishockusername"), + Name: getOption(msg.guild.id, msg.member.id, "pishockname"), + Code: getOption(msg.guild.id, msg.member.id, "pishockcode"), Intensity: 100, Duration: 2, - Apikey: getOption(msg.member.id, "pishockapikey"), - Op: (getOption(msg.member.id, "pishockop") ? getOption(msg.member.id, "pishockop") : "0"), // 0 for shock, 1 for vibrate, 2 for beep + Apikey: getOption(msg.guild.id, msg.member.id, "pishockapikey"), + Op: (getOption(msg.guild.id, msg.member.id, "pishockop") ? getOption(msg.guild.id, msg.member.id, "pishockop") : "0"), // 0 for shock, 1 for vibrate, 2 for beep }); const options = { hostname: 'do.pishock.com/api/apioperate', // without https:// @@ -503,9 +505,9 @@ async function appendCollarEffects(msg, outtext, msgTreeMods) { } // If they're wearing a sponsorship collar, 30% chance to add a sponsor. - if (process.collar && process.collar[msg.author.id] && ((process.collar[msg.author.id].collartype == "sponsorcollar") || (process.collar[msg.author.id].additionalcollars && process.collar[msg.author.id].additionalcollars.includes("sponsorcollar")))) { - let randomchance = 0.95 - (!isNaN(getUserVar(msg.author.id, "sponsorcollartrigger")) ? (((Date.now() - getUserVar(msg.author.id, "sponsorcollartrigger")) / 60000) * 0.015) : 0.5) // 5% + 1.5% per minute, uncapped. +50% chance if this is their first time ever being sponsored - if ((Math.random() > randomchance) && (!isNaN(getUserVar(msg.author.id, "sponsorcollartrigger")) ? (((Date.now() - getUserVar(msg.author.id, "sponsorcollartrigger")) / 60000) > 1.0) : true)) { // Higher than proc rate AND at least a minute since last proc. + if (process.collar && process.collar[msg.guild.id] && process.collar[msg.guild.id][msg.author.id] && ((process.collar[msg.guild.id][msg.author.id].collartype == "sponsorcollar") || (process.collar[msg.guild.id][msg.author.id].additionalcollars && process.collar[msg.guild.id][msg.author.id].additionalcollars.includes("sponsorcollar")))) { + let randomchance = 0.95 - (!isNaN(getUserVar(msg.guild.id, msg.author.id, "sponsorcollartrigger")) ? (((Date.now() - getUserVar(msg.guild.id, msg.author.id, "sponsorcollartrigger")) / 60000) * 0.015) : 0.5) // 5% + 1.5% per minute, uncapped. +50% chance if this is their first time ever being sponsored + if ((Math.random() > randomchance) && (!isNaN(getUserVar(msg.guild.id, msg.author.id, "sponsorcollartrigger")) ? (((Date.now() - getUserVar(msg.guild.id, msg.author.id, "sponsorcollartrigger")) / 60000) > 1.0) : true)) { // Higher than proc rate AND at least a minute since last proc. let sponsors = [ `FANG (Fox Asset and National Growth) - Asset Management since 2008!`, `FEC (Fox Exchange Commission) - Your Trusted Stock Broker since 1929!`, @@ -554,7 +556,7 @@ async function appendCollarEffects(msg, outtext, msgTreeMods) { `DommeDash - Feeding Subs, One Door at a Time!`, ] appendmessages.push(`-# Sponsored by ${sponsors[Math.floor(sponsors.length * Math.random())]}`); - setUserVar(msg.author.id, "sponsorcollartrigger", Date.now()); + setUserVar(msg.guild.id, msg.author.id, "sponsorcollartrigger", Date.now()); } } @@ -601,9 +603,7 @@ async function sendTheMessage(msg, outtext, dollIDDisplay, threadID, dollProtoco } // Increment the gagged message counter - if (process.userstats == undefined) { process.userstats = {} } - if (process.userstats[msg.author.id] == undefined) { process.userstats[msg.author.id] = {} } - process.userstats[msg.author.id].gaggedmessages = (process.userstats[msg.author.id].gaggedmessages ?? 0) + 1; + statsAddCounter(msg.guild.id, msg.author.id, "gaggedmessages") markForSave("userstats"); // Determine if an attachment was posted in the original message. @@ -640,7 +640,7 @@ async function sendTheMessage(msg, outtext, dollIDDisplay, threadID, dollProtoco ); } Promise.all(promisearr).then(async (v) => { - let avatar = await getPFP(msg.member); + let avatar = await getPFP(msg.guild.id, msg.member); // Send it! messageSendImg(msg, outtext, avatar ?? msg.member.displayAvatarURL(), dollIDDisplay ? dollIDDisplay : msg.member.displayName, threadID, attachments, modified, isreply, replyobject).then((modifiedmsg) => { // Cleanup after sending @@ -670,7 +670,7 @@ async function sendTheMessage(msg, outtext, dollIDDisplay, threadID, dollProtoco if (outtext.length == 0) { outtext = "Something went wrong. Ping <@125093095405518850> and let her know!"; } - let avatar = await getPFP(msg.member); + let avatar = await getPFP(msg.guild.id, msg.member); // Finally send it! messageSend(msg, outtext, avatar ?? msg.member.displayAvatarURL(), dollIDDisplay ? dollIDDisplay : msg.member.displayName, threadID, modified, isreply, replyobject).then((modifiedmsg) => { // Cleanup after sending. @@ -678,7 +678,7 @@ async function sendTheMessage(msg, outtext, dollIDDisplay, threadID, dollProtoco // If the user violates Doll Protocol, do STUFF if (dollProtocol) { // Punish the doll for being bad. - let dollPunishment = punishDoll(msg.author.id, dollProtocol); + let dollPunishment = punishDoll(msg.guild.id, msg.author.id, dollProtocol); // If the doll was actually punished if (dollPunishment.punish) { diff --git a/functions/headwearfunctions.js b/functions/headwearfunctions.js index d793da39..9baf18a0 100644 --- a/functions/headwearfunctions.js +++ b/functions/headwearfunctions.js @@ -116,11 +116,11 @@ const replaceEmoji = (text, parent, replaceEmoji, msgModified, matchFound) => { const processHeadwearEmoji = (serverID, userID, msgTree, msgModified, dollvisoroverride) => { traceFirstParam(arguments[0]); // Do nothing if no headwear blocks. - if (getHeadwearRestrictions(userID).canEmote) {return;} + if (getHeadwearRestrictions(serverID, userID).canEmote) {return;} let replaceemote = ""; - let wornheadwear = getHeadwear(userID); - let isDoll = getHeadwear(userID).find((headwear) => DOLLVISORS.includes(headwear)) + let wornheadwear = getHeadwear(serverID, userID); + let isDoll = getHeadwear(serverID, userID).find((headwear) => DOLLVISORS.includes(headwear)) if(!isDoll){ // Doll Visors overwrite all other emoji replacements due to codeblock formatting for (let i = 0; i < wornheadwear.length; i++) { if (getHeadwearBlocks(wornheadwear[i]) && getHeadwearBlocks(wornheadwear[i]).replaceemote != undefined) { @@ -302,7 +302,7 @@ const truthgasopposites = (text, parent, msgModified) => { const processHeadwearTruthgas = (serverID, userID, msgTree, msgModified) => { traceFirstParam(arguments[0]); // Do nothing if no headwear blocks. - if (!getHeadwear(userID).includes("gasmask_truthgas")) { return } + if (!getHeadwear(serverID, userID).includes("gasmask_truthgas")) { return } msgTree.callFunc(truthgasopposites, true, undefined, [msgModified]) }; From af6e4ad78580827dd376e3e1f6725fa380b38b28 Mon Sep 17 00:00:00 2001 From: Enraa Date: Fri, 19 Jun 2026 22:25:25 -0700 Subject: [PATCH 19/44] Remainders of innocent youth --- functions/interactivefunctions.js | 192 +++++++++++++++--------------- functions/keyfindingfunctions.js | 80 ++++++------- 2 files changed, 137 insertions(+), 135 deletions(-) diff --git a/functions/interactivefunctions.js b/functions/interactivefunctions.js index e0bca5bb..eac7597d 100644 --- a/functions/interactivefunctions.js +++ b/functions/interactivefunctions.js @@ -36,6 +36,8 @@ const { getToys } = require("./getters/toy/getToys.js"); const { configoptions } = require("../lists/configoptions.js"); const { getChastityName } = require("./getters/chastity/getChastityName.js"); const { traceFirstParam } = require("./other/TESTS/traceFirstParam.js"); +const { canAccessChastityBra } = require("./getters/chastity/canAccessChastityBra.js"); +const { getChastityBraName } = require("./getters/chastity/getChastityBraName.js"); // Generates a consent button which the user will have to agree to. const consentMessage = (interaction, user) => { @@ -99,12 +101,12 @@ This restraint is intended to allow **others** to use **/mitten**, **/chastity** othertext = "keyholder"; } else if (keyholder != interaction.user && !freeuse) { // Other keyholder, NOT free use - keyholderpermissionstext = `You have chosen ${keyholder} to be your keyholder, and will allow ${getPronouns(keyholder.id, "object")} to play with you.`; - othertext = getPronouns(keyholder.id, "object"); + keyholderpermissionstext = `You have chosen ${keyholder} to be your keyholder, and will allow ${getPronouns(interaction.guildId, keyholder.id, "object")} to play with you.`; + othertext = getPronouns(interaction.guildId, keyholder.id, "object"); } else { // Other keyholder, free use - keyholderpermissionstext = `**(Public Access)** You have chosen ${keyholder} to be your keyholder, and will allow ${getPronouns(keyholder.id, "object")} to play with you, in addition to everyone else as public access.`; - othertext = getPronouns(keyholder.id, "object"); + keyholderpermissionstext = `**(Public Access)** You have chosen ${keyholder} to be your keyholder, and will allow ${getPronouns(interaction.guildId, keyholder.id, "object")} to play with you, in addition to everyone else as public access.`; + othertext = getPronouns(interaction.guildId, keyholder.id, "object"); } warningText = `${warningText}\n\nCollars may result in unintended situations such as someone holding your chastity key other than you, or you becoming unable to remove restraints because of heavy bondage.\n\n-# **NOTE:** Extreme Restraints will still prompt as selected in **/config**`; @@ -153,7 +155,7 @@ This restraint is intended to allow **others** to use **/mitten**, **/chastity** // Add labels to modal modal.addTextDisplayComponents(restrictionWarningText).addLabelComponents(keyholderuserlabel, restrictionscheckboxlabel) - if (getOption(interaction.user.id, "publicaccess") != "enabled") { + if (getOption(interaction.guildId, interaction.user.id, "publicaccess") != "enabled") { // They have NOT enabled free use. modal.addTextDisplayComponents(freeusenotenabled) } @@ -200,13 +202,13 @@ This will lock ${wearer}'s chastity belt for a set period of time. Please config .setValue("access_no"), ]; - if (getOption(wearer.id, "publicaccess") != "disabled") { + if (getOption(interaction.guildId, wearer.id, "publicaccess") != "disabled") { accesswhileboundoptions.unshift( new StringSelectMenuOptionBuilder() // Label displayed to user .setLabel("Everyone Else") // Description of option - .setDescription(`Everyone except ${interaction.user.id == wearer.id ? "you" : `${wearer.displayName}`} can vibe and corset ${interaction.user.id == wearer.id ? "you" : `${getPronouns(wearer.id, "object")}`}`) + .setDescription(`Everyone except ${interaction.user.id == wearer.id ? "you" : `${wearer.displayName}`} can vibe and corset ${interaction.user.id == wearer.id ? "you" : `${getPronouns(interaction.guildId, wearer.id, "object")}`}`) // Value returned to you in modal submission .setValue("access_others"), ); @@ -312,13 +314,13 @@ This will lock ${wearer}'s chastity bra for a set period of time. Please configu .setValue("access_no"), ]; - if (getOption(wearer.id, "publicaccess") != "disabled") { + if (getOption(interaction.guildId, wearer.id, "publicaccess") != "disabled") { accesswhileboundoptions.unshift( new StringSelectMenuOptionBuilder() // Label displayed to user .setLabel("Everyone Else") // Description of option - .setDescription(`Everyone except ${interaction.user.id == wearer.id ? "you" : `${wearer.displayName}`} can do things to ${interaction.user.id == wearer.id ? "you" : `${getPronouns(wearer.id, "object")}`}`) + .setDescription(`Everyone except ${interaction.user.id == wearer.id ? "you" : `${wearer.displayName}`} can do things to ${interaction.user.id == wearer.id ? "you" : `${getPronouns(interaction.guildId, wearer.id, "object")}`}`) // Value returned to you in modal submission .setValue("access_others"), ); @@ -424,7 +426,7 @@ This will lock ${wearer}'s collar for a set period of time. Please configure you .setValue("access_no"), ]; - if (getOption(wearer.id, "publicaccess") != "disabled") { + if (getOption(interaction.guildId, earer.id, "publicaccess") != "disabled") { accesswhileboundoptions.unshift( new StringSelectMenuOptionBuilder() // Label displayed to user @@ -589,7 +591,7 @@ const assignMemeImages = () => { // Will immediately resolve if the user allows everyone to remove bondage // else, will prompt them. Will resolve false if rejected. function checkBondageRemoval(serverID, userID, targetID, type, item) { - let useroption = getOption(targetID, "removebondage"); + let useroption = getOption(serverID, targetID, "removebondage"); // Return true immediately if it's accepted without question if (useroption == "accept") { @@ -603,7 +605,7 @@ function checkBondageRemoval(serverID, userID, targetID, type, item) { } // If keyholder and keyholders allowed, return true - if (useroption == "all_binder_and_keyholder" && (canAccessChastity(targetID, userID, true).access || canAccessCollar(targetID, userID, true).access)) { + if (useroption == "all_binder_and_keyholder" && (canAccessChastity(serverID, targetID, userID, true).access || canAccessChastityBra(serverID, targetID, userID, true).access || canAccessCollar(serverID, targetID, userID, true).access)) { return true; } @@ -611,19 +613,19 @@ function checkBondageRemoval(serverID, userID, targetID, type, item) { if (useroption == "all_binder" || useroption == "all_binder_and_keyholder") { let restraintobject; if (type == "heavy") { - restraintobject = getHeavyBinder(targetID, type); + restraintobject = getHeavyBinder(serverID, targetID, type); } if (type == "gag") { restraintobject = getGagBinder(serverID, targetID, item); } if (type == "mitten") { - restraintobject = getMittenBinder(targetID); + restraintobject = getMittenBinder(serverID, targetID); } if (type == "corset") { - restraintobject = getCorsetBinder(targetID); + restraintobject = getCorsetBinder(serverID, targetID); } if (type == "headwear") { - restraintobject = getHeadwearBinder(targetID, item); + restraintobject = getHeadwearBinder(serverID, targetID, item); } // if (type == "vibe") { restraintobject = getVibe(targetID) } @@ -698,7 +700,7 @@ async function handleExtremeRestraint(serverID, user, target, type, restraint) { extrahelptextoverride = configoptions["Extreme"][`extreme-mask-gagharness`]?.prompttext restraint = "gagharness" } - let hasOption = getOption(target.id, `extreme-${type}-${restraint}`); + let hasOption = getOption(serverID, target.id, `extreme-${type}-${restraint}`); if (!hasOption || hasOption == "Enabled" || (hasOption == "PromptOthers" && user.id == target.id)) { res(true); return; @@ -715,7 +717,7 @@ async function handleExtremeRestraint(serverID, user, target, type, restraint) { let restraintfullname = ``; switch (type) { case "collar": - restraintfullname = getCollarName(user, restraint); + restraintfullname = getCollarName(serverID, user, restraint); break; case "heavy": restraintfullname = getHeavyName(restraint); @@ -781,14 +783,14 @@ async function handleExtremeRestraint(serverID, user, target, type, restraint) { // Prompts the target to put on a restraint such as a chastity belt or armbinder. // Will never be available for collars. // Will ALWAYS nag the user unless they're collared for that respective restraint. -async function handleMajorRestraint(user, target, type, restraint) { +async function handleMajorRestraint(serverID, user, target, type, restraint) { traceFirstParam(arguments[0]); return new Promise(async (res, rej) => { - let hasOption = getOption(target.id, `majorrestraint`); - if (canAccessCollar(target.id, user.id).access) { + let hasOption = getOption(serverID, target.id, `majorrestraint`); + if (canAccessCollar(serverID, target.id, user.id).access) { let bondagetype = type; if (type == "chastitybra") { bondagetype = "chastity" } - if (getCollar(target.id) && getCollar(target.id)[bondagetype]) { + if (getCollar(serverID, target.id) && getCollar(serverID, target.id)[bondagetype]) { // User is able to access the collar of the user *and* it has the permission. res(true); return; @@ -826,22 +828,22 @@ async function handleMajorRestraint(user, target, type, restraint) { restraintfullname = getBaseChastity(restraint)?.name; prettytype = "Chastity Belt" emoji = `${process.emojis.chastity}`; - limitationstext = `This will prevent you from using commands to modify relevant toys with **/toy**! Additionally, the restraint will be keyed to ${user} until it is unlocked by ${getPronouns(user.id, "object")}!` + limitationstext = `This will prevent you from using commands to modify relevant toys with **/toy**! Additionally, the restraint will be keyed to ${user} until it is unlocked by ${getPronouns(serverID, user.id, "object")}!` break; case "chastitybra": restraintfullname = getBaseChastity(restraint)?.name; prettytype = "Chastity Bra" emoji = `${process.emojis.chastitybra}`; - limitationstext = `This will prevent you from using commands to modify relevant toy on your breasts with **/toy**! Additionally, the restraint will be keyed to ${user} until it is unlocked by ${getPronouns(user.id, "object")}!` + limitationstext = `This will prevent you from using commands to modify relevant toy on your breasts with **/toy**! Additionally, the restraint will be keyed to ${user} until it is unlocked by ${getPronouns(serverID, user.id, "object")}!` break; case "mitten": - restraintfullname = getMittenName(undefined, restraint) ?? "Standard Mittens"; + restraintfullname = getMittenName(serverID, undefined, restraint) ?? "Standard Mittens"; prettytype = "Mittens" emoji = `${process.emojis.mitten}`; limitationstext = `This will prevent you from adding or removing gags with **/gag** or masks with **/mask** until someone else unmittens you!` break; case "mask": - restraintfullname = getHeadwearName(undefined, restraint); + restraintfullname = getHeadwearName(serverID, undefined, restraint); prettytype = "Mask" emoji = `${process.emojis.gasmask}`; limitationstext = `This may have a major effect on your speech or emoji, as well as blinding you in **/inspect**!` @@ -1026,13 +1028,13 @@ async function generateKeyGivingModal(serverID, userid, weareridin, targetidin, let giveclonecap = `${giveclone.slice(0,1).toUpperCase()}${giveclone.slice(1)}` // Reset any keybits we became ineligible for - if ((getChastity(wearerid)?.keyholder != userid) || (getChastity(wearerid)?.clonedKeyholders && getChastity(wearerid)?.clonedKeyholders.includes(targetid)) || (getChastity(wearerid)?.fumbled)) { + if ((getChastity(serverID, wearerid)?.keyholder != userid) || (getChastity(serverID, wearerid)?.clonedKeyholders && getChastity(serverID, wearerid)?.clonedKeyholders.includes(targetid)) || (getChastity(serverID, wearerid)?.fumbled)) { keybit = `${keybit.slice(0,1)}0${keybit.slice(2)}` } - if ((getChastityBra(wearerid)?.keyholder != userid) || (getChastityBra(wearerid)?.clonedKeyholders && getChastityBra(wearerid)?.clonedKeyholders.includes(targetid)) || (getChastityBra(wearerid)?.fumbled)) { + if ((getChastityBra(serverID, wearerid)?.keyholder != userid) || (getChastityBra(serverID, wearerid)?.clonedKeyholders && getChastityBra(serverID, wearerid)?.clonedKeyholders.includes(targetid)) || (getChastityBra(serverID, wearerid)?.fumbled)) { keybit = `${keybit.slice(0,2)}0${keybit.slice(3)}` } - if ((getCollar(wearerid)?.keyholder != userid) || (getCollar(wearerid)?.clonedKeyholders && getCollar(wearerid)?.clonedKeyholders.includes(targetid)) || (getCollar(wearerid)?.fumbled)) { + if ((getCollar(serverID, wearerid)?.keyholder != userid) || (getCollar(serverID, wearerid)?.clonedKeyholders && getCollar(serverID, wearerid)?.clonedKeyholders.includes(targetid)) || (getCollar(serverID, wearerid)?.fumbled)) { keybit = `${keybit.slice(0,3)}0` } @@ -1064,20 +1066,20 @@ async function generateKeyGivingModal(serverID, userid, weareridin, targetidin, // Restraint components! let restraintcomponents = []; - if (getChastity(wearerid)) { + if (getChastity(serverID, wearerid)) { let keyholdertext = ``; - keyholdertext = `<@${getChastity(wearerid).keyholder}>` - if (getChastityTimelock(wearerid)) { keyholdertext = `Timelocked` } - if (getChastity(wearerid).keyholder == wearerid) { keyholdertext = `Self-bound` } - if (getChastity(wearerid)?.fumbled) { keyholdertext = `Keys are missing!` } - let clonetext = (getChastity(wearerid).clonedKeyholders && getChastity(wearerid).clonedKeyholders.length > 0) ? `\n**Cloned Keys:** ${getChastity(wearerid).clonedKeyholders.map((k) => `<@${k}>`).join(", ")}` : `` - let notholding = (!(getChastity(wearerid).keyholder == userid) || getChastity(wearerid).fumbled) ? "\n***šŸ”’ You are not holding the primary keys to this restraint***" : "" + keyholdertext = `<@${getChastity(serverID, wearerid).keyholder}>` + if (getChastityTimelock(serverID, wearerid)) { keyholdertext = `Timelocked` } + if (getChastity(serverID, wearerid).keyholder == wearerid) { keyholdertext = `Self-bound` } + if (getChastity(serverID, wearerid)?.fumbled) { keyholdertext = `Keys are missing!` } + let clonetext = (getChastity(serverID, wearerid).clonedKeyholders && getChastity(serverID, wearerid).clonedKeyholders.length > 0) ? `\n**Cloned Keys:** ${getChastity(serverID, wearerid).clonedKeyholders.map((k) => `<@${k}>`).join(", ")}` : `` + let notholding = (!(getChastity(serverID, wearerid).keyholder == userid) || getChastity(serverID, wearerid).fumbled) ? "\n***šŸ”’ You are not holding the primary keys to this restraint***" : "" let blocked = false; - if ((getChastity(wearerid).keyholder != userid) || (getChastity(wearerid).clonedKeyholders && getChastity(wearerid).clonedKeyholders.includes(targetid)) || (getChastity(wearerid).fumbled)) { + if ((getChastity(serverID, wearerid).keyholder != userid) || (getChastity(serverID, wearerid).clonedKeyholders && getChastity(serverID, wearerid).clonedKeyholders.includes(targetid)) || (getChastity(serverID, wearerid).fumbled)) { blocked = true; } let buttonsection = new SectionBuilder() - .addTextDisplayComponents((textdisplay) => textdisplay.setContent(`## ${process.emojis.chastity} Chastity - ${getChastityName(wearerid, getChastity(wearerid).chastitytype) ?? "Standard Chastity Belt"}\n**Primary Keyholder:** ${keyholdertext}${clonetext}${notholding}\nā€Ž`)) + .addTextDisplayComponents((textdisplay) => textdisplay.setContent(`## ${process.emojis.chastity} Chastity - ${getChastityName(serverID, wearerid, getChastity(serverID, wearerid).chastitytype) ?? "Standard Chastity Belt"}\n**Primary Keyholder:** ${keyholdertext}${clonetext}${notholding}\nā€Ž`)) .setButtonAccessory((button) => button .setCustomId(`key_key_chastity_${wearerid}_${targetid}_${keybitin}`) @@ -1087,20 +1089,20 @@ async function generateKeyGivingModal(serverID, userid, weareridin, targetidin, ); restraintcomponents.push(buttonsection) } - if (getChastityBra(wearerid)) { + if (getChastityBra(serverID, wearerid)) { let keyholdertext = ``; - keyholdertext = `<@${getChastityBra(wearerid).keyholder}>` - if (getChastityBraTimelock(wearerid)) { keyholdertext = `Timelocked` } - if (getChastityBra(wearerid).keyholder == wearerid) { keyholdertext = `Self-bound` } - if (getChastityBra(wearerid)?.fumbled) { keyholdertext = `Keys are missing!` } - let clonetext = (getChastityBra(wearerid).clonedKeyholders && getChastityBra(wearerid).clonedKeyholders.length > 0) ? `\n**Cloned Keys:** ${getChastityBra(wearerid).clonedKeyholders.map((k) => `<@${k}>`).join(", ")}` : `` - let notholding = (!(getChastityBra(wearerid).keyholder == userid) || getChastityBra(wearerid).fumbled) ? "\n***šŸ”’ You are not holding the primary keys to this restraint***" : "" + keyholdertext = `<@${getChastityBra(serverID, wearerid).keyholder}>` + if (getChastityBraTimelock(serverID, wearerid)) { keyholdertext = `Timelocked` } + if (getChastityBra(serverID, wearerid).keyholder == wearerid) { keyholdertext = `Self-bound` } + if (getChastityBra(serverID, wearerid)?.fumbled) { keyholdertext = `Keys are missing!` } + let clonetext = (getChastityBra(serverID, wearerid).clonedKeyholders && getChastityBra(serverID, wearerid).clonedKeyholders.length > 0) ? `\n**Cloned Keys:** ${getChastityBra(serverID, wearerid).clonedKeyholders.map((k) => `<@${k}>`).join(", ")}` : `` + let notholding = (!(getChastityBra(serverID, wearerid).keyholder == userid) || getChastityBra(serverID, wearerid).fumbled) ? "\n***šŸ”’ You are not holding the primary keys to this restraint***" : "" let blocked = false; - if ((getChastityBra(wearerid).keyholder != userid) || (getChastityBra(wearerid).clonedKeyholders && getChastityBra(wearerid).clonedKeyholders.includes(targetid)) || (getChastityBra(wearerid).fumbled)) { + if ((getChastityBra(serverID, wearerid).keyholder != userid) || (getChastityBra(serverID, wearerid).clonedKeyholders && getChastityBra(serverID, wearerid).clonedKeyholders.includes(targetid)) || (getChastityBra(serverID, wearerid).fumbled)) { blocked = true; } let buttonsection = new SectionBuilder() - .addTextDisplayComponents((textdisplay) => textdisplay.setContent(`## ${process.emojis.chastitybra} Chastity Bra - ${getChastityBraName(wearerid, getChastityBra(wearerid).chastitytype) ?? "Standard Chastity Bra"}\n**Primary Keyholder:** ${keyholdertext}${clonetext}${notholding}\nā€Ž`)) + .addTextDisplayComponents((textdisplay) => textdisplay.setContent(`## ${process.emojis.chastitybra} Chastity Bra - ${getChastityBraName(serverID, wearerid, getChastityBra(serverID, wearerid).chastitytype) ?? "Standard Chastity Bra"}\n**Primary Keyholder:** ${keyholdertext}${clonetext}${notholding}\nā€Ž`)) .setButtonAccessory((button) => button .setCustomId(`key_key_chastitybra_${wearerid}_${targetid}_${keybitin}`) @@ -1110,20 +1112,20 @@ async function generateKeyGivingModal(serverID, userid, weareridin, targetidin, ); restraintcomponents.push(buttonsection) } - if (getCollar(wearerid)) { + if (getCollar(serverID, wearerid)) { let keyholdertext = ``; - keyholdertext = `<@${getCollar(wearerid).keyholder}>` - if (getCollarTimelock(wearerid)) { keyholdertext = `Timelocked` } - if (getCollar(wearerid).keyholder == wearerid) { keyholdertext = `Self-bound` } - if (getCollar(wearerid)?.fumbled) { keyholdertext = `Keys are missing!` } - let clonetext = (getCollar(wearerid).clonedKeyholders && getCollar(wearerid).clonedKeyholders.length > 0) ? `\n**Cloned Keys:** ${getCollar(wearerid).clonedKeyholders.map((k) => `<@${k}>`).join(", ")}` : `` - let notholding = (!(getCollar(wearerid).keyholder == userid) || getCollar(wearerid).fumbled) ? "\n***šŸ”’ You are not holding the primary keys to this restraint***" : "" + keyholdertext = `<@${getCollar(serverID, wearerid).keyholder}>` + if (getCollarTimelock(serverID, wearerid)) { keyholdertext = `Timelocked` } + if (getCollar(serverID, wearerid).keyholder == wearerid) { keyholdertext = `Self-bound` } + if (getCollar(serverID, wearerid)?.fumbled) { keyholdertext = `Keys are missing!` } + let clonetext = (getCollar(serverID, wearerid).clonedKeyholders && getCollar(serverID, wearerid).clonedKeyholders.length > 0) ? `\n**Cloned Keys:** ${getCollar(serverID, wearerid).clonedKeyholders.map((k) => `<@${k}>`).join(", ")}` : `` + let notholding = (!(getCollar(serverID, wearerid).keyholder == userid) || getCollar(serverID, wearerid).fumbled) ? "\n***šŸ”’ You are not holding the primary keys to this restraint***" : "" let blocked = false; - if ((getCollar(wearerid).keyholder != userid) || (getCollar(wearerid).clonedKeyholders && getCollar(wearerid).clonedKeyholders.includes(targetid)) || (getCollar(wearerid).fumbled)) { + if ((getCollar(serverID, wearerid).keyholder != userid) || (getCollar(serverID, wearerid).clonedKeyholders && getCollar(serverID, wearerid).clonedKeyholders.includes(targetid)) || (getCollar(serverID, wearerid).fumbled)) { blocked = true; } let buttonsection = new SectionBuilder() - .addTextDisplayComponents((textdisplay) => textdisplay.setContent(`## ${process.emojis.collar} Collar - ${getCollarName(wearerid, getCollar(wearerid).chastitytype) ?? "Leather Collar"}\n**Primary Keyholder:** ${keyholdertext}${clonetext}${notholding}\nā€Ž`)) + .addTextDisplayComponents((textdisplay) => textdisplay.setContent(`## ${process.emojis.collar} Collar - ${getCollarName(serverID, wearerid, getCollar(serverID, wearerid).chastitytype) ?? "Leather Collar"}\n**Primary Keyholder:** ${keyholdertext}${clonetext}${notholding}\nā€Ž`)) .setButtonAccessory((button) => button .setCustomId(`key_key_collar_${wearerid}_${targetid}_${keybitin}`) @@ -1181,9 +1183,9 @@ async function generateKeyGivingModal(serverID, userid, weareridin, targetidin, // Determine if we can give the keys. The rules are, if it's SELF or if they auto accepted, it should say give/clone // otherwise, it should say request. let allowedtext = `Request to ${giveclonecap} Keys` - if (((getOption(wearerid, "keygiving") == "auto") && (keybit.charAt(0) == "0")) || - ((getOption(wearerid, "keycloning") == "auto") && (keybit.charAt(0) == "1"))) { - allowedtext = `${giveclonecap} ${getPronouns(wearerid, "possessiveDeterminer")} Keys` + if (((getOption(serverID, wearerid, "keygiving") == "auto") && (keybit.charAt(0) == "0")) || + ((getOption(serverID, wearerid, "keycloning") == "auto") && (keybit.charAt(0) == "1"))) { + allowedtext = `${giveclonecap} ${getPronouns(serverID, wearerid, "possessiveDeterminer")} Keys` } if ((userid == wearerid) || (wearerid == targetid)) { // This is us, we are probably okay with what we're about to do. @@ -1192,8 +1194,8 @@ async function generateKeyGivingModal(serverID, userid, weareridin, targetidin, // Determine if the wearer blocked keygiving. If they did, no. let allowedbool = false; - if (((getOption(wearerid, "keygiving") == "disabled") && (keybit.charAt(0) == "0")) || - ((getOption(wearerid, "keycloning") == "disabled") && (keybit.charAt(0) == "1"))) { + if (((getOption(serverID, wearerid, "keygiving") == "disabled") && (keybit.charAt(0) == "0")) || + ((getOption(serverID, wearerid, "keycloning") == "disabled") && (keybit.charAt(0) == "1"))) { allowedbool = true; } if ((keybit.slice(1).search(1) == -1)) { @@ -1285,54 +1287,54 @@ async function generateExtraConfig(interaction, userid, itemname, force) { } }); // Headwear - getHeadwear(userid).forEach(async (h) => { + getHeadwear(interaction.guildId, userid).forEach(async (h) => { console.log(itemname) if ((h == itemname) && process.eventfunctions.headwear && process.eventfunctions.headwear[h] && process.eventfunctions.headwear[h].extraconfig) { interactionoutput.push(await process.eventfunctions.headwear[h].extraconfig(interaction, userid, itemname)); } }); // Mittens - if (getMitten(userid)) { - if ((getMitten(userid).mittenname == itemname) && process.eventfunctions.mitten && process.eventfunctions.mitten[getMitten(userid).mittenname] && process.eventfunctions.mitten[getMitten(userid).mittenname].extraconfig) { - interactionoutput.push(await process.eventfunctions.mitten[getMitten(userid).mittenname].extraconfig(interaction, userid, itemname)); + if (getMitten(interaction.guildId, userid)) { + if ((getMitten(userid).mittenname == itemname) && process.eventfunctions.mitten && process.eventfunctions.mitten[getMitten(interaction.guildId, userid).mittenname] && process.eventfunctions.mitten[getMitten(interaction.guildId, userid).mittenname].extraconfig) { + interactionoutput.push(await process.eventfunctions.mitten[getMitten(interaction.guildId, userid).mittenname].extraconfig(interaction, userid, itemname)); } } // Heavy Bondage - if (getHeavyList(userid).length > 0) { - getHeavyList(userid).forEach(async (h) => { + if (getHeavyList(interaction.guildId, userid).length > 0) { + getHeavyList(interaction.guildId, userid).forEach(async (h) => { if ((h.type == itemname) && process.eventfunctions.heavy && process.eventfunctions.heavy[h.type] && process.eventfunctions.heavy[h.type].extraconfig) { interactionoutput.push(await process.eventfunctions.heavy[h.type].extraconfig(interaction, userid, itemname)); } }) } // Chastity Belts - if (getChastity(userid)) { - if ((getChastity(userid).chastitytype == itemname) && process.eventfunctions.chastity && process.eventfunctions.chastity[getChastity(userid).chastitytype] && process.eventfunctions.chastity[getChastity(userid).chastitytype].extraconfig) { - interactionoutput.push(await process.eventfunctions.chastity[getChastity(userid).chastitytype].extraconfig(interaction, userid, itemname)); + if (getChastity(interaction.guildId, userid)) { + if ((getChastity(interaction.guildId, userid).chastitytype == itemname) && process.eventfunctions.chastity && process.eventfunctions.chastity[getChastity(interaction.guildId, userid).chastitytype] && process.eventfunctions.chastity[getChastity(interaction.guildId, userid).chastitytype].extraconfig) { + interactionoutput.push(await process.eventfunctions.chastity[getChastity(interaction.guildId, userid).chastitytype].extraconfig(interaction, userid, itemname)); } } // Chastity Bras - if (getChastityBra(userid)) { - if ((getChastityBra(userid).chastitytype == itemname) && process.eventfunctions.chastitybra && process.eventfunctions.chastitybra[getChastityBra(userid).chastitytype] && process.eventfunctions.chastitybra[getChastityBra(userid).chastitytype].extraconfig) { - interactionoutput.push(await process.eventfunctions.chastitybra[getChastityBra(userid).chastitytype].extraconfig(interaction, userid, itemname)); + if (getChastityBra(interaction.guildId, userid)) { + if ((getChastityBra(interaction.guildId, userid).chastitytype == itemname) && process.eventfunctions.chastitybra && process.eventfunctions.chastitybra[getChastityBra(interaction.guildId, userid).chastitytype] && process.eventfunctions.chastitybra[getChastityBra(interaction.guildId, userid).chastitytype].extraconfig) { + interactionoutput.push(await process.eventfunctions.chastitybra[getChastityBra(interaction.guildId, userid).chastitytype].extraconfig(interaction, userid, itemname)); } } // Wearables - getWearable(userid).forEach(async (h) => { + getWearable(interaction.guildId, userid).forEach(async (h) => { if ((h == itemname) && process.eventfunctions.wearable && process.eventfunctions.wearable[h] && process.eventfunctions.wearable[h].extraconfig) { interactionoutput.push(await process.eventfunctions.wearable[h].extraconfig(interaction, userid, itemname)); } }); // Toys - getToys(userid).forEach(async (h) => { + getToys(interaction.guildId, userid).forEach(async (h) => { if ((h.type == itemname) && process.eventfunctions.toys && process.eventfunctions.toys[h.type] && process.eventfunctions.toys[h.type].extraconfig) { interactionoutput.push(await process.eventfunctions.toys[h.type].extraconfig(interaction, userid, itemname)); } }); // Collars - if (getCollar(userid)) { - if ((getCollar(userid).collartype == itemname) && process.eventfunctions.collar && process.eventfunctions.collar[getCollar(userid).collartype] && process.eventfunctions.collar[getCollar(userid).collartype]) { - interactionoutput.push(await process.eventfunctions.collar[getCollar(userid).collartype].extraconfig(interaction, userid, itemname)); + if (getCollar(interaction.guildId, userid)) { + if ((getCollar(interaction.guildId, userid).collartype == itemname) && process.eventfunctions.collar && process.eventfunctions.collar[getCollar(interaction.guildId, userid).collartype] && process.eventfunctions.collar[getCollar(interaction.guildId, userid).collartype]) { + interactionoutput.push(await process.eventfunctions.collar[getCollar(interaction.guildId, userid).collartype].extraconfig(interaction, userid, itemname)); } } } @@ -1345,54 +1347,54 @@ async function generateExtraConfig(interaction, userid, itemname, force) { } }); // Headwear - getHeadwear(userid).forEach(async (h) => { + getHeadwear(interaction.guildId, userid).forEach(async (h) => { console.log(itemname) if ((h == itemname) && process.eventfunctions.headwear && process.eventfunctions.headwear[h] && process.eventfunctions.headwear[h].extraconfig) { interactionoutput.push(await process.eventfunctions.headwear[h].extraconfig(interaction, userid, itemname)); } }); // Mittens - if (getMitten(userid)) { - if ((getMitten(userid).mittenname == itemname) && process.eventfunctions.mitten && process.eventfunctions.mitten[getMitten(userid).mittenname] && process.eventfunctions.mitten[getMitten(userid).mittenname].extraconfig) { - interactionoutput.push(await process.eventfunctions.mitten[getMitten(userid).mittenname].extraconfig(interaction, userid, itemname)); + if (getMitten(interaction.guildId, userid)) { + if ((getMitten(interaction.guildId, userid).mittenname == itemname) && process.eventfunctions.mitten && process.eventfunctions.mitten[getMitten(interaction.guildId, userid).mittenname] && process.eventfunctions.mitten[getMitten(interaction.guildId, userid).mittenname].extraconfig) { + interactionoutput.push(await process.eventfunctions.mitten[getMitten(interaction.guildId, userid).mittenname].extraconfig(interaction, userid, itemname)); } } // Heavy Bondage - if (getHeavyList(userid).length > 0) { - getHeavyList(userid).forEach(async (h) => { + if (getHeavyList(interaction.guildId, userid).length > 0) { + getHeavyList(interaction.guildId, userid).forEach(async (h) => { if ((h.type == itemname) && process.eventfunctions.heavy && process.eventfunctions.heavy[h.type] && process.eventfunctions.heavy[h.type].extraconfig) { interactionoutput.push(await process.eventfunctions.heavy[h.type].extraconfig(interaction, userid, itemname)); } }) } // Chastity Belts - if (getChastity(userid)) { - if ((getChastity(userid).chastitytype == itemname) && process.eventfunctions.chastity && process.eventfunctions.chastity[getChastity(userid).chastitytype] && process.eventfunctions.chastity[getChastity(userid).chastitytype].extraconfig) { - interactionoutput.push(await process.eventfunctions.chastity[getChastity(userid).chastitytype].extraconfig(interaction, userid, itemname)); + if (getChastity(interaction.guildId, userid)) { + if ((getChastity(interaction.guildId, userid).chastitytype == itemname) && process.eventfunctions.chastity && process.eventfunctions.chastity[getChastity(interaction.guildId, userid).chastitytype] && process.eventfunctions.chastity[getChastity(interaction.guildId, userid).chastitytype].extraconfig) { + interactionoutput.push(await process.eventfunctions.chastity[getChastity(interaction.guildId, userid).chastitytype].extraconfig(interaction, userid, itemname)); } } // Chastity Bras - if (getChastityBra(userid)) { - if ((getChastityBra(userid).chastitytype == itemname) && process.eventfunctions.chastitybra && process.eventfunctions.chastitybra[getChastityBra(userid).chastitytype] && process.eventfunctions.chastitybra[getChastityBra(userid).chastitytype].extraconfig) { - interactionoutput.push(await process.eventfunctions.chastitybra[getChastityBra(userid).chastitytype].extraconfig(interaction, userid, itemname)); + if (getChastityBra(interaction.guildId, userid)) { + if ((getChastityBra(interaction.guildId, userid).chastitytype == itemname) && process.eventfunctions.chastitybra && process.eventfunctions.chastitybra[getChastityBra(interaction.guildId, userid).chastitytype] && process.eventfunctions.chastitybra[getChastityBra(interaction.guildId, userid).chastitytype].extraconfig) { + interactionoutput.push(await process.eventfunctions.chastitybra[getChastityBra(interaction.guildId, userid).chastitytype].extraconfig(interaction, userid, itemname)); } } // Wearables - getWearable(userid).forEach(async (h) => { + getWearable(interaction.guildId, userid).forEach(async (h) => { if ((h == itemname) && process.eventfunctions.wearable && process.eventfunctions.wearable[h] && process.eventfunctions.wearable[h].extraconfig) { interactionoutput.push(await process.eventfunctions.wearable[h].extraconfig(interaction, userid, itemname)); } }); // Toys - getToys(userid).forEach(async (h) => { + getToys(interaction.guildId, userid).forEach(async (h) => { if ((h.type == itemname) && process.eventfunctions.toys && process.eventfunctions.toys[h.type] && process.eventfunctions.toys[h.type].extraconfig) { interactionoutput.push(await process.eventfunctions.toys[h.type].extraconfig(interaction, userid, itemname)); } }); // Collars - if (getCollar(userid)) { - if ((getCollar(userid).collartype == itemname) && process.eventfunctions.collar && process.eventfunctions.collar[getCollar(userid).collartype] && process.eventfunctions.collar[getCollar(userid).collartype]) { - interactionoutput.push(await process.eventfunctions.collar[getCollar(userid).collartype].extraconfig(interaction, userid, itemname)); + if (getCollar(interaction.guildId, userid)) { + if ((getCollar(interaction.guildId, userid).collartype == itemname) && process.eventfunctions.collar && process.eventfunctions.collar[getCollar(interaction.guildId, userid).collartype] && process.eventfunctions.collar[getCollar(interaction.guildId, userid).collartype]) { + interactionoutput.push(await process.eventfunctions.collar[getCollar(interaction.guildId, userid).collartype].extraconfig(interaction, userid, itemname)); } } } diff --git a/functions/keyfindingfunctions.js b/functions/keyfindingfunctions.js index d898d41a..c18b9614 100644 --- a/functions/keyfindingfunctions.js +++ b/functions/keyfindingfunctions.js @@ -34,7 +34,7 @@ function rollKeyFumble(serverID, keyholder, locked) { } // get the initial fumble chance - let fumbleChance = getFumbleChance(keyholder, locked); + let fumbleChance = getFumbleChance(serverID, keyholder, locked); if (process.forcefumble) { process.forcefumble = false; @@ -49,27 +49,25 @@ function rollKeyFumble(serverID, keyholder, locked) { if (Math.random() < Math.min(fumbleChance, MAX_FUMBLE_CHANCE)) { // They fumbled, lets work with that. // Push the chance they had to fumble to blessings - if (getOption(keyholder, "blessed-luck") == "enabled") { + if (getOption(serverID, keyholder, "blessed-luck") == "enabled") { // if they use blessed luck, add the success chance to their saved blessing - const blessing = getUserVar(keyholder, "blessed") ?? 0; - setUserVar(keyholder, "blessing", blessing + 1 - fumbleChance); + const blessing = getUserVar(serverID, keyholder, "blessed") ?? 0; + setUserVar(serverID, keyholder, "blessing", blessing + 1 - fumbleChance); } // fumbling is frustrating - const penalties = frustrationPenalties.get(keyholder) ?? []; + const penalties = frustrationPenalties.get(`${serverID}_${keyholder}`) ?? []; penalties.push({ timestamp: Date.now(), value: 15, decay: 2 }); - frustrationPenalties.set(keyholder, penalties); - - console.log(Math.max(0.05, (Math.min((fumbleChance / 2.5), MAX_FUMBLE_CHANCE)))) + frustrationPenalties.set(`${serverID}_${keyholder}`, penalties); // Reduce further fumble chance to some % of the fumble chance // Further fumbles have at LEAST 5% chance to happen and AT MOST 95% chance to happen. if (Math.random() < Math.max(0.05, (Math.min((fumbleChance / 2.5), MAX_FUMBLE_CHANCE)))) { // CASCADE OF FAILURES // Dropping the key is even more frustrating. - const penalties = frustrationPenalties.get(keyholder) ?? []; + const penalties = frustrationPenalties.get(`${serverID}_${keyholder}`) ?? []; penalties.push({ timestamp: Date.now(), value: 15, decay: 2 }); - frustrationPenalties.set(keyholder, penalties); + frustrationPenalties.set(`${serverID}_${keyholder}`, penalties); markForSave("collar"); markForSave("chastity"); @@ -89,15 +87,15 @@ function rollKeyFumble(serverID, keyholder, locked) { function getFumbleChance(serverID, keyholder, locked) { traceFirstParam(arguments[0]); // cannot fumble if disabled - if (getOption(locked, "fumbling") == "disabled") return 0; + if (getOption(serverID, locked, "fumbling") == "disabled") return 0; // ... or if not using the dynamic arousal system - if (getOption(locked, "arousalsystem") != 2) return 0; + if (getOption(serverID, locked, "arousalsystem") != 2) return 0; // ... or if it's someone else and either has disable fumbling for others - if ((keyholder != locked) && ((getOption(keyholder, "fumbling") != "everyone") || (getOption(locked, "fumbling") != "everyone"))) return 0; + if ((keyholder != locked) && ((getOption(serverID, keyholder, "fumbling") != "everyone") || (getOption(serverID, locked, "fumbling") != "everyone"))) return 0; // Add frustration if trying to unlock OWN device // Idk why frustration is broken apparently, but w/e, can fix later. - let frustrationaddition = (locked == keyholder) ? calcFrustration(keyholder) : 0; + let frustrationaddition = (locked == keyholder) ? calcFrustration(serverID, keyholder) : 0; // "simple" math that models a simple quadratic equation // Target numbers are 15 arousal = 0, 150 arousal = 100 @@ -107,13 +105,13 @@ function getFumbleChance(serverID, keyholder, locked) { let chance = Math.max(0, (((0.0045 + frustrationaddition * 0.0004) * Math.pow(getArousal(serverID, locked), 2) - 1) + (frustrationaddition / 100))) // chance is increased if the keyholder is wearing mittens - if (getMitten(keyholder)) { + if (getMitten(serverID, keyholder)) { chance *= 1.1; chance += 10; } // reduce the fumble chance by saved up blessing from prior unlucky rolls - if (getOption(keyholder, "blessed-luck") == "enabled") chance -= getUserVar(keyholder, "blessed") ?? 0; + if (getOption(serverID, keyholder, "blessed-luck") == "enabled") chance -= getUserVar(serverID, keyholder, "blessed") ?? 0; // divine intervention if (Math.random() < 0.02) chance -= 50; @@ -127,11 +125,12 @@ async function handleKeyFinding(message) { let processvars = ["collar", "chastity", "chastitybra"]; processvars.forEach((pv) => { if (process[pv] == undefined) { process[pv] = {} } - Object.entries(process[pv]).forEach(async (en) => { + if (process[pv][message.guild.id] == undefined) { process[pv][message.guild.id] = {} } + Object.entries(process[pv][message.guild.id]).forEach(async (en) => { try { if (en[1]?.fumbled && !en[1]?.temporarykeyholder) { if (Math.random() < (Math.max(Math.min(message.content.length * 0.0005, 0.3), process.forcefindkey ? 1.0 : 0.01))) { - if (process.recentmessages[en[0]] != message.channel.id) { + if (process.recentmessages[message.guild.id][en[0]] != message.channel.id) { // Even if we succeeded the roll, just leave. The wearer needs to be present for their key to be found // This implicitly protects against finding the key on another server or on threads the wearer isnt in. return @@ -145,16 +144,16 @@ async function handleKeyFinding(message) { // Now an append if they're in mittens or heavy bondage let extrafindkeypart = ""; let chance = 1.0 - if (getMitten(message.member.id)) { + if (getMitten(message.guild.id, message.member.id)) { chance = 0.5; extrafindkeypart = "_mitten" } - if (getHeavy(message.member.id)) { + if (getHeavy(message.guild.id, message.member.id)) { chance = 0.0; extrafindkeypart = "_heavy" } // Blind people cannot see. - if (!getHeadwearRestrictions(message.member.id).canInspect) { + if (!getHeadwearRestrictions(message.guild.id, message.member.id).canInspect) { chance = Math.min(chance, 0.25) } let data = { @@ -176,9 +175,9 @@ async function handleKeyFinding(message) { // Successfully found the key! messageSendChannel(getTextGeneric(`find_key_${finderpart}${extrafindkeypart}`, data), message.channel.id) // Delete the Fumbled date. - delete process[pv][en[0]].fumbled; + delete process[pv][message.guild.id][en[0]].fumbled; - statsAddCounter(message.member.id, "fumbledkeysrecovered") + statsAddCounter(message.guild.id, message.member.id, "fumbledkeysrecovered") markForSave("collar"); markForSave("chastity"); markForSave("chastitybra"); @@ -186,7 +185,7 @@ async function handleKeyFinding(message) { else { // Fumbled finding the key lol messageSendChannel(getTextGeneric(`find_keyfail_${finderpart}${extrafindkeypart}`, data), message.channel.id) - statsAddCounter(message.member.id, "fumbledkeysfailedtorecover") + statsAddCounter(message.guild.id, message.member.id, "fumbledkeysfailedtorecover") } } // Case 2: We spot our own key... we wont be able to do anything about it though, our keyholder needs to find the key! @@ -195,29 +194,29 @@ async function handleKeyFinding(message) { data.targetuser = await message.guild.members.fetch(en[1].keyholder) // Use the keyholder object to bring that into scope // @___ spots the key to her chastity belt! She tries to point it out to @___ but they're unable to find it... messageSendChannel(getTextGeneric(`spot_key_self`, data), message.channel.id) - statsAddCounter(message.member.id, "fumbledkeysfailedtorecover") + statsAddCounter(message.guild.id, message.member.id, "fumbledkeysfailedtorecover") } // Case 3: We can find keys but the person whose restraint it is does NOT want us to find their key // Simply send a message hinting at a sparkle. - else if ((getOption(message.member.id, "findkeymode") == "others") && (getOption(en[0], "ownrestraintfindkeymode") == "onlykh")) { + else if ((getOption(message.guild.id, message.member.id, "findkeymode") == "others") && (getOption(message.guild.id, en[0], "ownrestraintfindkeymode") == "onlykh")) { // @___ *thinks* she sees a little glimmer that looks like @___'s chastity belt key, but the moment she blinks, it disappears again... messageSendChannel(getTextGeneric(`spot_key_other`, data), message.channel.id) - statsAddCounter(message.member.id, "fumbledkeysfailedtorecover") + statsAddCounter(message.guild.id, message.member.id, "fumbledkeysfailedtorecover") } // Case 4: We can find keys and the person whose restraint it is DOES want us to find their key. // This will result in giving us keyholder using the .temporarykeyholder prop and .temporarykeyholdertime. This MUST be set and checked every bot tick to clear. - else if ((getOption(message.member.id, "findkeymode") == "others") && (getOption(en[0], "ownrestraintfindkeymode") != "onlykh")) { + else if ((getOption(message.guild.id, message.member.id, "findkeymode") == "others") && (getOption(message.guild.id, en[0], "ownrestraintfindkeymode") != "onlykh")) { if (Math.random() < chance) { // Successfully found the key! - if (getOption(en[0], "ownrestraintfindkeymode") == 0) { + if (getOption(message.guild.id, en[0], "ownrestraintfindkeymode") == 0) { messageSendChannel(getTextGeneric(`find_key_otherimmediately${extrafindkeypart}`, data), message.channel.id) - delete process[pv][en[0]].fumbled; + delete process[pv][message.guild.id][en[0]].fumbled; } else { messageSendChannel(getTextGeneric(`find_key_${finderpart}${extrafindkeypart}`, data), message.channel.id) // Set temporary keyholder! - process[pv][en[0]].temporarykeyholder = message.member.id; - process[pv][en[0]].temporarykeyholdertime = (Date.now() + getOption(en[0], "ownrestraintfindkeymode")) + process[pv][message.guild.id][en[0]].temporarykeyholder = message.member.id; + process[pv][message.guild.id][en[0]].temporarykeyholdertime = (Date.now() + getOption(message.guild.id, en[0], "ownrestraintfindkeymode")) } statsAddCounter(message.member.id, "fumbledkeysrecovered") markForSave("collar"); @@ -243,29 +242,30 @@ async function handleKeyFinding(message) { } // Discards a key held by keyholderid for userid. Varying effect based on device. -function discardKey(userid, keyholderid, device) { +function discardKey(serverID, userid, keyholderid, device) { // If it isnt one of the three devices we know about, go away if ((device != "collar") && (device != "chastity belt") && (device != "chastity bra")) { console.log(`Unknown device ${device}. Use "collar", "chastity belt" or "chastity bra"`) return false } - statsAddCounter(keyholderid, "fumbledkeys") - statsAddCounter(userid, "restraintkeysfumbled") + statsAddCounter(serverID, keyholderid, "fumbledkeys") + statsAddCounter(serverID, userid, "restraintkeysfumbled") let processvar = "collar"; if (device == "chastity belt") { processvar = "chastity" } if (device == "chastity bra") { processvar = "chastitybra" } // If this is undefined, we have some big problems lol let typelocked = "none"; if (process[processvar] == undefined) { process[processvar] = {} } - if (process[processvar][userid]) { - if (process[processvar][userid].keyholder == keyholderid) { + if (process[processvar][serverID] == undefined) { process[processvar][serverID] = {} } + if (process[processvar][serverID][userid]) { + if (process[processvar][serverID][userid].keyholder == keyholderid) { // Lost primary keys - process[processvar][userid].fumbled = Date.now(); + process[processvar][serverID][userid].fumbled = Date.now(); typelocked = "keyholder"; } - else if (process[processvar][userid].clonedKeyholders.includes(keyholderid)) { + else if (process[processvar][serverID][userid].clonedKeyholders.includes(keyholderid)) { // Lost a clone. Clones should be destroyed. - process[processvar][userid].clonedKeyholders.splice(process[processvar][userid].clonedKeyholders.indexOf(keyholderid), 1) + process[processvar][serverID][userid].clonedKeyholders.splice(process[processvar][serverID][userid].clonedKeyholders.indexOf(keyholderid), 1) typelocked = "clone"; } } From f937962726a72a7ead1db4956fd4b4c2b23c4c5e Mon Sep 17 00:00:00 2001 From: Enraa Date: Fri, 19 Jun 2026 22:48:48 -0700 Subject: [PATCH 20/44] a --- functions/messagefunctions.js | 5 +- functions/outfitfunctions.js | 242 +++++++++++++++++----------------- 2 files changed, 123 insertions(+), 124 deletions(-) diff --git a/functions/messagefunctions.js b/functions/messagefunctions.js index df98f1e3..58a7eaf8 100644 --- a/functions/messagefunctions.js +++ b/functions/messagefunctions.js @@ -206,6 +206,7 @@ const splitMessage = (text, inputRegex = null) => { return output; }; +// Im MOSTLY sure this function can be retired now. function runMessageEvents(data) { // Gags if (process.gags) { @@ -287,6 +288,4 @@ exports.loadEmoji = loadEmoji; exports.splitMessage = splitMessage; -exports.messageSendChannel = messageSendChannel; - -exports.runMessageEvents = runMessageEvents; \ No newline at end of file +exports.messageSendChannel = messageSendChannel; \ No newline at end of file diff --git a/functions/outfitfunctions.js b/functions/outfitfunctions.js index a7502306..a2517833 100644 --- a/functions/outfitfunctions.js +++ b/functions/outfitfunctions.js @@ -79,7 +79,7 @@ async function generateOutfitModal(serverID, userID, menu, page, options) { // Main section: if (menu == "restore") { - let outfits = getOutfits(userID); + let outfits = getOutfits(serverID, userID); for (let i = (parseInt(page) - 1) * 5; i < page * 5; i++) { let textdisplay = `### Outfit ${i + 1}`; let outfitindividual = outfits[i]; @@ -88,39 +88,39 @@ async function generateOutfitModal(serverID, userID, menu, page, options) { Object.keys(outfitindividual).forEach((k) => { // I could use a switch statement here but I feel like using if conditionals. if (k == "wearable") { - let emoji = getHeavy(userID) ? "āš ļø" : "āœ…"; + let emoji = getHeavy(serverID, userID) ? "āš ļø" : "āœ…"; textdisplay = `${textdisplay}šŸ‘— Clothing: ${emoji}, `; } if (k == "gag") { - let emoji = getHeavy(userID) || getMitten(userID) ? "āš ļø" : "āœ…"; + let emoji = getHeavy(serverID, userID) || getMitten(serverID, userID) ? "āš ļø" : "āœ…"; textdisplay = `${textdisplay}${process.emojis.gag} Gag: ${emoji}, `; } if (k == "mitten") { - let emoji = getHeavy(userID) || getMitten(userID) ? "āš ļø" : "āœ…"; + let emoji = getHeavy(serverID, userID) || getMitten(serverID, userID) ? "āš ļø" : "āœ…"; textdisplay = `${textdisplay}${process.emojis.mitten} Mitten: ${emoji}, `; } if (k == "headwear") { - let emoji = getHeavy(userID) || getMitten(userID) ? "āš ļø" : "āœ…"; + let emoji = getHeavy(serverID, userID) || getMitten(serverID, userID) ? "āš ļø" : "āœ…"; textdisplay = `${textdisplay}${process.emojis.gasmask} Headwear: ${emoji}, `; } if (k == "collar") { - let emoji = getHeavy(userID) || (!canAccessCollar(userID, userID, true).access && canAccessCollar(userID, userID, true).hascollar) ? "āš ļø" : "āœ…"; + let emoji = getHeavy(serverID, userID) || (!canAccessCollar(serverID, userID, userID, true).access && canAccessCollar(serverID, userID, userID, true).hascollar) ? "āš ļø" : "āœ…"; textdisplay = `${textdisplay}${process.emojis.collar} Collar: ${emoji}, `; } if (k == "heavy") { - let emoji = getHeavy(userID) ? "āš ļø" : "āœ…"; + let emoji = getHeavy(serverID, userID) ? "āš ļø" : "āœ…"; textdisplay = `${textdisplay}${process.emojis.armbinder} Heavy: ${emoji}, `; } if (k == "corset") { - let emoji = getHeavy(userID) || (!canAccessChastity(userID, userID, true).access && canAccessChastity(userID, userID, true).hasbelt) ? "āš ļø" : "āœ…"; + let emoji = getHeavy(serverID, userID) || (!canAccessChastity(serverID, userID, userID, true).access && canAccessChastity(serverID, userID, userID, true).hasbelt) ? "āš ļø" : "āœ…"; textdisplay = `${textdisplay}${process.emojis.corset} Corset: ${emoji}, `; } if (k == "chastity") { - let emoji = getHeavy(userID) || (!canAccessChastity(userID, userID, true).access && canAccessChastity(userID, userID, true).hasbelt) ? "āš ļø" : "āœ…"; + let emoji = getHeavy(serverID, userID) || (!canAccessChastity(serverID, userID, userID, true).access && canAccessChastity(serverID, userID, userID, true).hasbelt) ? "āš ļø" : "āœ…"; textdisplay = `${textdisplay}${process.emojis.chastity} Chastity: ${emoji}, `; } if (k == "chastitybra") { - let emoji = getHeavy(userID) || (!canAccessChastityBra(userID, userID, true).access && canAccessChastityBra(userID, userID, true).hasbelt) ? "āš ļø" : "āœ…"; + let emoji = getHeavy(serverID, userID) || (!canAccessChastityBra(serverID, userID, userID, true).access && canAccessChastityBra(serverID, userID, userID, true).hasbelt) ? "āš ļø" : "āœ…"; textdisplay = `${textdisplay}${process.emojis.chastitybra} Chastity Bra: ${emoji}, `; } /*if (k == "vibe") { @@ -161,7 +161,7 @@ async function generateOutfitModal(serverID, userID, menu, page, options) { pagecomponents.push(new ActionRowBuilder().addComponents(...pagenavbuttons)); } if (menu == "rename") { - let outfits = getOutfits(userID); + let outfits = getOutfits(serverID, userID); for (let i = (parseInt(page) - 1) * 5; i < page * 5; i++) { let textdisplay = `### Outfit ${i + 1}`; let outfitindividual = outfits[i]; @@ -230,11 +230,11 @@ async function generateOutfitModal(serverID, userID, menu, page, options) { // Headwear section texts = `### Headwear:\n`; - if (!(getHeadwear(userID).length > 0)) { + if (!(getHeadwear(serverID, userID).length > 0)) { texts = `${texts}Not worn`; } else { - texts = `${texts}${getHeadwear(userID) - .map((g) => getHeadwearName(undefined, g)) + texts = `${texts}${getHeadwear(serverID, userID) + .map((g) => getHeadwearName(serverID, undefined, g)) .join(", ")}`; } pagecomponents.push( @@ -246,17 +246,17 @@ async function generateOutfitModal(serverID, userID, menu, page, options) { .setLabel(options.slice(bitselector, bitselector + 1) == "1" ? `Save` : `Disabled`) .setStyle(options.slice(bitselector, bitselector + 1) == "1" ? ButtonStyle.Success : ButtonStyle.Danger) // Block if element doesn't exist - .setDisabled(!(getHeadwear(userID).length > 0)), + .setDisabled(!(getHeadwear(serverID, userID).length > 0)), ), ); bitselector++; // Mittens section texts = `### Mitten:\n`; - if (!getMitten(userID)) { + if (!getMitten(serverID, userID)) { texts = `${texts}Not worn`; } else { - texts = `${texts}${getMittenName(userID) ?? "Worn"}`; + texts = `${texts}${getMittenName(serverID, userID) ?? "Worn"}`; } pagecomponents.push( new SectionBuilder() @@ -267,17 +267,17 @@ async function generateOutfitModal(serverID, userID, menu, page, options) { .setLabel(options.slice(bitselector, bitselector + 1) == "1" ? `Save` : `Disabled`) .setStyle(options.slice(bitselector, bitselector + 1) == "1" ? ButtonStyle.Success : ButtonStyle.Danger) // Block if element doesn't exist - .setDisabled(!getMitten(userID)), + .setDisabled(!getMitten(serverID, userID)), ), ); bitselector++; // Wearable section texts = `### Apparel:\n`; - if (!(getWearable(userID).length > 0)) { + if (!(getWearable(serverID, userID).length > 0)) { texts = `${texts}Not worn`; } else { - texts = `${texts}${getWearable(userID) + texts = `${texts}${getWearable(serverID, userID) .map((w) => getWearableName(undefined, w)) .join(", ")}`; } @@ -290,7 +290,7 @@ async function generateOutfitModal(serverID, userID, menu, page, options) { .setLabel(options.slice(bitselector, bitselector + 1) == "1" ? `Save` : `Disabled`) .setStyle(options.slice(bitselector, bitselector + 1) == "1" ? ButtonStyle.Success : ButtonStyle.Danger) // Block if element doesn't exist - .setDisabled(!(getWearable(userID).length > 0)), + .setDisabled(!(getWearable(serverID, userID).length > 0)), ), ); bitselector++; @@ -320,19 +320,19 @@ async function generateOutfitModal(serverID, userID, menu, page, options) { // Chastity Belt section texts = `### Chastity Belt:\n`; - if (!getChastity(userID)) { + if (!getChastity(serverID, userID)) { texts = `${texts}Not worn`; } else { let keyholdertext = ``; - keyholdertext = `<@${getChastity(userID).keyholder}>` - if (getChastityTimelock(userID)) { keyholdertext = `Timelocked` } - if (getChastity(userID).keyholder == userID) { keyholdertext = `Self-bound` } - if (getChastity(userID)?.fumbled) { keyholdertext = `Keys are missing!` } - texts = `${texts}${getChastityName(userID) ?? "Standard Chastity Belt"}\n`; + keyholdertext = `<@${getChastity(serverID, userID).keyholder}>` + if (getChastityTimelock(serverID, userID)) { keyholdertext = `Timelocked` } + if (getChastity(serverID, userID).keyholder == userID) { keyholdertext = `Self-bound` } + if (getChastity(serverID, userID)?.fumbled) { keyholdertext = `Keys are missing!` } + texts = `${texts}${getChastityName(serverID, userID) ?? "Standard Chastity Belt"}\n`; texts = `${texts}Primary Keyholder: ${keyholdertext}`; texts = `${texts}${ - getChastity(userID).clonedKeyholders - ? `, clones held by ${getChastity(userID) + getChastity(serverID, userID).clonedKeyholders + ? `, clones held by ${getChastity(serverID, userID) .clonedKeyholders.map((k) => `<@${k}>`) .join(", ")}` : `` @@ -347,26 +347,26 @@ async function generateOutfitModal(serverID, userID, menu, page, options) { .setLabel(options.slice(bitselector, bitselector + 1) == "1" ? `Save` : `Disabled`) .setStyle(options.slice(bitselector, bitselector + 1) == "1" ? ButtonStyle.Success : ButtonStyle.Danger) // Block if element doesn't exist - .setDisabled(!getChastity(userID)), + .setDisabled(!getChastity(serverID, userID)), ), ); bitselector++; // Chastity Bra section texts = `### Chastity Bra:\n`; - if (!getChastityBra(userID)) { + if (!getChastityBra(serverID, userID)) { texts = `${texts}Not worn`; } else { let keyholdertext = ``; - keyholdertext = `<@${getChastityBra(userID).keyholder}>` - if (getChastityBraTimelock(userID)) { keyholdertext = `Timelocked` } - if (getChastityBra(userID).keyholder == userID) { keyholdertext = `Self-bound` } - if (getChastityBra(userID)?.fumbled) { keyholdertext = `Keys are missing!` } - texts = `${texts}${getChastityBraName(userID) ?? "Standard Chastity Bra"}\n`; + keyholdertext = `<@${getChastityBra(serverID, userID).keyholder}>` + if (getChastityBraTimelock(serverID, userID)) { keyholdertext = `Timelocked` } + if (getChastityBra(serverID, userID).keyholder == userID) { keyholdertext = `Self-bound` } + if (getChastityBra(serverID, userID)?.fumbled) { keyholdertext = `Keys are missing!` } + texts = `${texts}${getChastityBraName(serverID, userID) ?? "Standard Chastity Bra"}\n`; texts = `${texts}Primary Keyholder: ${keyholdertext}`; texts = `${texts}${ - getChastityBra(userID).clonedKeyholders - ? `, clones held by ${getChastityBra(userID) + getChastityBra(serverID, userID).clonedKeyholders + ? `, clones held by ${getChastityBra(serverID, userID) .clonedKeyholders.map((k) => `<@${k}>`) .join(", ")}` : `` @@ -381,17 +381,17 @@ async function generateOutfitModal(serverID, userID, menu, page, options) { .setLabel(options.slice(bitselector, bitselector + 1) == "1" ? `Save` : `Disabled`) .setStyle(options.slice(bitselector, bitselector + 1) == "1" ? ButtonStyle.Success : ButtonStyle.Danger) // Block if element doesn't exist - .setDisabled(!getChastityBra(userID)), + .setDisabled(!getChastityBra(serverID, userID)), ), ); bitselector++; // Corset section texts = `### Corset:\n`; - if (!getCorset(userID)) { + if (!getCorset(serverID, userID)) { texts = `${texts}Not worn`; } else { - texts = `${texts}${getBaseCorset(getCorset(userID).type).name} laced to Length ${getCorset(userID).tightness}`; + texts = `${texts}${getBaseCorset(getCorset(serverID, userID).type).name} laced to Length ${getCorset(serverID, userID).tightness}`; } pagecomponents.push( new SectionBuilder() @@ -402,17 +402,17 @@ async function generateOutfitModal(serverID, userID, menu, page, options) { .setLabel(options.slice(bitselector, bitselector + 1) == "1" ? `Save` : `Disabled`) .setStyle(options.slice(bitselector, bitselector + 1) == "1" ? ButtonStyle.Success : ButtonStyle.Danger) // Block if element doesn't exist - .setDisabled(!getCorset(userID)), + .setDisabled(!getCorset(serverID, userID)), ), ); bitselector++; // Heavy Bondage section texts = `### Heavy Bondage:\n`; - if (!getHeavy(userID)) { + if (!getHeavy(serverID, userID)) { texts = `${texts}Not worn`; } else { - texts = `${texts}${getHeavy(userID).type}`; + texts = `${texts}${getHeavy(serverID, userID).type}`; } pagecomponents.push( new SectionBuilder() @@ -423,26 +423,26 @@ async function generateOutfitModal(serverID, userID, menu, page, options) { .setLabel(options.slice(bitselector, bitselector + 1) == "1" ? `Save` : `Disabled`) .setStyle(options.slice(bitselector, bitselector + 1) == "1" ? ButtonStyle.Success : ButtonStyle.Danger) // Block if element doesn't exist - .setDisabled(!getHeavy(userID)), + .setDisabled(!getHeavy(serverID, userID)), ), ); bitselector++; // Collar section texts = `### Collar:\n`; - if (!getCollar(userID)) { + if (!getCollar(serverID, userID)) { texts = `${texts}Not worn`; } else { let keyholdertext = ``; - keyholdertext = `<@${getCollar(userID).keyholder}>` - if (getCollarTimelock(userID)) { keyholdertext = `Timelocked` } - if (getCollar(userID).keyholder == userID) { keyholdertext = `Self-bound` } - if (getCollar(userID)?.fumbled) { keyholdertext = `Keys are missing!` } - texts = `${texts}${getCollarName(userID)}\n`; + keyholdertext = `<@${getCollar(serverID, userID).keyholder}>` + if (getCollarTimelock(serverID, userID)) { keyholdertext = `Timelocked` } + if (getCollar(serverID, userID).keyholder == userID) { keyholdertext = `Self-bound` } + if (getCollar(serverID, userID)?.fumbled) { keyholdertext = `Keys are missing!` } + texts = `${texts}${getCollarName(serverID, userID)}\n`; texts = `${texts}Primary Keyholder: ${keyholdertext}`; texts = `${texts}${ - getCollar(userID).clonedKeyholders - ? `, clones held by ${getCollar(userID) + getCollar(serverID, userID).clonedKeyholders + ? `, clones held by ${getCollar(serverID, userID) .clonedKeyholders.map((k) => `<@${k}>`) .join(", ")}` : `` @@ -457,14 +457,14 @@ async function generateOutfitModal(serverID, userID, menu, page, options) { .setLabel(options.slice(bitselector, bitselector + 1) == "1" ? `Save` : `Disabled`) .setStyle(options.slice(bitselector, bitselector + 1) == "1" ? ButtonStyle.Success : ButtonStyle.Danger) // Block if element doesn't exist - .setDisabled(!getCollar(userID)), + .setDisabled(!getCollar(serverID, userID)), ), ); bitselector++; let buttonsave = new ButtonBuilder() .setCustomId(`outfitter_saveoutfit_${page}_0_${options}`) - .setLabel(getOutfits(userID)[parseInt(page) - 1] ? `āš ļø Overwrite Outfit ${page}` : `Save Outfit ${page}`) + .setLabel(getOutfits(serverID, userID)[parseInt(page) - 1] ? `āš ļø Overwrite Outfit ${page}` : `Save Outfit ${page}`) .setStyle(ButtonStyle.Primary) .setDisabled(!options.includes("1")); pagecomponents.push(new ActionRowBuilder().addComponents(buttonsave)); @@ -522,15 +522,15 @@ function outfitEntryModal(interaction, slot) { async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { traceFirstParam(arguments[0]); let inspectuserID = inspectuserIDin ?? userID; - let profilelink = (getOption(inspectuserID, "profilelink") && getOption(inspectuserID, "profilelink").length > 0) ? ` • [Profile](${getOption(inspectuserID, "profilelink")})` : `` - let kinklistlink = (getOption(inspectuserID, "kinklistlink") && getOption(inspectuserID, "kinklistlink").length > 0) ? ` • [Kink List](${getOption(inspectuserID, "kinklistlink")})` : `` - let preferredtitles = (getOption(inspectuserID, "preferredtitle") && getOption(inspectuserID, "preferredtitle").length > 0) ? `${getOption(inspectuserID, "preferredtitle")} ` : `` + let profilelink = (getOption(serverID, inspectuserID, "profilelink") && getOption(serverID, inspectuserID, "profilelink").length > 0) ? ` • [Profile](${getOption(serverID, inspectuserID, "profilelink")})` : `` + let kinklistlink = (getOption(serverID, inspectuserID, "kinklistlink") && getOption(serverID, inspectuserID, "kinklistlink").length > 0) ? ` • [Kink List](${getOption(serverID, inspectuserID, "kinklistlink")})` : `` + let preferredtitles = (getOption(serverID, inspectuserID, "preferredtitle") && getOption(serverID, inspectuserID, "preferredtitle").length > 0) ? `${getOption(serverID, inspectuserID, "preferredtitle")} ` : `` let userselector = new UserSelectMenuBuilder() .setCustomId(`inspect_overview_newuser_1`) .setMaxValues(1) .setDefaultUsers(inspectuserID) .setPlaceholder("Select a user to display...") - let pagecomponents = [new ActionRowBuilder().addComponents(userselector), new TextDisplayBuilder().setContent(`## Inspecting - ${preferredtitles}<@${inspectuserID}>\n-# (${getPronounsSet(inspectuserID)})${profilelink}${kinklistlink}`)]; + let pagecomponents = [new ActionRowBuilder().addComponents(userselector), new TextDisplayBuilder().setContent(`## Inspecting - ${preferredtitles}<@${inspectuserID}>\n-# (${getPronounsSet(serverID, inspectuserID)})${profilelink}${kinklistlink}`)]; let tabbuttons = [ // Overview new ButtonBuilder() @@ -572,7 +572,7 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { // Now do stuff per page if (menu == "overview") { - let headwearrestrictions = getHeadwearRestrictions(userID); + let headwearrestrictions = getHeadwearRestrictions(serverID, userID); let wearingtext = `## Worn Restraints:`; // Gags if (getGag(serverID, inspectuserID)) { @@ -580,41 +580,41 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { } // Headwear if (getHeadwear(inspectuserID).length > 0) { - wearingtext = `${wearingtext}\n${process.emojis.gasmask} Masks: **${getHeadwear(inspectuserID).map((h) => (!getLockedHeadgear(inspectuserID).includes(h) ? getHeadwearName(undefined, h) : `*${getHeadwearName(undefined, h)}*`)).join(", ")}**` + wearingtext = `${wearingtext}\n${process.emojis.gasmask} Masks: **${getHeadwear(serverID, inspectuserID).map((h) => (!getLockedHeadgear(serverID, inspectuserID).includes(h) ? getHeadwearName(serverID, undefined, h) : `*${getHeadwearName(serverID, undefined, h)}*`)).join(", ")}**` let lockedheadgears = []; - if (process.headwear[inspectuserID]) { lockedheadgears = Object.keys(process.headwear[inspectuserID]) } + if (process.headwear[serverID][inspectuserID]) { lockedheadgears = Object.keys(process.headwear[serverID][inspectuserID]) } lockedheadgears.forEach((lh) => { - if (process.headwear[inspectuserID][lh] && process.headwear[inspectuserID][lh]?.lockable && process.headwear[inspectuserID][lh]?.origbinder) { - wearingtext = `${wearingtext}\n-# ā€Ž - **${process.headtypes[lh].name}** key held by <@${process.headwear[inspectuserID][lh].origbinder}>` + if (process.headwear[serverID][inspectuserID][lh] && process.headwear[serverID][inspectuserID][lh]?.lockable && process.headwear[serverID][inspectuserID][lh]?.origbinder) { + wearingtext = `${wearingtext}\n-# ā€Ž - **${process.headtypes[lh].name}** key held by <@${process.headwear[serverID][inspectuserID][lh].origbinder}>` } }) } // Mittens - if (getMitten(inspectuserID)) { - wearingtext = `${wearingtext}\n${process.emojis.mitten} Mittens: **${getMittenName(inspectuserID) ?? "Standard Mittens"}**` + if (getMitten(serverID, inspectuserID)) { + wearingtext = `${wearingtext}\n${process.emojis.mitten} Mittens: **${getMittenName(serverID, inspectuserID) ?? "Standard Mittens"}**` } // Corset - if (getCorset(inspectuserID)) { - wearingtext = `${wearingtext}\n${process.emojis.corset} Corset: **${getBaseCorset(getCorset(inspectuserID).type).name} laced with strings at length ${getCorset(inspectuserID).tightness}**` + if (getCorset(serverID, inspectuserID)) { + wearingtext = `${wearingtext}\n${process.emojis.corset} Corset: **${getBaseCorset(getCorset(serverID, inspectuserID).type).name} laced with strings at length ${getCorset(serverID, inspectuserID).tightness}**` } // Vibe - if (getToys(inspectuserID).length > 0) { - wearingtext = `${wearingtext}\n${process.emojis.wand} Toys: **${getToys(inspectuserID).map((vibe) => `${getBaseToy(vibe.type).toyname} (${vibe.intensity})`).join(", ")}**` + if (getToys(serverID, inspectuserID).length > 0) { + wearingtext = `${wearingtext}\n${process.emojis.wand} Toys: **${getToys(serverID, inspectuserID).map((vibe) => `${getBaseToy(vibe.type).toyname} (${vibe.intensity})`).join(", ")}**` } // Heavy Bondage - if (getHeavy(inspectuserID)) { - wearingtext = `${wearingtext}\n${process.emojis.armbinder} Heavy Bondage: **${getHeavyList(inspectuserID).map((heavy) => heavy.displayname).join(", ")}**` - let heavyrestrictions = getHeavyRestrictions(inspectuserID); + if (getHeavy(serverID, inspectuserID)) { + wearingtext = `${wearingtext}\n${process.emojis.armbinder} Heavy Bondage: **${getHeavyList(serverID, inspectuserID).map((heavy) => heavy.displayname).join(", ")}**` + let heavyrestrictions = getHeavyRestrictions(serverID, inspectuserID); wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ā›“ļø Restrictions - **Touch Self: ${heavyrestrictions.touchself ? "āœ…" : "ā›”"}, Touch Others: ${heavyrestrictions.touchothers ? "āœ…" : "ā›”"}, Container: ${!heavyrestrictions.touchlist ? "āœ…" : "ā›”"}**` } // Chastity Belt - if (getChastity(inspectuserID)) { - let chastitylockemoji = canAccessChastity(inspectuserID, userID).access ? "šŸ”‘" : "šŸ”’"; + if (getChastity(serverID, inspectuserID)) { + let chastitylockemoji = canAccessChastity(serverID, inspectuserID, userID).access ? "šŸ”‘" : "šŸ”’"; if (!headwearrestrictions.canInspect) { chastitylockemoji = "ā“" } - let currentchastitybelt = getChastityName(inspectuserID) ?? "Standard Chastity Belt" - let chastitykeyholderinfo = getChastity(inspectuserID).keyholder - let chastitykeyaccess = getChastity(inspectuserID)?.access; + let currentchastitybelt = getChastityName(serverID, inspectuserID) ?? "Standard Chastity Belt" + let chastitykeyholderinfo = getChastity(serverID, inspectuserID).keyholder + let chastitykeyaccess = getChastity(serverID, inspectuserID)?.access; let chastitytimelockedtext = "Timelocked (Open)"; if (chastitykeyaccess == 1) { chastitytimelockedtext = "Timelocked (Keyed)"; @@ -627,31 +627,31 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitylockemoji} **Blind!**` } // Lost keys from fumble - else if (getChastity(inspectuserID)?.fumbled) { - if (getChastity(inspectuserID)?.temporarykeyholder) { - wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitylockemoji} **Temporarily held by <@${getChastity(inspectuserID)?.temporarykeyholder}>, returning ${getChastityTempTimelock(inspectuserID, true)}**` + else if (getChastity(serverID, inspectuserID)?.fumbled) { + if (getChastity(serverID, inspectuserID)?.temporarykeyholder) { + wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitylockemoji} **Temporarily held by <@${getChastity(serverID, inspectuserID)?.temporarykeyholder}>, returning ${getChastityTempTimelock(serverID, inspectuserID, true)}**` } else { wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitylockemoji} **Keys are Missing!**` } } - else if (getChastityTimelock(inspectuserID)) { - wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitylockemoji} **${chastitytimelockedtext} until ${getChastityTimelock(inspectuserID, true)}**` + else if (getChastityTimelock(serverID, inspectuserID)) { + wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitylockemoji} **${chastitytimelockedtext} until ${getChastityTimelock(serverID, inspectuserID, true)}**` } - else if (getChastity(inspectuserID).keyholder == inspectuserID) { + else if (getChastity(serverID, inspectuserID).keyholder == inspectuserID) { wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitylockemoji} **Self-bound!**` } else { - wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitylockemoji} **Key held by <@${getChastity(inspectuserID).keyholder}>**` + wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitylockemoji} **Key held by <@${getChastity(serverID, inspectuserID).keyholder}>**` } } // Chastity Bra - if (getChastityBra(inspectuserID)) { - let chastitybralockemoji = canAccessChastityBra(inspectuserID, userID).access ? "šŸ”‘" : "šŸ”’"; + if (getChastityBra(serverID, inspectuserID)) { + let chastitybralockemoji = canAccessChastityBra(serverID, inspectuserID, userID).access ? "šŸ”‘" : "šŸ”’"; if (!headwearrestrictions.canInspect) { chastitybralockemoji = "ā“" } - let currentbrachastitybelt = getChastityBraName(inspectuserID) ?? "Standard Chastity Bra" - let chastitybrakeyholderinfo = getChastityBra(inspectuserID).keyholder - let chastitybrakeyaccess = getChastityBra(inspectuserID)?.access; + let currentbrachastitybelt = getChastityBraName(serverID, inspectuserID) ?? "Standard Chastity Bra" + let chastitybrakeyholderinfo = getChastityBra(serverID, inspectuserID).keyholder + let chastitybrakeyaccess = getChastityBra(serverID, inspectuserID)?.access; let chastitybratimelockedtext = "Timelocked (Open)"; if (chastitybrakeyaccess == 1) { chastitybratimelockedtext = "Timelocked (Keyed)"; @@ -664,31 +664,31 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitybralockemoji} **Blind!**` } // Lost keys from fumble - else if (getChastityBra(inspectuserID)?.fumbled) { - if (getChastityBra(inspectuserID)?.temporarykeyholder) { - wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitybralockemoji} **Temporarily held by <@${getChastityBra(inspectuserID)?.temporarykeyholder}>, returning ${getChastityBraTempTimelock(inspectuserID, true)}**` + else if (getChastityBra(serverID, inspectuserID)?.fumbled) { + if (getChastityBra(serverID, inspectuserID)?.temporarykeyholder) { + wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitybralockemoji} **Temporarily held by <@${getChastityBra(serverID, inspectuserID)?.temporarykeyholder}>, returning ${getChastityBraTempTimelock(serverID, inspectuserID, true)}**` } else { wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitybralockemoji} **Keys are Missing!**` } } - else if (getChastityBraTimelock(inspectuserID)) { - wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitybralockemoji} **${chastitybratimelockedtext} until ${getChastityBraTimelock(inspectuserID, true)}**` + else if (getChastityBraTimelock(serverID, inspectuserID)) { + wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitybralockemoji} **${chastitybratimelockedtext} until ${getChastityBraTimelock(serverID, inspectuserID, true)}**` } - else if (getChastityBra(inspectuserID).keyholder == inspectuserID) { + else if (getChastityBra(serverID, inspectuserID).keyholder == inspectuserID) { wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitybralockemoji} **Self-bound!**` } else { - wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitybralockemoji} **Key held by <@${getChastityBra(inspectuserID).keyholder}>**` + wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${chastitybralockemoji} **Key held by <@${getChastityBra(serverID, inspectuserID).keyholder}>**` } } // Collar - if (getCollar(inspectuserID)) { - let collarlockemoji = canAccessCollar(inspectuserID, userID).access ? "šŸ”‘" : "šŸ”’"; + if (getCollar(serverID, inspectuserID)) { + let collarlockemoji = canAccessCollar(serverID, inspectuserID, userID).access ? "šŸ”‘" : "šŸ”’"; if (!headwearrestrictions.canInspect) { collarlockemoji = "ā“" } - let collarname = getCollarName(inspectuserID) ?? "Standard Collar" - let collarkeyholderinfo = getCollar(inspectuserID).keyholder - let collarkeyaccess = getCollar(inspectuserID)?.access; + let collarname = getCollarName(serverID, inspectuserID) ?? "Standard Collar" + let collarkeyholderinfo = getCollar(serverID, inspectuserID).keyholder + let collarkeyaccess = getCollar(serverID, inspectuserID)?.access; let collartimelockedtext = "Timelocked (Open)"; if (collarkeyaccess == 1) { collartimelockedtext = "Timelocked (Keyed)"; @@ -697,43 +697,43 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { collartimelockedtext = "Timelocked (Sealed)"; } let addlcollartext = ``; - if (getCollar(inspectuserID) && getCollar(inspectuserID).additionalcollars) { + if (getCollar(serverID, inspectuserID) && getCollar(serverID, inspectuserID).additionalcollars) { addlcollartext = `\n-# ā€Ž |--- Additional Effects: ` - getCollar(inspectuserID).additionalcollars.forEach((ac) => { - addlcollartext = `${addlcollartext}**${getCollarName(undefined, ac)}**, ` + getCollar(serverID, inspectuserID).additionalcollars.forEach((ac) => { + addlcollartext = `${addlcollartext}**${getCollarName(serverID, undefined, ac)}**, ` }) addlcollartext = addlcollartext.slice(0,-2); } - wearingtext = `${wearingtext}\n${process.emojis.collar} ${(getCollar(inspectuserID)?.collartype === "handcuffamulet") ? "Neck Ornament" : "Collar"}: **${collarname}**` + wearingtext = `${wearingtext}\n${process.emojis.collar} ${(getCollar(serverID, inspectuserID)?.collartype === "handcuffamulet") ? "Neck Ornament" : "Collar"}: **${collarname}**` wearingtext = `${wearingtext}${addlcollartext}`; if (!headwearrestrictions.canInspect) { wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${collarlockemoji} **Blind!**` } // Lost keys from fumble - else if (getCollar(inspectuserID)?.fumbled) { - if (getCollar(inspectuserID)?.temporarykeyholder) { - wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${collarlockemoji} **Temporarily held by <@${getCollar(inspectuserID)?.temporarykeyholder}>, returning ${getCollarTempTimelock(inspectuserID, true)}**` + else if (getCollar(serverID, inspectuserID)?.fumbled) { + if (getCollar(serverID, inspectuserID)?.temporarykeyholder) { + wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${collarlockemoji} **Temporarily held by <@${getCollar(serverID, inspectuserID)?.temporarykeyholder}>, returning ${getCollarTempTimelock(serverID, inspectuserID, true)}**` } else { wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${collarlockemoji} **Keys are Missing!**` } } - else if (getCollarTimelock(inspectuserID)) { - wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${collarlockemoji} **${collartimelockedtext} until ${getCollarTimelock(inspectuserID, true)}**` + else if (getCollarTimelock(serverID, inspectuserID)) { + wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${collarlockemoji} **${collartimelockedtext} until ${getCollarTimelock(serverID, inspectuserID, true)}**` } - else if (getCollar(inspectuserID).keyholder == inspectuserID) { + else if (getCollar(serverID, inspectuserID).keyholder == inspectuserID) { wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${collarlockemoji} **Self-bound!**` } else { - wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${collarlockemoji} **Key held by <@${getCollar(inspectuserID).keyholder}>**` + wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ${collarlockemoji} **Key held by <@${getCollar(serverID, inspectuserID).keyholder}>**` } - if (!getCollar(inspectuserID).keyholder_only) { + if (!getCollar(serverID, inspectuserID).keyholder_only) { wearingtext = `${wearingtext}, **Free Use!**` } - if (getCollar(inspectuserID).headpatvulnerable) { + if (getCollar(serverID, inspectuserID).headpatvulnerable) { wearingtext = `${wearingtext}, **Vulnerable from Headpat!**` } - wearingtext = `${wearingtext}\n-# Mittens: ${getCollarPerm(inspectuserID, "mitten") ? "āœ…" : "ā›”"}, Chastity: ${getCollarPerm(inspectuserID, "chastity") ? "āœ…" : "ā›”"}, Heavy: ${getCollarPerm(inspectuserID, "heavy") ? "āœ…" : "ā›”"}, Masks: ${getCollarPerm(inspectuserID, "mask") ? "āœ…" : "ā›”"}` + wearingtext = `${wearingtext}\n-# Mittens: ${getCollarPerm(serverID, inspectuserID, "mitten") ? "āœ…" : "ā›”"}, Chastity: ${getCollarPerm(serverID, inspectuserID, "chastity") ? "āœ…" : "ā›”"}, Heavy: ${getCollarPerm(serverID, inspectuserID, "heavy") ? "āœ…" : "ā›”"}, Masks: ${getCollarPerm(serverID, inspectuserID, "mask") ? "āœ…" : "ā›”"}` } if (wearingtext === `## Worn Restraints:`) { @@ -742,17 +742,17 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { wearingtext = `${wearingtext}\n` let clothingtext = `## Worn Apparel:\n`; - if (getWearable(inspectuserID).length > 0) { - clothingtext = `${clothingtext}**${getWearable(inspectuserID).map((h) => (!getLockedWearable(inspectuserID).includes(h) ? getWearableName(undefined, h) : `*${getWearableName(undefined, h)}*`)).slice(0,15).join(", ")}**` - if (getWearable(inspectuserID).length > 15) { - clothingtext = `${clothingtext}... *and ${getWearable(inspectuserID).length - 15} more item${(getWearable(inspectuserID).length - 15) == 1 ? "" : "s"}.*` + if (getWearable(serverID, inspectuserID).length > 0) { + clothingtext = `${clothingtext}**${getWearable(serverID, inspectuserID).map((h) => (!getLockedWearable(serverID, inspectuserID).includes(h) ? getWearableName(undefined, h) : `*${getWearableName(undefined, h)}*`)).slice(0,15).join(", ")}**` + if (getWearable(serverID, inspectuserID).length > 15) { + clothingtext = `${clothingtext}... *and ${getWearable(serverID, inspectuserID).length - 15} more item${(getWearable(serverID, inspectuserID).length - 15) == 1 ? "" : "s"}.*` } } if (clothingtext === `## Worn Apparel:\n`) { clothingtext = `${clothingtext}\nNothing is worn at the moment` } clothingtext = `${clothingtext}\n` - let bartext = await getDisplayTexts(userID, inspectuserID); + let bartext = await getDisplayTexts(serverID, userID, inspectuserID); let collated = `${wearingtext}${clothingtext}${bartext}`; From a740cab520815ee9ea3647420fc7a15f09e2f74f Mon Sep 17 00:00:00 2001 From: Enraa Date: Fri, 19 Jun 2026 23:16:06 -0700 Subject: [PATCH 21/44] so many serverIDs --- functions/outfitfunctions.js | 160 +++++++++++++++++------------------ 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/functions/outfitfunctions.js b/functions/outfitfunctions.js index a2517833..2abf556b 100644 --- a/functions/outfitfunctions.js +++ b/functions/outfitfunctions.js @@ -763,7 +763,7 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { pagecomponents.push(new TextDisplayBuilder().setContent(collated)) } else if (menu == "restraints") { - let headwearrestrictions = getHeadwearRestrictions(userID); + let headwearrestrictions = getHeadwearRestrictions(serverID, userID); let wearingtext = `## Regular Worn Restraints:`; // Gags if (getGag(serverID, inspectuserID)) { @@ -771,42 +771,42 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { } // Headwear if (getHeadwear(inspectuserID).length > 0) { - wearingtext = `${wearingtext}\n${process.emojis.gasmask} Masks: **${getHeadwear(inspectuserID).map((h) => (!getLockedHeadgear(inspectuserID).includes(h) ? getHeadwearName(undefined, h) : `*${getHeadwearName(undefined, h)}*`)).join(", ")}**` + wearingtext = `${wearingtext}\n${process.emojis.gasmask} Masks: **${getHeadwear(serverID, inspectuserID).map((h) => (!getLockedHeadgear(serverID, inspectuserID).includes(h) ? getHeadwearName(serverID, undefined, h) : `*${getHeadwearName(serverID, undefined, h)}*`)).join(", ")}**` let lockedheadgears = []; - if (process.headwear[inspectuserID]) { lockedheadgears = Object.keys(process.headwear[inspectuserID]) } + if (process.headwear[serverID][inspectuserID]) { lockedheadgears = Object.keys(process.headwear[serverID][inspectuserID]) } lockedheadgears.forEach((lh) => { - if (process.headwear[inspectuserID][lh] && process.headwear[inspectuserID][lh]?.lockable && process.headwear[inspectuserID][lh]?.origbinder) { + if (process.headwear[serverID][inspectuserID][lh] && process.headwear[serverID][inspectuserID][lh]?.lockable && process.headwear[serverID][inspectuserID][lh]?.origbinder) { wearingtext = `${wearingtext}\n-# ā€Ž - **${process.headtypes[lh].name}** key held by <@${process.headwear[inspectuserID][lh].origbinder}>` } }) } // Mittens - if (getMitten(inspectuserID)) { - wearingtext = `${wearingtext}\n${process.emojis.mitten} Mittens: **${getMittenName(inspectuserID) ?? "Standard Mittens"}**` + if (getMitten(serverID, inspectuserID)) { + wearingtext = `${wearingtext}\n${process.emojis.mitten} Mittens: **${getMittenName(serverID, inspectuserID) ?? "Standard Mittens"}**` } // Corset - if (getCorset(inspectuserID)) { - wearingtext = `${wearingtext}\n${process.emojis.corset} Corset: **${getBaseCorset(getCorset(inspectuserID).type).name} laced with strings at length ${getCorset(inspectuserID).tightness}**` + if (getCorset(serverID, inspectuserID)) { + wearingtext = `${wearingtext}\n${process.emojis.corset} Corset: **${getBaseCorset(getCorset(serverID, inspectuserID).type).name} laced with strings at length ${getCorset(serverID, inspectuserID).tightness}**` } // Vibe - if (getToys(inspectuserID).length > 0) { - wearingtext = `${wearingtext}\n${process.emojis.wand} Toys: **${getToys(inspectuserID).map((vibe) => `${getBaseToy(vibe.type).toyname} (${vibe.intensity})`).join(", ")}**` + if (getToys(serverID, inspectuserID).length > 0) { + wearingtext = `${wearingtext}\n${process.emojis.wand} Toys: **${getToys(serverID, inspectuserID).map((vibe) => `${getBaseToy(vibe.type).toyname} (${vibe.intensity})`).join(", ")}**` } // Heavy Bondage - if (getHeavy(inspectuserID)) { - wearingtext = `${wearingtext}\n${process.emojis.armbinder} Heavy Bondage: **${getHeavyList(inspectuserID).map((heavy) => heavy.displayname).join(", ")}**` - let heavyrestrictions = getHeavyRestrictions(inspectuserID); + if (getHeavy(serverID, inspectuserID)) { + wearingtext = `${wearingtext}\n${process.emojis.armbinder} Heavy Bondage: **${getHeavyList(serverID, inspectuserID).map((heavy) => heavy.displayname).join(", ")}**` + let heavyrestrictions = getHeavyRestrictions(serverID, inspectuserID); wearingtext = `${wearingtext}\n-# ā€Ž ⤷ ā›“ļø Restrictions - **Touch Self: ${heavyrestrictions.touchself ? "āœ…" : "ā›”"}, Touch Others: ${heavyrestrictions.touchothers ? "āœ…" : "ā›”"}, Container: ${!heavyrestrictions.touchlist ? "āœ…" : "ā›”"}**` } let keyedrestraints = `## Keyed Restraints:` // Chastity Belt - if (getChastity(inspectuserID)) { - let chastitylockemoji = canAccessChastity(inspectuserID, userID).access ? "šŸ”‘" : "šŸ”’"; + if (getChastity(serverID, inspectuserID)) { + let chastitylockemoji = canAccessChastity(serverID, inspectuserID, userID).access ? "šŸ”‘" : "šŸ”’"; if (!headwearrestrictions.canInspect) { chastitylockemoji = "ā“" } - let currentchastitybelt = getChastityName(inspectuserID) ?? "Standard Chastity Belt" - let chastitykeyholderinfo = getChastity(inspectuserID).keyholder - let chastitykeyaccess = getChastity(inspectuserID)?.access; + let currentchastitybelt = getChastityName(serverID, inspectuserID) ?? "Standard Chastity Belt" + let chastitykeyholderinfo = getChastity(serverID, inspectuserID).keyholder + let chastitykeyaccess = getChastity(serverID, inspectuserID)?.access; let chastitytimelockedtext = "Timelocked (Open)"; if (chastitykeyaccess == 1) { chastitytimelockedtext = "Timelocked (Keyed)"; @@ -819,37 +819,37 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitylockemoji} **Blind!**` } // Lost keys from fumble - else if (getChastity(inspectuserID)?.fumbled) { - if (getChastity(inspectuserID)?.temporarykeyholder) { - keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitylockemoji} **Temporarily held by <@${getChastity(inspectuserID)?.temporarykeyholder}>, returning ${getChastityTempTimelock(inspectuserID, true)}**` + else if (getChastity(serverID, inspectuserID)?.fumbled) { + if (getChastity(serverID, inspectuserID)?.temporarykeyholder) { + keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitylockemoji} **Temporarily held by <@${getChastity(serverID, inspectuserID)?.temporarykeyholder}>, returning ${getChastityTempTimelock(serverID, inspectuserID, true)}**` } else { keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitylockemoji} **Keys are Missing!**` } } - else if (getChastityTimelock(inspectuserID)) { - keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitylockemoji} **${chastitytimelockedtext} until ${getChastityTimelock(inspectuserID, true)}**` + else if (getChastityTimelock(serverID, inspectuserID)) { + keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitylockemoji} **${chastitytimelockedtext} until ${getChastityTimelock(serverID, inspectuserID, true)}**` } - else if (getChastity(inspectuserID).keyholder == inspectuserID) { + else if (getChastity(serverID, inspectuserID).keyholder == inspectuserID) { keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitylockemoji} **Self-bound!**` } else { - keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitylockemoji} **Key held by <@${getChastity(inspectuserID).keyholder}>**` + keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitylockemoji} **Key held by <@${getChastity(serverID, inspectuserID).keyholder}>**` } - if (headwearrestrictions.canInspect && getChastity(inspectuserID).clonedKeyholders && (getChastity(inspectuserID).clonedKeyholders.length > 0)) { - keyedrestraints = `${keyedrestraints}\n-# Cloned keys for ${process.emojis.chastity} held by ${getChastity(inspectuserID).clonedKeyholders.map((c) => `<@${c}>`).join(", ")}` + if (headwearrestrictions.canInspect && getChastity(serverID, inspectuserID).clonedKeyholders && (getChastity(serverID, inspectuserID).clonedKeyholders.length > 0)) { + keyedrestraints = `${keyedrestraints}\n-# Cloned keys for ${process.emojis.chastity} held by ${getChastity(serverID, inspectuserID).clonedKeyholders.map((c) => `<@${c}>`).join(", ")}` } - if (getChastity(inspectuserID).timestamp) { - keyedrestraints = `${keyedrestraints}\n-# Worn since ` + if (getChastity(serverID, inspectuserID).timestamp) { + keyedrestraints = `${keyedrestraints}\n-# Worn since ` } } // Chastity Bra - if (getChastityBra(inspectuserID)) { - let chastitybralockemoji = canAccessChastityBra(inspectuserID, userID).access ? "šŸ”‘" : "šŸ”’"; + if (getChastityBra(serverID, inspectuserID)) { + let chastitybralockemoji = canAccessChastityBra(serverID, inspectuserID, userID).access ? "šŸ”‘" : "šŸ”’"; if (!headwearrestrictions.canInspect) { chastitybralockemoji = "ā“" } - let currentbrachastitybelt = getChastityBraName(inspectuserID, getChastityBra(inspectuserID).chastitytype) ?? "Standard Chastity Bra" - let chastitybrakeyholderinfo = getChastityBra(inspectuserID).keyholder - let chastitybrakeyaccess = getChastityBra(inspectuserID)?.access; + let currentbrachastitybelt = getChastityBraName(serverID, inspectuserID, getChastityBra(serverID, inspectuserID).chastitytype) ?? "Standard Chastity Bra" + let chastitybrakeyholderinfo = getChastityBra(serverID, inspectuserID).keyholder + let chastitybrakeyaccess = getChastityBra(serverID, inspectuserID)?.access; let chastitybratimelockedtext = "Timelocked (Open)"; if (chastitybrakeyaccess == 1) { chastitybratimelockedtext = "Timelocked (Keyed)"; @@ -862,37 +862,37 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitybralockemoji} **Blind!**` } // Lost keys from fumble - else if (getChastityBra(inspectuserID)?.fumbled) { - if (getChastityBra(inspectuserID)?.temporarykeyholder) { - keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitybralockemoji} **Temporarily held by <@${getChastityBra(inspectuserID)?.temporarykeyholder}>, returning ${getChastityBraTempTimelock(inspectuserID, true)}**` + else if (getChastityBra(serverID, inspectuserID)?.fumbled) { + if (getChastityBra(serverID, inspectuserID)?.temporarykeyholder) { + keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitybralockemoji} **Temporarily held by <@${getChastityBra(serverID, inspectuserID)?.temporarykeyholder}>, returning ${getChastityBraTempTimelock(serverID, inspectuserID, true)}**` } else { keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitybralockemoji} **Keys are Missing!**` } } - else if (getChastityBraTimelock(inspectuserID)) { - keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitybralockemoji} **${chastitybratimelockedtext} until ${getChastityBraTimelock(inspectuserID, true)}**` + else if (getChastityBraTimelock(serverID, inspectuserID)) { + keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitybralockemoji} **${chastitybratimelockedtext} until ${getChastityBraTimelock(serverID, inspectuserID, true)}**` } - else if (getChastityBra(inspectuserID).keyholder == inspectuserID) { + else if (getChastityBra(serverID, inspectuserID).keyholder == inspectuserID) { keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitybralockemoji} **Self-bound!**` } else { - keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitybralockemoji} **Key held by <@${getChastityBra(inspectuserID).keyholder}>**` + keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${chastitybralockemoji} **Key held by <@${getChastityBra(serverID, inspectuserID).keyholder}>**` } - if (headwearrestrictions.canInspect && getChastityBra(inspectuserID).clonedKeyholders && (getChastityBra(inspectuserID).clonedKeyholders.length > 0)) { - keyedrestraints = `${keyedrestraints}\n-# Cloned keys for ${process.emojis.chastitybra} held by ${getChastityBra(inspectuserID).clonedKeyholders.map((c) => `<@${c}>`).join(", ")}` + if (headwearrestrictions.canInspect && getChastityBra(serverID, inspectuserID).clonedKeyholders && (getChastityBra(serverID, inspectuserID).clonedKeyholders.length > 0)) { + keyedrestraints = `${keyedrestraints}\n-# Cloned keys for ${process.emojis.chastitybra} held by ${getChastityBra(serverID, inspectuserID).clonedKeyholders.map((c) => `<@${c}>`).join(", ")}` } - if (getChastityBra(inspectuserID).timestamp) { - keyedrestraints = `${keyedrestraints}\n-# Worn since ` + if (getChastityBra(serverID, inspectuserID).timestamp) { + keyedrestraints = `${keyedrestraints}\n-# Worn since ` } } // Collar - if (getCollar(inspectuserID)) { - let collarlockemoji = canAccessCollar(inspectuserID, userID).access ? "šŸ”‘" : "šŸ”’"; + if (getCollar(serverID, inspectuserID)) { + let collarlockemoji = canAccessCollar(serverID, inspectuserID, userID).access ? "šŸ”‘" : "šŸ”’"; if (!headwearrestrictions.canInspect) { collarlockemoji = "ā“" } - let collarname = getCollarName(inspectuserID) ?? "Standard Collar" - let collarkeyholderinfo = getCollar(inspectuserID).keyholder - let collarkeyaccess = getCollar(inspectuserID)?.access; + let collarname = getCollarName(serverID, inspectuserID) ?? "Standard Collar" + let collarkeyholderinfo = getCollar(serverID, inspectuserID).keyholder + let collarkeyaccess = getCollar(serverID, inspectuserID)?.access; let collartimelockedtext = "Timelocked (Open)"; if (collarkeyaccess == 1) { collartimelockedtext = "Timelocked (Keyed)"; @@ -901,49 +901,49 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { collartimelockedtext = "Timelocked (Sealed)"; } let addlcollartext = ``; - if (getCollar(inspectuserID) && getCollar(inspectuserID).additionalcollars) { + if (getCollar(serverID, inspectuserID) && getCollar(serverID, inspectuserID).additionalcollars) { addlcollartext = `\n-# ā€Ž |--- Additional Effects: ` - getCollar(inspectuserID).additionalcollars.forEach((ac) => { - addlcollartext = `${addlcollartext}**${getCollarName(undefined, ac)}**, ` + getCollar(serverID, inspectuserID).additionalcollars.forEach((ac) => { + addlcollartext = `${addlcollartext}**${getCollarName(serverID, undefined, ac)}**, ` }) addlcollartext = addlcollartext.slice(0,-2); } - keyedrestraints = `${keyedrestraints}\n\n${process.emojis.collar} ${(getCollar(inspectuserID)?.collartype === "handcuffamulet") ? "Neck Ornament" : "Collar"}: **${collarname}**` + keyedrestraints = `${keyedrestraints}\n\n${process.emojis.collar} ${(getCollar(serverID, inspectuserID)?.collartype === "handcuffamulet") ? "Neck Ornament" : "Collar"}: **${collarname}**` keyedrestraints = `${keyedrestraints}${addlcollartext}`; if (!headwearrestrictions.canInspect) { keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${collarlockemoji} **Blind!**` } // Lost keys from fumble - else if (getCollar(inspectuserID)?.fumbled) { - if (getCollar(inspectuserID)?.temporarykeyholder) { - keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${collarlockemoji} **Temporarily held by <@${getCollar(inspectuserID)?.temporarykeyholder}>, returning ${getCollarTempTimelock(inspectuserID, true)}**` + else if (getCollar(serverID, inspectuserID)?.fumbled) { + if (getCollar(serverID, inspectuserID)?.temporarykeyholder) { + keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${collarlockemoji} **Temporarily held by <@${getCollar(serverID, inspectuserID)?.temporarykeyholder}>, returning ${getCollarTempTimelock(serverID, inspectuserID, true)}**` } else { keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${collarlockemoji} **Keys are Missing!**` } } - else if (getCollarTimelock(inspectuserID)) { - keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${collarlockemoji} **${collartimelockedtext} until ${getCollarTimelock(inspectuserID, true)}**` + else if (getCollarTimelock(serverID, inspectuserID)) { + keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${collarlockemoji} **${collartimelockedtext} until ${getCollarTimelock(serverID, inspectuserID, true)}**` } - else if (getCollar(inspectuserID).keyholder == inspectuserID) { + else if (getCollar(serverID, inspectuserID).keyholder == inspectuserID) { keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${collarlockemoji} **Self-bound!**` } else { - keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${collarlockemoji} **Key held by <@${getCollar(inspectuserID).keyholder}>**` + keyedrestraints = `${keyedrestraints}\n-# ā€Ž ⤷ ${collarlockemoji} **Key held by <@${getCollar(serverID, inspectuserID).keyholder}>**` } - if (!getCollar(inspectuserID).keyholder_only) { + if (!getCollar(serverID, inspectuserID).keyholder_only) { keyedrestraints = `${keyedrestraints}, **Free Use!**` } - if (getCollar(inspectuserID).headpatvulnerable) { + if (getCollar(serverID, inspectuserID).headpatvulnerable) { keyedrestraints = `${keyedrestraints}, **Vulnerable from Headpat!**` } - if (headwearrestrictions.canInspect && getCollar(inspectuserID).clonedKeyholders && (getCollar(inspectuserID).clonedKeyholders.length > 0)) { - keyedrestraints = `${keyedrestraints}\n-# Cloned keys for ${process.emojis.collar} held by ${getCollar(inspectuserID).clonedKeyholders.map((c) => `<@${c}>`).join(", ")}` + if (headwearrestrictions.canInspect && getCollar(serverID, inspectuserID).clonedKeyholders && (getCollar(serverID, inspectuserID).clonedKeyholders.length > 0)) { + keyedrestraints = `${keyedrestraints}\n-# Cloned keys for ${process.emojis.collar} held by ${getCollar(serverID, inspectuserID).clonedKeyholders.map((c) => `<@${c}>`).join(", ")}` } - if (getCollar(inspectuserID).timestamp) { - keyedrestraints = `${keyedrestraints}\n-# Worn since ` + if (getCollar(serverID, inspectuserID).timestamp) { + keyedrestraints = `${keyedrestraints}\n-# Worn since ` } - keyedrestraints = `${keyedrestraints}\n-# Mittens: ${getCollarPerm(inspectuserID, "mitten") ? "āœ…" : "ā›”"}, Chastity: ${getCollarPerm(inspectuserID, "chastity") ? "āœ…" : "ā›”"}, Heavy: ${getCollarPerm(inspectuserID, "heavy") ? "āœ…" : "ā›”"}, Masks: ${getCollarPerm(inspectuserID, "mask") ? "āœ…" : "ā›”"}` + keyedrestraints = `${keyedrestraints}\n-# Mittens: ${getCollarPerm(serverID, inspectuserID, "mitten") ? "āœ…" : "ā›”"}, Chastity: ${getCollarPerm(serverID, inspectuserID, "chastity") ? "āœ…" : "ā›”"}, Heavy: ${getCollarPerm(serverID, inspectuserID, "heavy") ? "āœ…" : "ā›”"}, Masks: ${getCollarPerm(serverID, inspectuserID, "mask") ? "āœ…" : "ā›”"}` } if (wearingtext === `## Regular Worn Restraints:`) { @@ -965,9 +965,9 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { pagecomponents.push(new TextDisplayBuilder().setContent(collated)) } else if (menu == "wearable") { - let headwearrestrictions = getHeadwearRestrictions(userID); + let headwearrestrictions = getHeadwearRestrictions(serverID, userID); let clothingtext = `## Worn Apparel:`; - if (getWearable(inspectuserID).length > 0) { + if (getWearable(serverID, inspectuserID).length > 0) { let wearablescategories = { Hat: [], "Head/Hair Accessories": [], @@ -986,7 +986,7 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { "Body Part": [], Other: [] } - getWearable(inspectuserID).map((w) => { return { base: getBaseWearable(w), item: w } }).forEach((basewearable) => { + getWearable(serverID, inspectuserID).map((w) => { return { base: getBaseWearable(w), item: w } }).forEach((basewearable) => { if (basewearable?.base?.category && Object.keys(wearablescategories).includes(basewearable?.base?.category)) { wearablescategories[basewearable?.base?.category].push(basewearable.item) } @@ -1000,7 +1000,7 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { let newtexttoadd = `\n### ${category}\n`; wearablescategories[category].sort().forEach((w) => { if (newtexttoadd.length < remaininglength) { - newtexttoadd = `${newtexttoadd}${!getLockedWearable(inspectuserID).includes(w) ? getWearableName(undefined, w) : `*${getWearableName(undefined, w)}*`}, ` + newtexttoadd = `${newtexttoadd}${!getLockedWearable(serverID, inspectuserID).includes(w) ? getWearableName(undefined, w) : `*${getWearableName(undefined, w)}*`}, ` } }) if (newtexttoadd != `\n### ${category}`) { @@ -1027,42 +1027,42 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { pagecomponents.push(new TextDisplayBuilder().setContent(collated)) } else if (menu == "keys") { - let headwearrestrictions = getHeadwearRestrictions(userID); + let headwearrestrictions = getHeadwearRestrictions(serverID, userID); // Keys Held let keysheldtext = ""; // Held Primary Keys - let keysheldchastity = getChastityKeys(inspectuserID); + let keysheldchastity = getChastityKeys(serverID, inspectuserID); if (keysheldchastity.length > 0) { keysheldchastity = keysheldchastity.map((k) => `<@${k}>`); let keysstring = keysheldchastity.join(", "); keysheldtext = `- ${process.emojis.chastity} Chastity belt keys: ${keysstring}\n`; } - let keysheldchastitybra = getChastityBraKeys(inspectuserID); + let keysheldchastitybra = getChastityBraKeys(serverID, inspectuserID); if (keysheldchastitybra.length > 0) { keysheldchastitybra = keysheldchastitybra.map((k) => `<@${k}>`); let keysstring = keysheldchastitybra.join(", "); keysheldtext = `${keysheldtext}- ${process.emojis.chastitybra} Chastity bra keys: ${keysstring}\n`; } - let keysheldcollar = getCollarKeys(inspectuserID); + let keysheldcollar = getCollarKeys(serverID, inspectuserID); if (keysheldcollar.length > 0) { keysheldcollar = keysheldcollar.map((k) => `<@${k}>`); let keysstring = keysheldcollar.join(", "); keysheldtext = `${keysheldtext}- ${process.emojis.collar} Collar keys: ${keysstring}\n`; } // Held Cloned Keys - let keysheldclonedchastity = getClonedChastityKeysOwned(inspectuserID); + let keysheldclonedchastity = getClonedChastityKeysOwned(serverID, inspectuserID); if (keysheldclonedchastity.length > 0) { keysheldclonedchastity = keysheldclonedchastity.map((k) => `<@${k.split("_")[0]}>`); let keysstring = keysheldclonedchastity.join(", "); keysheldtext = `${keysheldtext}- ${process.emojis.chastityclone} Cloned chastity belt keys: ${keysstring}\n`; } - let keysheldclonedchastitybra = getClonedChastityBraKeysOwned(inspectuserID); + let keysheldclonedchastitybra = getClonedChastityBraKeysOwned(serverID, inspectuserID); if (keysheldclonedchastitybra.length > 0) { keysheldclonedchastitybra = keysheldclonedchastitybra.map((k) => `<@${k.split("_")[0]}>`); let keysstring = keysheldclonedchastitybra.join(", "); keysheldtext = `${keysheldtext}- ${process.emojis.chastitybraclone} Cloned chastity bra keys: ${keysstring}\n`; } - let keysheldclonedcollar = getClonedCollarKeysOwned(inspectuserID); + let keysheldclonedcollar = getClonedCollarKeysOwned(serverID, inspectuserID); if (keysheldclonedcollar.length > 0) { keysheldclonedcollar = keysheldclonedcollar.map((k) => `<@${k.split("_")[0]}>`); let keysstring = keysheldclonedcollar.join(", "); @@ -1084,7 +1084,7 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { pagecomponents.push(new TextDisplayBuilder().setContent(collated)) } else if (menu == "stats") { - pagecomponents.push(new TextDisplayBuilder().setContent(statsGeneratePage(inspectuserID))) + pagecomponents.push(new TextDisplayBuilder().setContent(statsGeneratePage(serverID, inspectuserID))) } return { components: pagecomponents, flags: [MessageFlags.IsComponentsV2, MessageFlags.Ephemeral] }; From a8278ea931887cc0e68b4aafcc04cabe240c519b Mon Sep 17 00:00:00 2001 From: Enraa Date: Sat, 20 Jun 2026 00:04:46 -0700 Subject: [PATCH 22/44] My hubris --- functions/pronounfunctions.js | 8 +- functions/statsfunctions.js | 12 +-- functions/textfunctions.js | 121 ++++++++++++++-------------- functions/timefunctions.js | 142 ++++++++++++++++++--------------- functions/timelockfunctions.js | 111 +++++++++++++++----------- 5 files changed, 213 insertions(+), 181 deletions(-) diff --git a/functions/pronounfunctions.js b/functions/pronounfunctions.js index 3438a6b0..dbca45d1 100644 --- a/functions/pronounfunctions.js +++ b/functions/pronounfunctions.js @@ -25,19 +25,19 @@ const remindPronouns = async (serverID, user) => { collector.on("collect", async (i) => { console.log(i); if (i.customId == "sheher") { - setPronouns(user, "she/her") + setPronouns(serverID, user, "she/her") await i.update({ content: 'Set your pronouns to She/Hers!', components: [] }) } else if (i.customId == "hehim") { - setPronouns(user, "he/him") + setPronouns(serverID, user, "he/him") await i.update({ content: 'Set your pronouns to He/Him!', components: [] }) } else if (i.customId == "theythem") { - setPronouns(user, "they/them") + setPronouns(serverID, user, "they/them") await i.update({ content: 'Set your pronouns to They/Them!', components: [] }) } else if (i.customId == "itits") { - setPronouns(user, "it/its") + setPronouns(serverID, user, "it/its") await i.update({ content: 'Set your pronouns to It/Its!', components: [] }) } }); diff --git a/functions/statsfunctions.js b/functions/statsfunctions.js index fe70adc3..18b31889 100644 --- a/functions/statsfunctions.js +++ b/functions/statsfunctions.js @@ -66,8 +66,8 @@ function statsGeneratePage(serverID, user) { { name: "Longest Chastity Belt Worn", type: "special", - special: (user) => { - let maxduration = Math.max(statsGetCounter(user, "chastitywornduration") ?? 0, ((process.chastity[user]) ? Date.now() - process.chastity[user].timestamp : 0)) + special: (serverID, user) => { + let maxduration = Math.max(statsGetCounter(serverID, user, "chastitywornduration") ?? 0, ((process.chastity[serverID][user]) ? Date.now() - process.chastity[serverID][user].timestamp : 0)) console.log(maxduration); if (maxduration == 0) { return "Never Worn" @@ -80,8 +80,8 @@ function statsGeneratePage(serverID, user) { { name: "Longest Chastity Bra Worn", type: "special", - special: (user) => { - let maxduration = Math.max(statsGetCounter(user, "chastitybrawornduration") ?? 0, ((process.chastitybra[user]) ? Date.now() - process.chastitybra[user].timestamp : 0)) + special: (serverID, user) => { + let maxduration = Math.max(statsGetCounter(serverID, user, "chastitybrawornduration") ?? 0, ((process.chastitybra[serverID][user]) ? Date.now() - process.chastitybra[serverID][user].timestamp : 0)) console.log(maxduration); if (maxduration == 0) { return "Never Worn" @@ -145,10 +145,10 @@ function statsGeneratePage(serverID, user) { statstogenerate[statgroup].forEach((textstat) => { if (textstat.type == "counter") { - outtext = `${outtext}-# • ${textstat.name}: **${statsGetCounter(user, textstat.stat) ?? 0}**\n` + outtext = `${outtext}-# • ${textstat.name}: **${statsGetCounter(serverID, user, textstat.stat) ?? 0}**\n` } else if (textstat.type == "special") { - outtext = `${outtext}-# • ${textstat.name}: **${textstat.special(user)}**\n` + outtext = `${outtext}-# • ${textstat.name}: **${textstat.special(serverID, user)}**\n` } }) }) diff --git a/functions/textfunctions.js b/functions/textfunctions.js index 29c4ae06..bb4e25cb 100644 --- a/functions/textfunctions.js +++ b/functions/textfunctions.js @@ -3,6 +3,7 @@ const { getChastity } = require("./getters/chastity/getChastity.js"); const { getChastityBra } = require("./getters/chastity/getChastityBra.js"); const { getCollar } = require("./getters/collar/getCollar.js"); const { getUserTags } = require("./getters/config/getUserTags.js"); +const { getGag } = require("./getters/gag/getGag.js"); const { getHeadwearRestrictions } = require("./getters/headwear/getHeadwearRestrictions.js"); const { getHeavy } = require("./getters/heavy/getHeavy.js"); const { convertPronounsText } = require("./other/convertPronounsText.js"); @@ -22,7 +23,7 @@ const texts_chastity = { key_other: [`You are already locked in a chastity belt and TARGET_TAG has the key!`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `You are already wearing a chastity seal with access keyed to TARGET_TAG!`, }, @@ -30,7 +31,7 @@ const texts_chastity = { key_self: [`You are already locked in a chastity belt and you're holding the key!`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `You are already wearing a chastity seal keyed to you!`, }, @@ -1402,7 +1403,7 @@ const texts_key = { `USER_TAG smirks at TARGET_TAG before tossing TARGET_THEIR VAR_C1 key off into the nether.`, { required: (t) => { - return !getHeadwearRestrictions(t.targetuser.id).canInspect; + return !getHeadwearRestrictions(t.serverID, t.targetuser.id).canInspect; }, text: `USER_TAG taunts TARGET_TAG with TARGET_THEIR key for a moment, dangling it in front of TARGET_THEIR eyes before flinging it away.`, } @@ -1452,33 +1453,33 @@ const texts_letgo = { { required: (t) => { let blacklistTypes = ["livingwood", "seal"] - return getChastity(t.interactionuser.id)?.chastitytype ? !blacklistTypes.some(blacklistTypes => getChastity(t.interactionuser.id)?.chastitytype.includes(blacklistTypes)) : true; + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype ? !blacklistTypes.some(blacklistTypes => getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes(blacklistTypes)) : true; }, text: `USER_TAG tries to get over the edge but is denied by USER_THEIR steel prison!`, }, { required: (t) => { let blacklistTypes = ["livingwood", "seal"] - return getChastity(t.interactionuser.id)?.chastitytype ? !blacklistTypes.some(blacklistTypes => getChastity(t.interactionuser.id)?.chastitytype.includes(blacklistTypes)) : true; + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype ? !blacklistTypes.some(blacklistTypes => getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes(blacklistTypes)) : true; }, text: `USER_TAG tries to rub the cold steel of USER_THEIR chastity belt, but USER_THEY can't feel anything!`, }, { required: (t) => { let blacklistTypes = ["seal"] - return getChastity(t.interactionuser.id)?.chastitytype ? !blacklistTypes.some(blacklistTypes => getChastity(t.interactionuser.id)?.chastitytype.includes(blacklistTypes)) : true; + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype ? !blacklistTypes.some(blacklistTypes => getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes(blacklistTypes)) : true; }, text: `USER_TAG frantically *claws* at USER_THEIR chastity belt, but it offers no sensation!`, }, { required: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("livingwood"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("livingwood"); }, text: `USER_TAG struggles fruitlessly to get over the edge, aggitating USER_THEIR livingwood chastity and causing its tendrils to squirm more insistently~!`, }, { required: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG struggles fruitlessly to get over the edge, but the magics in the seal applied to USER_THEM prevent USER_THEM from touching USER_THEMSELF~!`, } @@ -1782,19 +1783,19 @@ const texts_struggle = { { required: (t) => { let blacklistTypes = ["livingwood", "seal"] - return getChastity(t.interactionuser.id)?.chastitytype ? !blacklistTypes.some(blacklistTypes => getChastity(t.interactionuser.id)?.chastitytype.includes(blacklistTypes)) : true + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype ? !blacklistTypes.some(blacklistTypes => getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes(blacklistTypes)) : true }, text: `USER_TAG wiggles USER_THEIR thighs to make USER_THEIR VAR_C4 sit more comfortably. Steel is so *unforgiving.*`, }, { required: (t) => { - getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal") + getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal") }, text: `USER_TAG tries to touch the VAR_C4, but the magic in the seal repels USER_THEIR fingers!`, }, { required: (t) => { - return getChastity(t.interactionuser.id)?.timestamp + 7200000 < Date.now(); + return getChastity(t.serverID, t.interactionuser.id)?.timestamp + 7200000 < Date.now(); }, text: `USER_TAG sighs as USER_THEY USER_TRY to fumble with USER_THEIR VAR_C4. When was the last time USER_THEY had freedom or relief?`, }, @@ -1814,21 +1815,21 @@ const texts_struggle = { { required: (t) => { let blacklistTypes = ["livingwood", "seal"] - return getChastity(t.interactionuser.id)?.chastitytype ? !blacklistTypes.some(blacklistTypes => getChastity(t.interactionuser.id)?.chastitytype.includes(blacklistTypes)) : true + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype ? !blacklistTypes.some(blacklistTypes => getChastity(t.serverID, t.serverID, t.interactionuser.id)?.chastitytype.includes(blacklistTypes)) : true }, text: `USER_TAG caresses the smooth metal of USER_THEIR VAR_C4, but the lock holds it snugly to USER_THEIR hips!`, }, { required: (t) => { let blacklistTypes = ["seal"] - return getChastity(t.interactionuser.id)?.chastitytype ? !blacklistTypes.some(blacklistTypes => getChastity(t.interactionuser.id)?.chastitytype.includes(blacklistTypes)) : true + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype ? !blacklistTypes.some(blacklistTypes => getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes(blacklistTypes)) : true }, text: `USER_TAG squeezes USER_THEIR thumb under the waistband of USER_THEIR VAR_C4, but can accomplish little more than shift it a bit.`, }, { required: (t) => { let blacklistTypes = ["seal"] - return getChastity(t.interactionuser.id)?.chastitytype ? !blacklistTypes.some(blacklistTypes => getChastity(t.interactionuser.id)?.chastitytype.includes(blacklistTypes)) : true + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype ? !blacklistTypes.some(blacklistTypes => getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes(blacklistTypes)) : true }, text: `USER_TAG tries to get a couple of fingers under USER_THEIR VAR_C4, but it's quite challenging to do so. USER_THEY_CAP should use the key!`, }, @@ -1860,7 +1861,7 @@ const texts_struggle = { `USER_TAG runs USER_THEIR hands over the VAR_C6 on USER_THEIR chest, whining softly as USER_THEY struggles to get any sensation on USER_THEIR breasts~.`, { required: (t) => { - return !getChastityBra(t.interactionuser.id)?.chastitytype.includes("livingwood"); + return !getChastityBra(t.serverID, t.interactionuser.id)?.chastitytype.includes("livingwood"); }, text: `USER_TAG dances USER_THEIR fingers on the smooth exterior trapping USER_THEIR breasts. The unyielding steel denies USER_THEM any reprieve.` } @@ -1900,13 +1901,13 @@ const texts_struggle = { // Using open hand, wrists, etc. 50% chance to use with mittens, 50% chance to use with free hands nofingers: [{ required: (t) => { - return !getUserTags(t.interactionuser.id).includes("pet"); + return !getUserTags(t.serverID, t.interactionuser.id).includes("pet"); }, text: `USER_TAG prods at USER_THEIR collar. Such a good pet. Yes. That is USER_THEM! šŸ’œ` }, `USER_TAG twists USER_THEIR head, trying to get some kind of grip on USER_THEIR VAR_C5 to pull it off, but... no dice.`, { required: (t) => { - return !getUserTags(t.interactionuser.id).includes("pet"); + return !getUserTags(t.serverID, t.interactionuser.id).includes("pet"); }, text: `Using USER_THEIR wrists, USER_TAG tries to fidget with USER_THEIR VAR_C5. USER_THEIR_CAP elbows projected out looks adorable, almost pet-like!`}], // In mittens, so definitely no fingers. 50% chance to use with mittens, 0% chance with free hands @@ -1950,20 +1951,20 @@ const texts_struggle = { `USER_TAG twirls USER_THEIR hair absentmindedly. Someone should tie USER_THEM up with more bondage, tehe!~`, { required: (t) => { - return !(process.gags && process.gags[t.serverid][t.interactionuser.id] && Math.random() > 0.75); + return !(getGag(t.serverID, t.interactionuser.id) && Math.random() > 0.75); }, text: `USER_TAG clears USER_THEIR throat and then begins to speak: The FitnessGram Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues. The 20 meter pacer test will begin in 30 seconds. Line up at the start. The running speed starts slowly but gets faster each minute after you hear this signal bodeboop. A single lap should be completed every time you hear this sound. ding Remember to run in a straight line and run as long as possible. The second time you fail to complete a lap before the sound, your test is over. The test will begin on the word start. On your mark. Get ready!… Start.`, }, `USER_TAG's mind is fantasizing about the cute characters in that last anime USER_THEY watched. Everyone should ask USER_THEM about it!`, { required: (t) => { - return !(process.gags && process.gags[t.serverid][t.interactionuser.id] && Math.random() > 0.75); + return !(getGag(t.serverID, t.interactionuser.id) && Math.random() > 0.75); }, text: `USER_TAG's voice echoes through the halls as USER_THEY monologueUSER_S: ***Tell me, for whom do you fight...***`, }, { required: (t) => { - return !(process.gags && process.gags[t.serverid][t.interactionuser.id] && Math.random() > 0.75); + return !(getGag(t.serverID, t.interactionuser.id) && Math.random() > 0.75); }, text: `USER_TAG pauses for a second, then begins to speak in a sultry tone: Hello Ladies~. Look at your outfit, now back to me, now back to your outfit, now back to me. Sadly, your outfit can't be mine~. But if you jumped into a Mimic instead of using the /wear command, it could look close to mine! Look down, back up, where are you? In my RP Thread! What's in your hand, back at me. I have it, it's the keys to your Collar and Belt! Look again, the keys are now vibes! Look down again, Back up. Where are you? Strapped in Display Stand! Now Cum for me~. Anything is possible when you dress using a Mimic and not by yourself! I'm on a (wooden) horse!`, }, @@ -1982,7 +1983,7 @@ const texts_struggle = { `USER_TAG wants to pet a cute kitty. Or a cute doggo. Maybe lots of cute kitties and doggos!`, { required: (t) => { - return !getUserTags(t.interactionuser.id).includes("pet"); + return !getUserTags(t.serverID, t.interactionuser.id).includes("pet"); }, text: `USER_TAG wonders what it would be like to be a pet kitty. Or a pet doggo. USER_THEY_CAP blushUSER_ES a little at the thought~` }, @@ -1991,14 +1992,14 @@ const texts_struggle = { // 2 hours in chastity { required: (t) => { - return !isNaN(getChastity(t.interactionuser.id)?.timestamp) && getChastity(t.interactionuser.id)?.timestamp + 7200000 < Date.now(); + return !isNaN(getChastity(t.serverID, t.interactionuser.id)?.timestamp) && getChastity(t.serverID, t.interactionuser.id)?.timestamp + 7200000 < Date.now(); }, text: `USER_TAG absentmindedly fidgets, thinking about the last time USER_THEY could let go...`, }, // 24 hours in chastity { required: (t) => { - return !isNaN(getChastity(t.interactionuser.id)?.timestamp) && getChastity(t.interactionuser.id)?.timestamp + 86400000 < Date.now(); + return !isNaN(getChastity(t.serverID, t.interactionuser.id)?.timestamp) && getChastity(t.serverID, t.interactionuser.id)?.timestamp + 86400000 < Date.now(); }, text: `USER_TAG barely remembers what it's like to not be in chastity...`, }, @@ -2013,7 +2014,7 @@ const texts_struggle = { `Spinning around with a dramatic flourish, USER_TAG puts a hand to USER_THEIR face and yells "Persona!" as a ghostly image of a persona appears in front of USER_THEM!`, { required: (t) => { - return (!getHeavy(t.interactionuser.id)) || (getHeavy(t.interactionuser.id) && !getHeavy(t.interactionuser.id).type.includes("rmbinder")) + return (!getHeavy(t.serverID, t.interactionuser.id)) || (getHeavy(t.serverID, t.interactionuser.id) && !getHeavy(t.serverID, t.interactionuser.id).type.includes("rmbinder")) }, text: `USER_TAG pokes an armbinder, imagining what it would be like to have USER_THEIR arms pulled so tightly behind USER_THEM with it...`, }, @@ -2028,7 +2029,7 @@ const texts_struggle = { `USER_TAG wonders about the implications on if a tree falls in a forest with nobody around to hear it, would it make a sound?`, { required: (t) => { - return !getUserTags(t.interactionuser.id).includes("latex"); + return !getUserTags(t.serverID, t.interactionuser.id).includes("latex"); }, text: `USER_TAG considers what it would be like to live on a planet full of latex and bondage. There's a certain story out there about that fantasy...` }, @@ -2036,7 +2037,7 @@ const texts_struggle = { `USER_TAG wants to be the very best! Like no one ever was! To catch them is USER_THEIR great quest - to train them is USER_THEIR call!`, { required: (t) => { - return !(process.gags && process.gags[t.serverid][t.interactionuser.id]); + return !getGag(t.serverID, t.interactionuser.id); }, text: `USER_TAG produces a deck of cards and pulls one out with a dramatic flourish, holding it up while shouting, "It's time to d-d-d-d-d-duel!`, }, @@ -2169,23 +2170,23 @@ const texts_touch = { { // If both parties like pet play... required: (t) => { - return !(getUserTags(t.interactionuser.id).includes("pet") && getUserTags(t.targetuser.id).includes("pet")); + return !(getUserTags(t.serverID, t.interactionuser.id).includes("pet") && getUserTags(t.serverID, t.targetuser.id).includes("pet")); }, text: `USER_TAG imagines USER_THEY USER_ISARE petting a pet as USER_THEY placeUSER_S USER_THEIR hand on TARGET_TAG's head.` }, { // If both parties havent blocked pet tag and the interaction user has targetuser's collar key, this can happen! required: (t) => { - return (!(getUserTags(t.interactionuser.id).includes("pet") && getUserTags(t.targetuser.id).includes("pet")) && - (getCollar(t.targetuser.id)?.keyholder == t.interactionuser.id) || (getCollar(t.targetuser.id)?.clonedKeyholders && getCollar(t.targetuser.id)?.clonedKeyholders.includes(t.interactionuser.id))); + return (!(getUserTags(t.serverID, t.interactionuser.id).includes("pet") && getUserTags(t.serverID, t.targetuser.id).includes("pet")) && + (getCollar(t.serverID, t.targetuser.id)?.keyholder == t.interactionuser.id) || (getCollar(t.serverID, t.targetuser.id)?.clonedKeyholders && getCollar(t.serverID, t.targetuser.id)?.clonedKeyholders.includes(t.interactionuser.id))); }, text: `USER_TAG runs USER_THEIR hand over USER_THEIR beautiful and loyal pet's head! TARGET_TAG shines in delight!` }, { // If both parties havent blocked pet tag and the interaction user has targetuser's collar key, this can happen! required: (t) => { - return (!(getUserTags(t.interactionuser.id).includes("pet") && getUserTags(t.targetuser.id).includes("pet")) && - (getCollar(t.targetuser.id)?.keyholder == t.interactionuser.id) || (getCollar(t.targetuser.id)?.clonedKeyholders && getCollar(t.targetuser.id)?.clonedKeyholders.includes(t.interactionuser.id))); + return (!(getUserTags(t.serverID, t.interactionuser.id).includes("pet") && getUserTags(t.serverID, t.targetuser.id).includes("pet")) && + (getCollar(t.serverID, t.targetuser.id)?.keyholder == t.interactionuser.id) || (getCollar(t.serverID, t.targetuser.id)?.clonedKeyholders && getCollar(t.serverID, t.targetuser.id)?.clonedKeyholders.includes(t.interactionuser.id))); }, text: `USER_TAG plays with TARGET_TAG's ears as USER_THEY patUSER_S USER_THEIR bestest pet! TARGET_THEY_CAP TARGET_ISARE such a good TARGET_PRAISEOBJECT! Yes TARGET_THEY TARGET_ISARE!` }, @@ -2291,7 +2292,7 @@ const texts_toy = { `USER_TAG bucks USER_THEIR hips over towards a VAR_C2 despite USER_THEIR VAR_C1, but USER_THEIR chastity belt prevents USER_THEM from putting the toy inside anyway.`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG bucks USER_THEIR hips over towards a VAR_C2 despite USER_THEIR VAR_C1, but the seal on USER_THEM would prevent USER_THEM putting the toy inside anyway~.`, }, @@ -2300,7 +2301,7 @@ const texts_toy = { `USER_TAG bucks USER_THEIR hips over towards a VAR_C2 despite USER_THEIR VAR_C1, but USER_THEIR chastity belt prevents USER_THEM from putting the toy inside anyway.`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG bucks USER_THEIR hips over towards a VAR_C2 despite USER_THEIR VAR_C1, but the seal on USER_THEM would prevent USER_THEM putting the toy inside anyway~.`, }, @@ -2548,7 +2549,7 @@ const texts_toy = { `USER_TAG puts the key in USER_THEIR belt, unlocking it and adding a VAR_C2, turned up to VAR_C3! USER_THEY_CAP then closeUSER_S and lockUSER_S USER_THEMSELF back up.`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG disables the magics of USER_THEIR seal, allowing USER_THEM to add a VAR_C2, turned up to VAR_C3! USER_THEY_CAP then reactivateUSER_S the seal, denying USER_THEMSELF access once more.`, }, @@ -2572,7 +2573,7 @@ const texts_toy = { `USER_TAG puts the key in USER_THEIR belt, unlocking it and adding a VAR_C2 with a width of VAR_C3! USER_THEY_CAP then closeUSER_S and lockUSER_S USER_THEMSELF back up.`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG disables the magics of USER_THEIR seal, allowing USER_THEM to add a VAR_C2 with a width of VAR_C3! USER_THEY_CAP then reactivateUSER_S the seal, denying USER_THEMSELF access once more.`, }, @@ -2618,7 +2619,7 @@ const texts_toy = { `USER_TAG tries as USER_THEY might, but is unable to unlock USER_THEIR chastity belt to add a VAR_C2.`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG tries as USER_THEY might, but is unable to bypass the magics of USER_THEIR seal to add a VAR_C2.`, }, @@ -2966,7 +2967,7 @@ const texts_unchastity = { chastity: [`USER_TAG shifts in USER_THEIR VAR_C1, trying to squirm out of USER_THEIR chastity belt, but USER_THEIR metal prison holds firmly to USER_THEIR body!`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG shifts in USER_THEIR VAR_C1, trying to detatch USER_THEIR seal, but paper tag remains stubbornly attached to USER_THEIR body!`, }, @@ -2994,7 +2995,7 @@ const texts_unchastity = { nokey: [`USER_TAG runs USER_THEIR fingers uselessly on the metal of USER_THEIR chastity belt, but USER_THEY can't unlock it without the key!`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG reaches USER_THEIR fingers uselessly towards USER_THEIR seal, but USER_THEIR fingers can't bypass the magic protections!`, }, @@ -3151,7 +3152,7 @@ const texts_uncorset = { `Since USER_THEY USER_DOESNT have arms, USER_TAG wiggles USER_THEIR torso a little bit, trying to slink off USER_THEIR VAR_C2, but USER_THEIR chastity belt is in the way.`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `Since USER_THEY USER_DOESNT have arms free, USER_TAG wiggles USER_THEIR torso a little bit, trying to slink off USER_THEIR VAR_C2, but USER_THEIR seal prevents USER_THEM from removing it.`, }, @@ -3182,7 +3183,7 @@ const texts_uncorset = { nokey: [`USER_TAG tugs at USER_THEIR chastity belt to try to remove USER_THEIR VAR_C2, but the locking mechanism holds firm!`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG franticaly attempts to bypass the magic of USER_THEIR chastity seal to try to remove USER_THEIR VAR_C2, but the magics deny them access!`, }, @@ -3876,7 +3877,7 @@ const texts_untoy = { `USER_TAG bucks USER_THEIR hips to remove USER_THEIR VAR_C2 despite USER_THEIR VAR_C1, but USER_THEIR chastity belt prevents USER_THEM from getting to it.`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG bucks USER_THEIR hips to remove USER_THEIR VAR_C2 despite USER_THEIR VAR_C1, but USER_THEIR seal traps it inside USER_THEM.`, }, @@ -4052,7 +4053,7 @@ const texts_untoy = { `USER_TAG tries as USER_THEY might, but is unable to unlock USER_THEIR chastity belt to remove USER_THEIR VAR_C2.`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG tries as USER_THEY might, but is unable to breach the protections of USER_THEIR seal to remove USER_THEIR VAR_C2.`, }, @@ -4061,7 +4062,7 @@ const texts_untoy = { `USER_TAG tries as USER_THEY might, but is unable to unlock USER_THEIR chastity belt to remove USER_THEIR VAR_C2.`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG tries as USER_THEY might, but is unable to breach the protections of USER_THEIR seal to remove USER_THEIR VAR_C2.`, }, @@ -4272,7 +4273,7 @@ const texts_unvibe = { `USER_TAG tries to knock USER_THEIR VAR_C2 off with USER_THEIR thighs, but USER_THEY can't because USER_THEIR arms are useless from USER_THEIR VAR_C1. Well, and USER_THEIR chastity belt of course!`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG tries to knock USER_THEIR VAR_C2 off with USER_THEIR thighs, but USER_THEY can't because USER_THEIR arms are useless from USER_THEIR VAR_C1. Well, and USER_THEIR chastity seal of course!`, }, @@ -4281,7 +4282,7 @@ const texts_unvibe = { `USER_TAG tries to knock USER_THEIR vibrators off with USER_THEIR thighs, but USER_THEY can't because USER_THEIR arms are useless from USER_THEIR VAR_C1. Well, and USER_THEIR chastity belt of course!`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG tries to knock USER_THEIR vibrators off with USER_THEIR thighs, but USER_THEY can't because USER_THEIR arms are useless from USER_THEIR VAR_C1. Well, and USER_THEIR chastity seal of course!`, }, @@ -4313,7 +4314,7 @@ const texts_unvibe = { `USER_TAG claws feverishly at USER_THEIR belt, the agonizing vibrators offering USER_THEM no reprieve from their sweet sensation!`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG claws feverishly at USER_THEIR seal but fail to bypass it, the agonizing vibrators offering USER_THEM no reprieve from their sweet sensation!`, }, @@ -4660,7 +4661,7 @@ const texts_vibe = { nofumble: { single: [`USER_TAG puts the key in USER_THEIR belt, unlocking it and adjusting the VAR_C2 to VAR_C3 power! USER_THEY_CAP then closeUSER_S and lockUSER_S USER_THEMSELF back up.`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG disables the magic in USER_THEIR seal, removing it before adding a VAR_C2 set to VAR_C3! USER_THEY_CAP then replaceUSER_S and reactivateUSER_S the seal.`, }, @@ -4671,7 +4672,7 @@ const texts_vibe = { nokey: [`USER_TAG prods at USER_THEIR belt, trying to open it to play with a vibe, but the belt is locked tightly!`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG tries to slip past USER_THEIR seal to play with a vibe, but the seal's magics deny USER_THEM access!`, }, @@ -4689,7 +4690,7 @@ const texts_vibe = { nofumble: { single: [`USER_TAG puts the key in USER_THEIR belt, unlocking it before adding a VAR_C2 set to VAR_C3! USER_THEY_CAP then closeUSER_S and lockUSER_S USER_THEMSELF back up.`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG disables the magic in USER_THEIR seal, removing it before adding a VAR_C2 set to VAR_C3! USER_THEY_CAP then replaceUSER_S and reactivateUSER_S the seal.`, }, @@ -4700,7 +4701,7 @@ const texts_vibe = { nokey: [`USER_TAG prods at USER_THEIR belt, trying to open it to play with a vibe, but the belt is locked tightly!`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG tries to slip past USER_THEIR seal to play with a vibe, but the seal's magics deny USER_THEM access!`, }, @@ -4903,13 +4904,13 @@ const texts_wear = { }, { only: (t) => { - return t.c2.includes("Kissmark") && getWearable(t.interactionuser.id).filter((f) => f.includes("lipstick")).length > 0; + return t.c2.includes("Kissmark") && getWearable(t.serverID, t.interactionuser.id).filter((f) => f.includes("lipstick")).length > 0; }, text: `USER_TAG kisses TARGET_TAG, leaving a VAR_C2 on TARGET_THEIR cheek!`, }, { only: (t) => { - return t.c2.includes("Kissmark") && getWearable(t.interactionuser.id).filter((f) => f.includes("lipstick")).length == 0; + return t.c2.includes("Kissmark") && getWearable(t.serverID, t.interactionuser.id).filter((f) => f.includes("lipstick")).length == 0; }, text: `USER_TAG applies some lipstick to USER_THEIR lips, and then kisses TARGET_TAG, leaving a VAR_C2 on TARGET_THEIR cheek! USER_THEY_CAP then removeUSER_S the lipstick.`, }, @@ -5027,7 +5028,7 @@ const texts_timelock = { chastitybelt: [`USER_TAG puts a timelock on USER_THEIR chastity belt, locking it firmly! The timelock's magic wards away USER_THEIR hands but others may be able to do things to USER_THEM...`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG tweaks the magics of USER_THEIR chastity seal, locking it in time! The magic now wards away USER_THEIR hands but others may still be able to do things to USER_THEM...`, }, @@ -5050,7 +5051,7 @@ const texts_timelock = { self: { chastitybelt: [`USER_TAG puts a timelock on USER_THEIR chastity belt, locking it firmly! The timelock reads "No Access" on it as it begins to count down...`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG tweaks the magics of USER_THEIR chastity seal, locking it in time! The magic now wards away everyone's hands until the changes fade away...`, }, @@ -5060,7 +5061,7 @@ const texts_timelock = { other: { chastitybelt: [`USER_TAG puts a timelock on TARGET_TAG's chastity belt, locking it firmly! The timelock reads "TARGET_TAG" on it as it begins to count down...`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG tweaks the magics of USER_THEIR chastity seal, locking it in time! The magic now wards away all but TARGET_TAG's hands until the changes fade away...`, }, @@ -5071,7 +5072,7 @@ const texts_timelock = { self: { chastitybelt: [`USER_TAG puts a timelock on USER_THEIR chastity belt, locking it firmly! The timelock reads "No Access" on it as it begins to count down...`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG tweaks the magics of USER_THEIR chastity seal, locking it in time! The magic now wards away everyone's hands until the changes fade away...`, }, @@ -5080,7 +5081,7 @@ const texts_timelock = { khother: { chastitybelt: [`USER_TAG puts a timelock on USER_THEIR chastity belt, locking it firmly! The timelock reads "No Access" on it as it begins to count down...`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG tweaks the magics of USER_THEIR chastity seal, locking it in time! The magic now wards away everyone's hands until the changes fade away...`, }, @@ -5089,7 +5090,7 @@ const texts_timelock = { other: { chastitybelt: [`USER_TAG puts a timelock on TARGET_TAG's chastity belt, locking it firmly! The timelock reads "No Access" on it as it begins to count down...`, { only: (t) => { - return getChastity(t.interactionuser.id)?.chastitytype && getChastity(t.interactionuser.id)?.chastitytype.includes("seal"); + return getChastity(t.serverID, t.interactionuser.id)?.chastitytype && getChastity(t.serverID, t.interactionuser.id)?.chastitytype.includes("seal"); }, text: `USER_TAG tweaks the magics of USER_THEIR chastity seal, locking it in time! The magic now wards away everyone's hands until the changes fade away...`, }, @@ -5483,9 +5484,9 @@ const getTextGeneric = (type, data_in) => { `USER_TAG twists USER_THEIR body at the sensation as USER_THEY pressUSER_S the button on USER_THEIR shock collar!`, { required: (t) => { - !process.gags[t.serverid][t.interactionuser.id] + !getGag(t.serverID, t.interactionuser.id) }, - text: `USER_TAG bites USER_THEIR lip ` + text: `USER_TAG bites USER_THEIR lip as the shock sends a thrilling sensation through USER_THEIR body!` } ], remotecontrolshock_self_painful: [ diff --git a/functions/timefunctions.js b/functions/timefunctions.js index bc9a99c2..69d73482 100644 --- a/functions/timefunctions.js +++ b/functions/timefunctions.js @@ -107,6 +107,11 @@ const backupsAreAnnoying = () => { let dest = path.resolve(filepath, "backups"); let files = fs.readdirSync(filepath).filter((file) => file.endsWith(".txt")); + // Blacklist filenames to NOT save. If a file starts with any of these, they will NOT be preserved in the backup. + // This is explicitly to prevent retaining sensitive user data or a big crash log file. + let blacklistnames = ["recordedmessages.txt", "crashlog.txt"] + files = files.filter((f) => !blacklistnames.includes(f)); + let zip = new admZip(); let timestring = getTimestringForZip(); @@ -291,24 +296,30 @@ function processTimedEvents() { function processUnlockTimes(client) { let now = Date.now(); if (process.chastity) { - Object.keys(process.chastity).forEach((person) => { - if (process.chastity[person]?.unlockTime < now) { - unlockTimelockChastity(client, person); - } + Object.keys(process.chastity).forEach((server) => { + Object.keys(process.chastity[server]).forEach((person) => { + if (process.chastity[server][person]?.unlockTime < now) { + unlockTimelockChastity(server, client, person); + } + }) }); } if (process.chastitybra) { - Object.keys(process.chastitybra).forEach((person) => { - if (process.chastitybra[person]?.unlockTime < now) { - unlockTimelockChastityBra(client, person); - } + Object.keys(process.chastitybra).forEach((server) => { + Object.keys(process.chastitybra[server]).forEach((person) => { + if (process.chastitybra[server][person]?.unlockTime < now) { + unlockTimelockChastityBra(server, client, person); + } + }) }); } if (process.collar) { - Object.keys(process.collar).forEach((person) => { - if (process.collar[person]?.unlockTime < now) { - unlockTimelockCollar(client, person); - } + Object.keys(process.collar).forEach((server) => { + Object.keys(process.collar[server]).forEach((person) => { + if (process.collar[server][person]?.unlockTime < now) { + unlockTimelockCollar(server, client, person); + } + }) }); } } @@ -422,45 +433,47 @@ function checkFumbledTemporaryKeys() { let processvars = ["collar", "chastity", "chastitybra"]; processvars.forEach((pv) => { if (process[pv] == undefined) { process[pv] = {} } - Object.entries(process[pv]).forEach(async (en) => { - try { - if (en[1]?.fumbled && en[1]?.temporarykeyholdertime && (en[1]?.temporarykeyholdertime < Date.now())) { - let data = { - interactionuser: { id: en[1].temporarykeyholder }, - targetuser: { id: en[0] } - } + Object.keys(process[pv]).forEach((server) => { + Object.entries(process[pv][server]).forEach(async (en) => { + try { + if (en[1]?.fumbled && en[1]?.temporarykeyholdertime && (en[1]?.temporarykeyholdertime < Date.now())) { + let data = { + interactionuser: { id: en[1].temporarykeyholder }, + targetuser: { id: en[0] } + } - delete en[1].fumbled; - delete en[1].temporarykeyholdertime; - delete en[1].temporarykeyholder; + delete en[1].fumbled; + delete en[1].temporarykeyholdertime; + delete en[1].temporarykeyholder; - if ((pv == "chastity") || (pv == "chastitybra")) { - let def = (pv == "chastity") ? "belt" : "bra" - data.c1 = getBaseChastity(en[1].chastitytype ?? `${def}_silver`).name - } - else if (pv == "collar") { - data.c1 = getBaseCollar(en[1].collartype ?? `collar_leather`).name - } + if ((pv == "chastity") || (pv == "chastitybra")) { + let def = (pv == "chastity") ? "belt" : "bra" + data.c1 = getBaseChastity(en[1].chastitytype ?? `${def}_silver`).name + } + else if (pv == "collar") { + data.c1 = getBaseCollar(en[1].collartype ?? `collar_leather`).name + } - // Now that @___ has had her fun, she returns the keys for @___'s chastity belt. - if (process.recentmessages[en[0]]) { - messageSendChannel(getTextGeneric(`returnkeysfromfumble`, data), process.recentmessages[en[0]]) - } - else if (process.recentmessages[data.interactionuser.id]) { - messageSendChannel(getTextGeneric(`returnkeysfromfumble`, data), process.recentmessages[data.interactionuser.id]) - } - else { - console.log("No suitable channel found for returning temp key.") + // Now that @___ has had her fun, she returns the keys for @___'s chastity belt. + if (process.recentmessages[en[0]]) { + messageSendChannel(getTextGeneric(`returnkeysfromfumble`, data), process.recentmessages[en[0]]) + } + else if (process.recentmessages[data.interactionuser.id]) { + messageSendChannel(getTextGeneric(`returnkeysfromfumble`, data), process.recentmessages[data.interactionuser.id]) + } + else { + console.log("No suitable channel found for returning temp key.") + } + + markForSave("collar"); + markForSave("chastity"); + markForSave("chastitybra"); } - - markForSave("collar"); - markForSave("chastity"); - markForSave("chastitybra"); } - } - catch (err) { - console.log(err) - } + catch (err) { + console.log(err) + } + }) }) }) } @@ -469,29 +482,28 @@ function checkFumbledTemporaryKeys() { // If the user does NOT exist in any of them, then remove. async function scavengeUsers(client) { let processvars = ["wearable", "gags", "mitten", "chastity", "chastitybra", "chastitybra", "arousal", "toys", "collar", "heavy", "pronouns", "usercontext", "consented", "corset", "headwear", "outfits"] - let allguilds = await client.guilds.fetch(); - let allguildslist = []; // array of guild member maps - for (const guild of allguilds) { - let guildfetched = await client.guilds.fetch(guild[0]) - let guildmembers = await guildfetched.members.fetch() - allguildslist.push(guildmembers); - } + await client.guilds.fetch(); processvars.forEach(async (v) => { - if (process[v]) { - Object.keys(process[v]).forEach((k) => { - let found = false; - allguildslist.forEach((g) => { - if (g.get(k)) { found = true } - }) - if (!found) { - // DELETE THIS - console.log(`Key ${k} missing from all guilds, run on ${v}.`) - if (process[v][k]) { - delete process[v][k] + if (process[v] == undefined) { process[v] = {} } + Object.keys(process[v]).forEach(async (server) => { + let guildfetched = await client.guilds.fetch(server) + Object.keys(process[v][server]).forEach(async (person) => { + if (guildfetched) { + try { + if (!(await guildfetched.members.fetch(person))) { + delete process[v][server][person] // This person did NOT fetch successfully, so get rid of them. + } } + catch (err) { + console.log(`Crashed while fetching ${person} lol`); + console.log(err); + } + } + else { + console.log(`Guild doesn't exist!`) } }) - } + }) }) } diff --git a/functions/timelockfunctions.js b/functions/timelockfunctions.js index 78e07680..86a7c989 100644 --- a/functions/timelockfunctions.js +++ b/functions/timelockfunctions.js @@ -14,6 +14,9 @@ const { transferChastityKey } = require("./setters/chastity/transferChastityKey. const { transferChastityBraKey } = require("./setters/chastity/transferChastityBraKey.js"); const { markForSave } = require("./other/markForSave.js"); const { traceFirstParam } = require("./other/TESTS/traceFirstParam.js"); +const { getChastity } = require("./getters/chastity/getChastity.js"); +const { getChastityBra } = require("./getters/chastity/getChastityBra.js"); +const { getCollar } = require("./getters/collar/getCollar.js"); // returns whether the locking was successful function timelockChastity(serverID, client, wearer, keyholder, unlockTime, access, keyholderAfter, webhookchannel) { @@ -21,7 +24,8 @@ function timelockChastity(serverID, client, wearer, keyholder, unlockTime, acces const now = Date.now(); if (now >= unlockTime) return false; if (process.chastity == undefined) process.chastity = {}; - const chastity = process.chastity[wearer]; + if (process.chastity[serverID] == undefined) process.chastity[serverID] = {}; + const chastity = getChastity(serverID, wearer); chastity.keyholder = keyholder; if (!chastity) return false; if (chastity.keyholder == wearer) { @@ -34,7 +38,7 @@ function timelockChastity(serverID, client, wearer, keyholder, unlockTime, acces chastity.access = access; console.log(`timelock set to unlock in ${unlockTime - now} ms`); setTimeout(() => { - unlockTimelockChastity(client, wearer); + unlockTimelockChastity(serverID, client, wearer); }, unlockTime - now); markForSave("chastity"); return true; @@ -44,14 +48,15 @@ function timelockChastity(serverID, client, wearer, keyholder, unlockTime, acces function unlockTimelockChastity(serverID, client, wearer, skipWrite = false) { traceFirstParam(arguments[0]); if (process.chastity == undefined) process.chastity = {}; - const chastity = process.chastity[wearer]; + if (process.chastity[serverID] == undefined) process.chastity[serverID] = {}; + const chastity = getChastity(serverID, wearer); if (!chastity || !chastity.unlockTime) return false; chastity.keyholder = chastity.keyholderAfter; chastity.keyholderAfter = null; chastity.unlockTime = null; chastity.access = null; - sendTimelockChastityUnlockMessage(client, wearer, chastity.keyholder); - if (!chastity.keyholder) removeChastity(wearer, undefined, true); + sendTimelockChastityUnlockMessage(serverID, client, wearer, chastity.keyholder); + if (!chastity.keyholder) removeChastity(serverID, wearer, undefined, true); else if (!skipWrite) { markForSave("chastity"); } @@ -60,13 +65,13 @@ function unlockTimelockChastity(serverID, client, wearer, skipWrite = false) { async function sendTimelockChastityUnlockMessage(serverID, client, wearer, keyholder) { traceFirstParam(arguments[0]); - if (process.recentmessages && process.recentmessages[wearer]) { + if (process.recentmessages && process.recentmessages[serverID] && process.recentmessages[serverID][wearer]) { if (!keyholder) { - messageSendChannel(`As the timer finally expires, <@${wearer}>'s chastity belt unlocks and falls to the floor!`, process.recentmessages[wearer]); + messageSendChannel(`As the timer finally expires, <@${wearer}>'s chastity belt unlocks and falls to the floor!`, process.recentmessages[serverID][wearer]); } else if (wearer == keyholder) { - messageSendChannel(`As the timer finally expires, <@${wearer}>'s chastity belt returns to normal with ${getPronouns(wearer, "object")} holding the keys!`, process.recentmessages[wearer]); + messageSendChannel(`As the timer finally expires, <@${wearer}>'s chastity belt returns to normal with ${getPronouns(serverID, wearer, "object")} holding the keys!`, process.recentmessages[serverID][wearer]); } else { - messageSendChannel(`As the timer finally expires, <@${wearer}>'s chastity belt returns to normal with <@${keyholder}> holding the keys!`, process.recentmessages[wearer]); + messageSendChannel(`As the timer finally expires, <@${wearer}>'s chastity belt returns to normal with <@${keyholder}> holding the keys!`, process.recentmessages[serverID][wearer]); } } else { @@ -80,7 +85,8 @@ function timelockChastityBra(serverID, client, wearer, keyholder, unlockTime, ac const now = Date.now(); if (now >= unlockTime) return false; if (process.chastitybra == undefined) process.chastitybra = {}; - const chastitybra = process.chastitybra[wearer]; + if (process.chastitybra[serverID] == undefined) process.chastitybra[serverID] = {}; + const chastitybra = getChastityBra(serverID, wearer) chastitybra.keyholder = keyholder; if (!chastitybra) return false; if (chastitybra.keyholder == wearer) { @@ -93,7 +99,7 @@ function timelockChastityBra(serverID, client, wearer, keyholder, unlockTime, ac chastitybra.access = access; console.log(`timelock set to unlock in ${unlockTime - now} ms`); setTimeout(() => { - unlockTimelockChastity(client, wearer); + unlockTimelockChastityBra(serverID, client, wearer); }, unlockTime - now); markForSave("chastitybra"); return true; @@ -103,14 +109,15 @@ function timelockChastityBra(serverID, client, wearer, keyholder, unlockTime, ac function unlockTimelockChastityBra(serverID, client, wearer, skipWrite = false) { traceFirstParam(arguments[0]); if (process.chastitybra == undefined) process.chastitybra = {}; - const chastitybra = process.chastitybra[wearer]; + if (process.chastitybra[serverID] == undefined) process.chastitybra[serverID] = {}; + const chastitybra = getChastityBra(serverID, wearer) if (!chastitybra || !chastitybra.unlockTime) return false; chastitybra.keyholder = chastitybra.keyholderAfter; chastitybra.keyholderAfter = null; chastitybra.unlockTime = null; chastitybra.access = null; - sendTimelockChastityBraUnlockMessage(client, wearer, chastitybra.keyholder); - if (!chastitybra.keyholder) removeChastityBra(wearer, undefined, true); + sendTimelockChastityBraUnlockMessage(serverID, client, wearer, chastitybra.keyholder); + if (!chastitybra.keyholder) removeChastityBra(serverID, wearer, undefined, true); else if (!skipWrite) { markForSave("chastitybra"); } @@ -119,13 +126,13 @@ function unlockTimelockChastityBra(serverID, client, wearer, skipWrite = false) async function sendTimelockChastityBraUnlockMessage(serverID, client, wearer, keyholder) { traceFirstParam(arguments[0]); - if (process.recentmessages && process.recentmessages[wearer]) { + if (process.recentmessages && process.recentmessages[serverID] && process.recentmessages[serverID][wearer]) { if (!keyholder) { - messageSendChannel(`As the timer finally expires, <@${wearer}>'s chastity bra unlocks and falls to the floor!`, process.recentmessages[wearer]); + messageSendChannel(`As the timer finally expires, <@${wearer}>'s chastity bra unlocks and falls to the floor!`, process.recentmessages[serverID][wearer]); } else if (wearer == keyholder) { - messageSendChannel(`As the timer finally expires, <@${wearer}>'s chastity bra returns to normal with ${getPronouns(wearer, "object")} holding the keys!`, process.recentmessages[wearer]); + messageSendChannel(`As the timer finally expires, <@${wearer}>'s chastity bra returns to normal with ${getPronouns(serverID, wearer, "object")} holding the keys!`, process.recentmessages[serverID][wearer]); } else { - messageSendChannel(`As the timer finally expires, <@${wearer}>'s chastity bra returns to normal with <@${keyholder}> holding the keys!`, process.recentmessages[wearer]); + messageSendChannel(`As the timer finally expires, <@${wearer}>'s chastity bra returns to normal with <@${keyholder}> holding the keys!`, process.recentmessages[serverID][wearer]); } } else { @@ -139,7 +146,8 @@ function timelockCollar(serverID, client, wearer, keyholder, unlockTime, access, const now = Date.now(); if (now >= unlockTime) return false; if (process.collar == undefined) process.collar = {}; - const collar = process.collar[wearer]; + if (process.collar[serverID] == undefined) process.collar[serverID] = {}; + const collar = getCollar(serverID, wearer); collar.keyholder = keyholder; if (!collar) return false; if (collar.keyholder == wearer) { @@ -152,7 +160,7 @@ function timelockCollar(serverID, client, wearer, keyholder, unlockTime, access, collar.access = access; console.log(`timelock set to unlock in ${unlockTime - now} ms`); setTimeout(() => { - unlockTimelockChastity(client, wearer); + unlockTimelockCollar(serverID, client, wearer); }, unlockTime - now); markForSave("collar"); return true; @@ -162,14 +170,15 @@ function timelockCollar(serverID, client, wearer, keyholder, unlockTime, access, function unlockTimelockCollar(serverID, client, wearer, skipWrite = false) { traceFirstParam(arguments[0]); if (process.collar == undefined) process.collar = {}; - const collar = process.collar[wearer]; + if (process.collar[serverID] == undefined) process.collar[serverID] = {}; + const collar = getCollar(serverID, wearer); if (!collar || !collar.unlockTime) return false; collar.keyholder = collar.keyholderAfter; collar.keyholderAfter = null; collar.unlockTime = null; collar.access = null; - sendTimelockCollarUnlockMessage(client, wearer, collar.keyholder); - if (!collar.keyholder) removeCollar(wearer); + sendTimelockCollarUnlockMessage(serverID, client, wearer, collar.keyholder); + if (!collar.keyholder) removeCollar(serverID, wearer); else if (!skipWrite) { markForSave("collar"); } @@ -178,13 +187,13 @@ function unlockTimelockCollar(serverID, client, wearer, skipWrite = false) { async function sendTimelockCollarUnlockMessage(serverID, client, wearer, keyholder) { traceFirstParam(arguments[0]); - if (process.recentmessages && process.recentmessages[wearer]) { + if (process.recentmessages && process.recentmessages[serverID] && process.recentmessages[serverID][wearer]) { if (!keyholder) { - messageSendChannel(`As the timer finally expires, <@${wearer}>'s collar unlocks and falls to the floor!`, process.recentmessages[wearer]); + messageSendChannel(`As the timer finally expires, <@${wearer}>'s collar unlocks and falls to the floor!`, process.recentmessages[serverID][wearer]); } else if (wearer == keyholder) { - messageSendChannel(`As the timer finally expires, <@${wearer}>'s collar returns to normal with ${getPronouns(wearer, "object")} holding the keys!`, process.recentmessages[wearer]); + messageSendChannel(`As the timer finally expires, <@${wearer}>'s collar returns to normal with ${getPronouns(serverID, wearer, "object")} holding the keys!`, process.recentmessages[serverID][wearer]); } else { - messageSendChannel(`As the timer finally expires, <@${wearer}>'s collar returns to normal with <@${keyholder}> holding the keys!`, process.recentmessages[wearer]); + messageSendChannel(`As the timer finally expires, <@${wearer}>'s collar returns to normal with <@${keyholder}> holding the keys!`, process.recentmessages[serverID][wearer]); } } else { @@ -193,15 +202,24 @@ async function sendTimelockCollarUnlockMessage(serverID, client, wearer, keyhold } function checkGagbotKeys() { - getCollarKeys(process.client.user.id).forEach((k) => { - gagbotHeldKeyTime(k, "collar"); + Object.keys(process.collar).forEach((server) => { + getCollarKeys(server, process.client.user.id).forEach((k) => { + gagbotHeldKeyTime(server, k, "collar"); + }) }) - getChastityKeys(process.client.user.id).forEach((k) => { - gagbotHeldKeyTime(k, "chastity"); + + Object.keys(process.chastity).forEach((server) => { + getChastityKeys(server, process.client.user.id).forEach((k) => { + gagbotHeldKeyTime(server, k, "chastity"); + }) }) - getChastityBraKeys(process.client.user.id).forEach((k) => { - gagbotHeldKeyTime(k, "chastitybra"); + + Object.keys(process.chastitybra).forEach((server) => { + getChastityBraKeys(server, process.client.user.id).forEach((k) => { + gagbotHeldKeyTime(server, k, "chastitybra"); + }) }) + if (process.heldkeytimers) { Object.keys(process.heldkeytimers).forEach((k) => { gagbotHeldKeyTime(...k.split("_")); @@ -212,45 +230,46 @@ function checkGagbotKeys() { function gagbotHeldKeyTime(serverID, wearerid, type) { traceFirstParam(arguments[0]); if (process.heldkeytimers == undefined) { process.heldkeytimers = {} } - if (!process.recentmessages[wearerid]) { return } - if (!process.heldkeytimers[`${wearerid}_${type}`]) { + if (!process.recentmessages[serverID][wearerid]) { return } + if (!process.heldkeytimers[`${serverID}_${wearerid}_${type}`]) { let data = { + serverID: serverID, interactionuser: process.client.user, targetuser: { id: wearerid }, } messageSendChannel(getTextGeneric("given_key", data), process.recentmessages[wearerid]) - let addedtime = Math.floor(Math.max(Math.random(), 0.4) * getOption(wearerid, "gagbotholdtimer")); // 40-100% of the time - process.heldkeytimers[`${wearerid}_${type}`] = { + let addedtime = Math.floor(Math.max(Math.random(), 0.4) * getOption(serverID, wearerid, "gagbotholdtimer")); // 40-100% of the time + process.heldkeytimers[`${serverID}_${wearerid}_${type}`] = { releasetime: Date.now() + addedtime } markForSave("heldkeytimers"); } else { - if (process[type] && process[type][wearerid] && process[type][wearerid].keyholder != process.client.user.id) { // Key somehow returned to the wearer, or the device was removed - delete process.heldkeytimers[`${wearerid}_${type}`] + if (process[type] && process[type][serverID] && process[type][serverID][wearerid] && process[type][serverID][wearerid].keyholder != process.client.user.id) { // Key somehow returned to the wearer, or the device was removed + delete process.heldkeytimers[`${serverID}_${wearerid}_${type}`] return; } - if (process.heldkeytimers[`${wearerid}_${type}`].releasetime < Date.now()) { + if (process.heldkeytimers[`${serverID}_${wearerid}_${type}`].releasetime < Date.now()) { let data = { interactionuser: process.client.user, targetuser: { id: wearerid }, } - messageSendChannel(getTextGeneric(`return_key_${type}`, data), process.recentmessages[wearerid]) // process.recentmessages will *always* exist. - if (process[type] && process[type][wearerid] && process[type][wearerid].keyholder == process.client.user.id) { + messageSendChannel(getTextGeneric(`return_key_${type}`, data), process.recentmessages[serverID][wearerid]) // process.recentmessages will *always* exist. + if (process[type] && process[type][serverID] && process[type][serverID][wearerid] && process[type][serverID][wearerid].keyholder == process.client.user.id) { if (type == "collar") { - transferCollarKey(wearerid, wearerid) + transferCollarKey(serverID, wearerid, wearerid) markForSave("collar"); } if (type == "chastity") { - transferChastityKey(wearerid, wearerid) + transferChastityKey(serverID, wearerid, wearerid) markForSave("chastity"); } if (type == "chastitybra") { - transferChastityBraKey(wearerid, wearerid) + transferChastityBraKey(serverID, wearerid, wearerid) markForSave("chastitybra"); } } - delete process.heldkeytimers[`${wearerid}_${type}`] + delete process.heldkeytimers[`${serverID}_${wearerid}_${type}`] } } } From a81c16cce859125de0cde268f310a98250e992e4 Mon Sep 17 00:00:00 2001 From: Enraa Date: Sat, 20 Jun 2026 00:28:35 -0700 Subject: [PATCH 23/44] FUNCTIONS ARE FINALLY DONE Now I just gotta check commands and items --- functions/timelockfunctions.js | 2 +- functions/touchfunctions.js | 58 ++++++------ functions/vibefunctions.js | 157 ++++++++++++++++++--------------- 3 files changed, 117 insertions(+), 100 deletions(-) diff --git a/functions/timelockfunctions.js b/functions/timelockfunctions.js index 86a7c989..4cf0a3ee 100644 --- a/functions/timelockfunctions.js +++ b/functions/timelockfunctions.js @@ -237,7 +237,7 @@ function gagbotHeldKeyTime(serverID, wearerid, type) { interactionuser: process.client.user, targetuser: { id: wearerid }, } - messageSendChannel(getTextGeneric("given_key", data), process.recentmessages[wearerid]) + messageSendChannel(getTextGeneric("given_key", data), process.recentmessages[serverID][wearerid]) let addedtime = Math.floor(Math.max(Math.random(), 0.4) * getOption(serverID, wearerid, "gagbotholdtimer")); // 40-100% of the time process.heldkeytimers[`${serverID}_${wearerid}_${type}`] = { releasetime: Date.now() + addedtime diff --git a/functions/touchfunctions.js b/functions/touchfunctions.js index 151e9eb7..2207fd33 100644 --- a/functions/touchfunctions.js +++ b/functions/touchfunctions.js @@ -45,8 +45,8 @@ function rollPatChance(serverID, user, target) { } // If they are in heavy bondage, we need that list. - let userheavyrestrictions = getHeavyRestrictions(user); - let targetheavyrestrictions = getHeavyRestrictions(target); + let userheavyrestrictions = getHeavyRestrictions(serverID, user); + let targetheavyrestrictions = getHeavyRestrictions(serverID, target); // Check if they are in a container. If so, they need to be in the same container to succeed. // If they are not, accuracy is 0, set the boundmiss reason to container. @@ -103,23 +103,23 @@ function rollPatChance(serverID, user, target) { emitEvent("headpatfunction", target, serverID, { target: target, returnedobject: returnedobject }) if (returnedobject.hit) { - statsAddCounter(user, "headpatsgiven"); - statsAddCounter(target, "headpatsreceived"); + statsAddCounter(serverID, user, "headpatsgiven"); + statsAddCounter(serverID, target, "headpatsreceived"); if (user == target) { - statsAddCounter(target, "headpatsself"); + statsAddCounter(serverID, target, "headpatsself"); } } if (returnedobject.crit) { - statsAddCounter(user, "headpatcrits") - statsAddCounter(target, "headpatcritsreceived") + statsAddCounter(serverID, user, "headpatcrits") + statsAddCounter(serverID, target, "headpatcritsreceived") } if (returnedobject.doublecrit) { - statsAddCounter(user, "headpatdoublecrits") - statsAddCounter(target, "headpatdoublecritsreceived") + statsAddCounter(serverID, user, "headpatdoublecrits") + statsAddCounter(serverID, target, "headpatdoublecritsreceived") } if (returnedobject.triplecrit) { - statsAddCounter(user, "headpattriplecrits") - statsAddCounter(target, "headpattriplecritsreceived") + statsAddCounter(serverID, user, "headpattriplecrits") + statsAddCounter(serverID, target, "headpattriplecritsreceived") } return returnedobject; @@ -202,19 +202,19 @@ function doHeadpatFunctions(headpatter, recipient, returnedobject) { async function shockUser(serverID, user) { traceFirstParam(arguments[0]); try { - if (getOption(user, "pishockusername") && (typeof getOption(user, "pishockusername") == "string") && - getOption(user, "pishockname") && (typeof getOption(user, "pishockname") == "string") && - getOption(user, "pishockcode") && (typeof getOption(user, "pishockcode") == "string") && - getOption(user, "pishockapikey") && (typeof getOption(user, "pishockapikey") == "string")) { + if (getOption(serverID, user, "pishockusername") && (typeof getOption(serverID, user, "pishockusername") == "string") && + getOption(serverID, user, "pishockname") && (typeof getOption(serverID, user, "pishockname") == "string") && + getOption(serverID, user, "pishockcode") && (typeof getOption(serverID, user, "pishockcode") == "string") && + getOption(serverID, user, "pishockapikey") && (typeof getOption(serverID, user, "pishockapikey") == "string")) { // Set up the https request. const reqdata = JSON.stringify({ - Username: getOption(user, "pishockusername"), - Name: getOption(user, "pishockname"), - Code: getOption(user, "pishockcode"), + Username: getOption(serverID, user, "pishockusername"), + Name: getOption(serverID, user, "pishockname"), + Code: getOption(serverID, user, "pishockcode"), Intensity: 100, Duration: 2, - Apikey: getOption(user, "pishockapikey"), - Op: (getOption(user, "pishockop") ? getOption(user, "pishockop") : "0"), // 0 for shock, 1 for vibrate, 2 for beep + Apikey: getOption(serverID, user, "pishockapikey"), + Op: (getOption(serverID, user, "pishockop") ? getOption(serverID, user, "pishockop") : "0"), // 0 for shock, 1 for vibrate, 2 for beep }); const options = { hostname: 'do.pishock.com/api/apioperate', // without https:// @@ -267,12 +267,12 @@ async function handleTouchEvent(serverID, user, target, type, noprompt = false) rej("Blocked") return; } - let hasOption = getOption(target.id, `receive${type}`); + let hasOption = getOption(serverID, target.id, `receive${type}`); if (user.id === target.id) { res(true) return; } // We're okay with touching ourselves. - if (getOption(target.id, `allowed${type}`) && getOption(target.id, `allowed${type}`).includes(user.id)) { + if (getOption(serverID, target.id, `allowed${type}`) && getOption(serverID, target.id, `allowed${type}`).includes(user.id)) { // This is on the target's approved headpat list. res(true) return; @@ -280,12 +280,12 @@ async function handleTouchEvent(serverID, user, target, type, noprompt = false) let iskeyholder = false; - if (getCollar(target.id)?.keyholder == user.id) { iskeyholder = true } - if (getChastity(target.id)?.keyholder == user.id) { iskeyholder = true } - if (getChastityBra(target.id)?.keyholder == user.id) { iskeyholder = true } - if (getClonedChastityKey(target.id).includes(user.id)) { iskeyholder = true } - if (getClonedChastityBraKey(target.id).includes(user.id)) { iskeyholder = true } - if (getClonedCollarKey(target.id).includes(user.id)) { iskeyholder = true } + if (getCollar(serverID, target.id)?.keyholder == user.id) { iskeyholder = true } + if (getChastity(serverID, target.id)?.keyholder == user.id) { iskeyholder = true } + if (getChastityBra(serverID, target.id)?.keyholder == user.id) { iskeyholder = true } + if (getClonedChastityKey(serverID, target.id).includes(user.id)) { iskeyholder = true } + if (getClonedChastityBraKey(serverID, target.id).includes(user.id)) { iskeyholder = true } + if (getClonedCollarKey(serverID, target.id).includes(user.id)) { iskeyholder = true } if (hasOption === "everyonenoprompt") { // Nothing needs to be done here. @@ -317,7 +317,7 @@ async function handleTouchEvent(serverID, user, target, type, noprompt = false) } } if (hasOption === "collaraccess") { - if (canAccessCollar(target.id, user.id).access) { + if (canAccessCollar(serverID, target.id, user.id).access) { res(true) return; } diff --git a/functions/vibefunctions.js b/functions/vibefunctions.js index 0d4e71b1..61ebac50 100644 --- a/functions/vibefunctions.js +++ b/functions/vibefunctions.js @@ -21,6 +21,10 @@ const { heavyDenialCoefficient } = require("./getters/heavy/getHeavyDenialCoeffi const { convertPronounsText } = require("./other/convertPronounsText.js"); const { markForSave } = require("./other/markForSave.js"); const { traceFirstParam } = require("./other/TESTS/traceFirstParam.js"); +const { statsAddCounter } = require("./setters/config/statsAddCounter.js"); +const { statsGetCounter } = require("./getters/config/statsGetCounter.js"); +const { statsSetCounter } = require("./setters/config/statsSetCounter.js"); +const { getChastityBra } = require("./getters/chastity/getChastityBra.js"); // NOTE: canUnequip is currently checked in functions that remove/assign chastity and those functions return if it succeeded, but the text responses are not yet updated // probably makes more sense to make custom text responses for the belts/bras that use this that explain why it failed @@ -367,9 +371,9 @@ function stutterText(msg, text, intensity, arousedtexts) { let newtextparts = text.split(" "); let outtext = ""; let stuttered = false; - let usermod = getOption(msg.author.id, "arousaleffectpotency") ?? 1.0; + let usermod = getOption(msg.guild.id, msg.author.id, "arousaleffectpotency") ?? 1.0; let overcorrected = 3; - let shockable = (process.collar && process.collar[msg.author.id] && ((process.collar[msg.author.id].collartype == "hornyshockcollar") || (process.collar[msg.author.id].additionalcollars && process.collar[msg.author.id].additionalcollars.includes("hornyshockcollar")))) + let shockable = (process.collar && process.collar[msg.guild.id] && process.collar[msg.guild.id][msg.author.id] && ((process.collar[msg.guild.id][msg.author.id].collartype == "hornyshockcollar") || (process.collar[msg.guild.id][msg.author.id].additionalcollars && process.collar[msg.guild.id][msg.author.id].additionalcollars.includes("hornyshockcollar")))) let shocked = false; let shockchance = (getArousal(msg.guild.id, msg.author.id) / 100) * 0.25 // js is a disaster sometimes. And Im a terrible coder. @@ -503,7 +507,7 @@ function stutterText(msg, text, intensity, arousedtexts) { ] let texts = []; shocks.forEach((t) => { - if (typeof t != "string" && t.required({ interactionuser: msg.member, targetuser: msg.member })) { + if (typeof t != "string" && t.required({ serverID: msg.guild.id, interactionuser: msg.member, targetuser: msg.member })) { texts.push(t.text) } else { @@ -513,8 +517,8 @@ function stutterText(msg, text, intensity, arousedtexts) { let chosentext = texts[Math.floor(texts.length * Math.random())]; console.log(texts) console.log(chosentext); - addArousal(msg.author.id, 4.0); - outtext = `${outtext}${convertPronounsText(chosentext, { interactionuser: msg.member, targetuser: msg.member })}` + addArousal(msg.guild.id, msg.author.id, 4.0); + outtext = `${outtext}${convertPronounsText(chosentext, { serverID: msg.guild.id, interactionuser: msg.member, targetuser: msg.member })}` } return { text: outtext.slice(1), stuttered: stuttered, shocked: shocked }; // Remove starting space; @@ -525,36 +529,51 @@ function updateArousalValues() { const now = Date.now(); const time = now * (getBotOption("bot-timetickrate") / 60000); // for users in vibe or chastity, make sure they have a value in arousal - for (const user in process.vibe) if (!process.arousal[user]) process.arousal[user] = { arousal: 0, prev: 0, timestamp: now }; - for (const user in process.chastity) if (!process.arousal[user]) process.arousal[user] = { arousal: 0, prev: 0, timestamp: now }; - for (const user in process.arousal) { - const arousal = process.arousal[user]; - // if the timestamp is in the future the user is cooling off from an orgasm or similar and should be skipped - if (arousal.timestamp > now) continue; - const traits = getCombinedTraits(user); - const vibes = getToys(user); - // if no vibe effect, growth coefficient will be 0 - // otherwise add the effects of the vibes and multiply it with the growth coefficient from belt and bra, and scale it so it ends up in a good range - let vibegains = vibes.reduce((prev, currVibe) => { - let vibedata = { intensity: currVibe.intensity, userID: user } - return prev + process.toytypes[currVibe.type].calcVibeEffect(vibedata) - }, 0) - // Calculate any arousal gain purely from the chastity devices worn. Add to vibearousal change. - let chastityvibegains = traits.calcVibeEffect({ userID: user }); - let growthmult = vibes ? (traits.growthCoefficient ?? 1) : 0 - // I want to pull away from using VIBE_SCALING here, may need to change this later. - let minvibegain = traits.minVibe ? (traits.minVibe * VIBE_SCALING) : -9999 - let maxvibegain = traits.maxVibe ? (traits.maxVibe * VIBE_SCALING) : 9999 - let vibearousalchange = growthmult * bounded(minvibegain, vibegains + chastityvibegains, maxvibegain); - // If the wearer is wearing Gasmask aphrodisiac, amplify the gain by 2x. - if (getHeadwear(user).includes("gasmask_hornygas")) { vibearousalchange = vibearousalchange * 2 } - const next = calcNextArousal(traits, time, arousal.arousal, arousal.prev, vibearousalchange, traits.decayCoefficient * UNBELTED_DECAY); - // set the values to the new ones - arousal.timestamp = now; - arousal.prev = arousal.arousal; - // mathematically it would never reach 0 so reset it to 0 if low enough here - arousal.arousal = next < RESET_LIMIT ? 0 : next; - traits.afterArousalChange({ userID: user, prevArousal: arousal.prev, currArousal: arousal.arousal }); + //for (const server in process.vibe) if (!process.arousal[server]) process.arousal[server] = { arousal: 0, prev: 0, timestamp: now }; + for (const server in process.chastity) { + for (const user in process.chastity[server]) { + if (process.arousal == undefined) { process.arousal = {} } + if (process.arousal[server] == undefined) { process.arousal[server] = {} }; + if (process.arousal[server][user] == undefined) { process.arousal[server][user] = { arousal: 0, prev: 0, timestamp: now } } + } + } + for (const server in process.chastitybra) { + for (const user in process.chastitybra[server]) { + if (process.arousal == undefined) { process.arousal = {} } + if (process.arousal[server] == undefined) { process.arousal[server] = {} }; + if (process.arousal[server][user] == undefined) { process.arousal[server][user] = { arousal: 0, prev: 0, timestamp: now } } + } + } + for (const server in process.arousal) { + for (const user in process.arousal[server]) { + const arousal = process.arousal[server][user]; + // if the timestamp is in the future the user is cooling off from an orgasm or similar and should be skipped + if (arousal.timestamp > now) continue; + const traits = getCombinedTraits(server, user); + const vibes = getToys(server, user); + // if no vibe effect, growth coefficient will be 0 + // otherwise add the effects of the vibes and multiply it with the growth coefficient from belt and bra, and scale it so it ends up in a good range + let vibegains = vibes.reduce((prev, currVibe) => { + let vibedata = { intensity: currVibe.intensity, userID: user, serverID: server } + return prev + process.toytypes[currVibe.type].calcVibeEffect(vibedata) + }, 0) + // Calculate any arousal gain purely from the chastity devices worn. Add to vibearousal change. + let chastityvibegains = traits.calcVibeEffect({ serverID: server, userID: user }); + let growthmult = vibes ? (traits.growthCoefficient ?? 1) : 0 + // I want to pull away from using VIBE_SCALING here, may need to change this later. + let minvibegain = traits.minVibe ? (traits.minVibe * VIBE_SCALING) : -9999 + let maxvibegain = traits.maxVibe ? (traits.maxVibe * VIBE_SCALING) : 9999 + let vibearousalchange = growthmult * bounded(minvibegain, vibegains + chastityvibegains, maxvibegain); + // If the wearer is wearing Gasmask aphrodisiac, amplify the gain by 2x. + if (getHeadwear(server, user).includes("gasmask_hornygas")) { vibearousalchange = vibearousalchange * 2 } + const next = calcNextArousal(traits, time, arousal.arousal, arousal.prev, vibearousalchange, traits.decayCoefficient * UNBELTED_DECAY); + // set the values to the new ones + arousal.timestamp = now; + arousal.prev = arousal.arousal; + // mathematically it would never reach 0 so reset it to 0 if low enough here + arousal.arousal = next < RESET_LIMIT ? 0 : next; + traits.afterArousalChange({ serverID: server, userID: user, prevArousal: arousal.prev, currArousal: arousal.arousal }); + } } markForSave("arousal"); } catch (err) { @@ -573,7 +592,7 @@ function updateSharedBreath() { //console.log(`Adjusting horniness for ${user} to ${process.headwear[user].sharedbreathhose}`) // If both people are wearing the linked gasmask AND have each other designated to share breath... if (getHeadwear(serverID, user).includes("gasmasklinked") && getHeadwear(serverID, process.headwear[user].sharedbreathhose).includes("gasmasklinked") && - (user == process.headwear[process.headwear[user].sharedbreathhose].sharedbreathhose)) { + (user == process.headwear[serverID][process.headwear[user].sharedbreathhose].sharedbreathhose)) { let personA = getArousal(serverID, user) let personB = getArousal(serverID, process.headwear[user].sharedbreathhose) let diff = personA - personB; @@ -581,17 +600,17 @@ function updateSharedBreath() { if (diff < 0) { // Person B is hornier, so person A should gain, person B should lose. addArousal(serverID, user, delta); - addArousal(serverID, process.headwear[user].sharedbreathhose, -delta) - console.log(`${process.headwear[user].sharedbreathhose} sharing ${delta} arousal to ${user}`) + addArousal(serverID, process.headwear[serverID][user].sharedbreathhose, -delta) + console.log(`${process.headwear[serverID][user].sharedbreathhose} sharing ${delta} arousal to ${user}`) } else { // Person A is hornier, so person B should gain, person A should lose. - addArousal(serverID, process.headwear[user].sharedbreathhose, delta); + addArousal(serverID, process.headwear[serverID][user].sharedbreathhose, delta); addArousal(serverID, user, -delta) - console.log(`${user} sharing ${delta} arousal to ${process.headwear[user].sharedbreathhose}`) + console.log(`${user} sharing ${delta} arousal to ${process.headwear[serverID][user].sharedbreathhose}`) } processed.push(user) - processed.push(process.headwear[user].sharedbreathhose) + processed.push(process.headwear[serverID][user].sharedbreathhose) } } } @@ -619,44 +638,42 @@ function calcNextArousal(traits, time, arousal, prev, growthCoefficient, decayCo function tryOrgasm(serverID, user) { traceFirstParam(arguments[0]); // always succeed if user isnt using the system - if (getOption(user, "arousalsystem") != 2) return true; + if (getOption(serverID, user, "arousalsystem") != 2) return true; const now = Date.now(); - const arousal = getArousal(user); - const denialCoefficient = calcDenialCoefficient(user); - const chastity = getChastity(user); - const traits = getCombinedTraits(user); + const arousal = getArousal(serverID, user); + const denialCoefficient = calcDenialCoefficient(serverID, user); + const chastity = getChastity(serverID, user); + const traits = getCombinedTraits(serverID, user); const orgasmLimit = ORGASM_LIMIT; if ((arousal * (RANDOM_BIAS + Math.random())) / (RANDOM_BIAS + 1) >= orgasmLimit * denialCoefficient) { // Increment the arousal counter // and also register the highest arousal, if it is higher. - if (process.userstats == undefined) { process.userstats = {} } - if (process.userstats[user] == undefined) { process.userstats[user] = {} } - - process.userstats[user].orgasms = (process.userstats[user].orgasms ?? 0) + 1; + statsAddCounter(serverID, user, "orgasms"); - if (process.userstats[user].highestarousal == undefined) { process.userstats[user].highestarousal = 0 } - process.userstats[user].highestarousal = Math.round(Math.max(process.userstats[user].highestarousal, arousal)) + if ((statsGetCounter(serverID, user, "highestarousal") < arousal) || (statsGetCounter(serverID, user, "highestarousal") == undefined)) { + statsSetCounter(serverID, user, "highestarousal", arousal) + }; - if (process.userstats[user].highestdenial == undefined) { process.userstats[user].highestdenial = 0 } - process.userstats[user].highestdenial = Math.round(Math.max(process.userstats[user].highestdenial, orgasmLimit * denialCoefficient)); + if ((statsGetCounter(serverID, user, "highestdenial") < arousal) || (statsGetCounter(serverID, user, "highestdenial") == undefined)) { + statsSetCounter(serverID, user, "highestdenial", orgasmLimit * denialCoefficient) + }; - markForSave("userstats"); - setArousalCooldown(user, traits.orgasmCooldown, traits.orgasmArousalLeft); + setArousalCooldown(serverID, user, traits.orgasmCooldown, traits.orgasmArousalLeft); if (chastity) { chastity.timestamp = (chastity.timestamp + now) / 2; markForSave("chastity"); } - traits.onOrgasm({ userID: user, prevArousal: arousal }); + traits.onOrgasm({ serverID: serverID, userID: user, prevArousal: arousal }); return true; } // failing to orgasm is frustrating - const penalties = frustrationPenalties.get(user) ?? []; + const penalties = frustrationPenalties.get(`${serverID}_${user}`) ?? []; penalties.push({ timestamp: now, value: 10, decay: 1 }); - frustrationPenalties.set(user, penalties); - traits.onFailedOrgasm({ userID: user, arousal: arousal }); + frustrationPenalties.set(`${serverID}_${user}`, penalties); + traits.onFailedOrgasm({ serverID: serverID, userID: user, arousal: arousal }); return false; } @@ -664,16 +681,16 @@ function tryOrgasm(serverID, user) { function setArousalCooldown(serverID, user, cooldownModifier = 1, arousalLeft = 0) { traceFirstParam(arguments[0]); const now = Date.now(); - process.arousal[user].timestamp = now + ORGASM_COOLDOWN * cooldownModifier; - const old = process.arousal[user].arousal; - process.arousal[user].arousal *= arousalLeft; - getCombinedTraits(user).afterArousalChange({ userID: user, prevArousal: old, currArousal: process.arousal[user].arousal }); + process.arousal[serverID][user].timestamp = now + ORGASM_COOLDOWN * cooldownModifier; + const old = process.arousal[serverID][user].arousal; + process.arousal[serverID][user].arousal *= arousalLeft; + getCombinedTraits(serverID, user).afterArousalChange({ serverID: serverID, userID: user, prevArousal: old, currArousal: process.arousal[serverID][user].arousal }); } // modify when more things affect it function calcStaticVibeIntensity(serverID, user) { traceFirstParam(arguments[0]); - const vibes = getToys(user); + const vibes = getToys(serverID, user); if (!vibes) return 0; return vibes.reduce((prev, currVibe) => { let vibedata = { intensity: currVibe.intensity } @@ -684,19 +701,19 @@ function calcStaticVibeIntensity(serverID, user) { // modify when more things affect it function calcDenialCoefficient(serverID, user) { traceFirstParam(arguments[0]); - const heavy = getHeavy(user); - const chastity = getChastity(user); - if (chastity) return (heavy ? heavyDenialCoefficient(heavy.type) : 0) / 2 + getCombinedTraits(user).denialCoefficient; + const heavy = getHeavy(serverID, user); + const chastity = getChastity(serverID, user); + if (chastity) return (heavy ? heavyDenialCoefficient(heavy.type) : 0) / 2 + getCombinedTraits(serverID, user).denialCoefficient; return heavy ? heavyDenialCoefficient(heavy.type) : 1; } function calcFrustration(serverID, user) { traceFirstParam(arguments[0]); - let frustrationmult = getOption(user, "frustration"); + let frustrationmult = getOption(serverID, user, "frustration"); if (frustrationmult == 0) { return 0; } - const chastity = getChastity(user); + const chastity = getChastity(serverID, user); if (!chastity) return 0; const now = Date.now(); const hoursBelted = ((now - chastity.timestamp) / (60 * 60 * 1000)) * frustrationmult; From f23eb663d52342dc863e431e2351adaa4109cf65 Mon Sep 17 00:00:00 2001 From: Enraa Date: Sat, 20 Jun 2026 23:57:37 -0700 Subject: [PATCH 24/44] chastity cleanup --- chastity/belt/belt_livingwood.js | 18 +++++++++--------- chastity/belt/belt_petalsofanguish.js | 14 +++++++------- chastity/belt/belt_seal_air.js | 2 +- chastity/belt/belt_seal_arachne.js | 20 ++++++++++---------- chastity/belt/belt_seal_ice.js | 2 +- chastity/belt/belt_stasis.js | 10 +++++----- chastity/belt/default.js | 14 +++++++------- chastity/bra/bra_livingwood.js | 18 +++++++++--------- chastity/bra/default.js | 12 ++++++------ 9 files changed, 55 insertions(+), 55 deletions(-) diff --git a/chastity/belt/belt_livingwood.js b/chastity/belt/belt_livingwood.js index 46eed0a6..2f96b6fd 100644 --- a/chastity/belt/belt_livingwood.js +++ b/chastity/belt/belt_livingwood.js @@ -11,25 +11,25 @@ exports.decayCoefficient = (data) => { return 0.1 } // Never Fully Clear Arousal exports.minArousal = (data) => { return 0.5 } exports.minVibe = function(data) { - return Math.max(Math.min(Math.floor((Date.now() - (getUserVar(data.userID, "livingwood_chastity") ?? Date.now())) / 900000), 20), getUserVar(data.userID, "livingwood_vibe")) + return Math.max(Math.min(Math.floor((Date.now() - (getUserVar(data.serverID, data.userID, "livingwood_chastity") ?? Date.now())) / 900000), 20), getUserVar(data.serverID, data.userID, "livingwood_vibe")) } exports.onOrgasm = (data) => { - setUserVar(data.userID, "livingwood_vibe", Math.max((this.minVibe(data) - 10), 0)) - setUserVar(data.userID, "livingwood_chastity", Date.now()); + setUserVar(data.serverID, data.userID, "livingwood_vibe", Math.max((this.minVibe(data) - 10), 0)) + setUserVar(data.serverID, data.userID, "livingwood_chastity", Date.now()); } exports.onFailedOrgasm = (data) => { //console.log(this); - setUserVar(data.userID, "livingwood_vibe", Math.min((this.minVibe(data) + 1), 20)); + setUserVar(data.serverID, data.userID, "livingwood_vibe", Math.min((this.minVibe(data) + 1), 20)); } exports.onEquip = (data) => { - if (!getUserVar(data.userID, "livingwood_vibe") || getUserVar(data.userID, "livingwood_vibe") == undefined) setUserVar(data.userID, "livingwood_vibe", 0); - if (!getUserVar(data.userID, "livingwood_chastity") || getUserVar(data.userID, "livingwood_chastity") == undefined) setUserVar(data.userID, "livingwood_chastity", Date.now()); + if (!getUserVar(data.serverID, data.userID, "livingwood_vibe") || getUserVar(data.serverID, data.userID, "livingwood_vibe") == undefined) setUserVar(data.serverID, data.userID, "livingwood_vibe", 0); + if (!getUserVar(data.serverID, data.userID, "livingwood_chastity") || getUserVar(data.serverID, data.userID, "livingwood_chastity") == undefined) setUserVar(data.serverID, data.userID, "livingwood_chastity", Date.now()); } exports.onUnequip = (data) => { // Check if user is wearing a Livingwood Bra otherwise Null Out Vars - if (getChastityBra(data.userID)?.chastitytype != "bra_livingwood") { - setUserVar(data.userID, "livingwood_vibe", undefined); - setUserVar(data.userID, "livingwood_chastity", undefined); + if (getChastityBra(data.serverID, data.userID)?.chastitytype != "bra_livingwood") { + setUserVar(data.serverID, data.userID, "livingwood_vibe", undefined); + setUserVar(data.serverID, data.userID, "livingwood_chastity", undefined); } } diff --git a/chastity/belt/belt_petalsofanguish.js b/chastity/belt/belt_petalsofanguish.js index 0a956456..a01ced9e 100644 --- a/chastity/belt/belt_petalsofanguish.js +++ b/chastity/belt/belt_petalsofanguish.js @@ -2,24 +2,24 @@ const { getChastity } = require("../../functions/getters/chastity/getChastity") // Petals of Anguish as shown here: https://www.reddit.com/r/femalechastity/comments/1rbjaqq/fantasy_device_20/#lightbox // This variant limits "actions" to the wearer to one per other user. This is simple to track with a "touchedbelt" array. -exports.canUnequip = (data) => { return !getChastity(data.userID).touchedbelt.includes(data.keyholderID) } +exports.canUnequip = (data) => { return !getChastity(data.serverID, data.userID).touchedbelt.includes(data.keyholderID) } -exports.canAccessToys = (data) => { return !getChastity(data.userID).touchedbelt.includes(data.keyholderID) } +exports.canAccessToys = (data) => { return !getChastity(data.serverID, data.userID).touchedbelt.includes(data.keyholderID) } -exports.canAccessCorset = (data) => { return !getChastity(data.userID).touchedbelt.includes(data.keyholderID) } +exports.canAccessCorset = (data) => { return !getChastity(data.serverID, data.userID).touchedbelt.includes(data.keyholderID) } // The keyholder will get one free touch after putting the belt on the wearer. Unless it's themselves. // Obviously the wearer will get instantly locked out. -exports.onEquip = (data) => { getChastity(data.userID).touchedbelt = [data.userID] } +exports.onEquip = (data) => { getChastity(data.serverID, data.userID).touchedbelt = [data.userID] } // This variable should get cleared in assignChastity, but just in case. -exports.onUnequip = (data) => { delete getChastity(data.userID).touchedbelt } +exports.onUnequip = (data) => { delete getChastity(data.serverID, data.userID).touchedbelt } // Fired on toy change! That user will no longer be allowed to access the belt. -exports.onToyChange = (data) => { getChastity(data.userID).touchedbelt.push(data.keyholderID) } +exports.onToyChange = (data) => { getChastity(data.serverID, data.userID).touchedbelt.push(data.keyholderID) } // Fired on Corset change! That user will no longer be allowed to access the belt. -exports.onCorsetChange = (data) => { getChastity(data.userID).touchedbelt.push(data.keyholderID) } +exports.onCorsetChange = (data) => { getChastity(data.serverID, data.userID).touchedbelt.push(data.keyholderID) } // Category exports.category = "Chastity Belt" diff --git a/chastity/belt/belt_seal_air.js b/chastity/belt/belt_seal_air.js index d4de99ce..90f23ede 100644 --- a/chastity/belt/belt_seal_air.js +++ b/chastity/belt/belt_seal_air.js @@ -13,7 +13,7 @@ exports.orgasmCooldown = (data) => { return 2 * Math.random() } // Events // Randomly reduce the level of arousal by a random percentage, then reduce by a further 10% exports.onOrgasm = (data) => { - addArousal(data.userID, data.prevArousal * Math.random() * 0.9); + addArousal(data.serverID, data.userID, data.prevArousal * Math.random() * 0.9); } // Tags diff --git a/chastity/belt/belt_seal_arachne.js b/chastity/belt/belt_seal_arachne.js index af721dff..1059a628 100644 --- a/chastity/belt/belt_seal_arachne.js +++ b/chastity/belt/belt_seal_arachne.js @@ -5,33 +5,33 @@ const { setUserVar } = require("../../functions/setters/config/setUserVar") // Seal of the Pleasurable Descent (Arachne's Kiss) // This Seal gradually increases the wearer's sensitivity (growthCoefficient), and raises the min arousal level for every successful orgasm while wearing it~ exports.growthCoefficient = function(data) { - return Math.min(2 + ((Date.now() - getUserVar(data.userID, "arachne_kiss") ?? Date.now()) / 900000), 10) + return Math.min(2 + ((Date.now() - getUserVar(data.serverID, data.userID, "arachne_kiss") ?? Date.now()) / 900000), 10) } // Set Min Arousal to be equal to Arachne Heat Value, and allow the cooldown period to shorten as Heat increases starting from 80% of default. -exports.minArousal = function(data) { return getUserVar(data.userID, "arachne_heat")} -exports.orgasmCooldown = function(data) { return 1 / (1 + (getUserVar(data.userID, "arachne_heat") / 2)) } // This should be 1.0 -> 0.0 as arachne_heat goes up +exports.minArousal = function(data) { return getUserVar(data.serverID, data.userID, "arachne_heat")} +exports.orgasmCooldown = function(data) { return 1 / (1 + (getUserVar(data.serverID, data.userID, "arachne_heat") / 2)) } // This should be 1.0 -> 0.0 as arachne_heat goes up // No Increase to denial when worn exports.denialCoefficient = (data) => { return 1 } // Events exports.onOrgasm = (data) => { - setUserVar(data.userID, "arachne_heat", (getUserVar(data.userID, "arachne_heat")) + 1) - addArousal(data.userID, (getUserVar(data.userID, "arachne_heat"))); + setUserVar(data.serverID, data.userID, "arachne_heat", (getUserVar(data.serverID, data.userID, "arachne_heat")) + 1) + addArousal(data.serverID, data.userID, (getUserVar(data.serverID, data.userID, "arachne_heat"))); } exports.onFailedOrgasm = (data) => { // Add a small amount of arousal scaling with Growth Coefficient - addArousal(data.userID, (0.5 * this.growthCoefficient(data))); + addArousal(data.serverID, data.userID, (0.5 * this.growthCoefficient(data))); } exports.onEquip = (data) => { // Configure initial variable values and 'Kiss' time - if (!getUserVar(data.userID, "arachne_heat") || getUserVar(data.userID, "arachne_heat") == undefined) setUserVar(data.userID, "arachne_heat", 1); - if (!getUserVar(data.userID, "arachne_kiss") || getUserVar(data.userID, "arachne_kiss") == undefined) setUserVar(data.userID, "arachne_kiss", Date.now()); + if (!getUserVar(data.serverID, data.userID, "arachne_heat") || getUserVar(data.serverID, data.userID, "arachne_heat") == undefined) setUserVar(data.serverID, data.userID, "arachne_heat", 1); + if (!getUserVar(data.serverID, data.userID, "arachne_kiss") || getUserVar(data.serverID, data.userID, "arachne_kiss") == undefined) setUserVar(data.serverID, data.userID, "arachne_kiss", Date.now()); } exports.onUnequip = (data) => { - setUserVar(data.userID, "arachne_heat", undefined); - setUserVar(data.userID, "arachne_kiss", undefined); + setUserVar(data.serverID, data.userID, "arachne_heat", undefined); + setUserVar(data.serverID, data.userID, "arachne_kiss", undefined); } // Tags diff --git a/chastity/belt/belt_seal_ice.js b/chastity/belt/belt_seal_ice.js index 62a8e6c5..7623e32d 100644 --- a/chastity/belt/belt_seal_ice.js +++ b/chastity/belt/belt_seal_ice.js @@ -28,7 +28,7 @@ exports.afterArousalChange = (data) => { } exports.onEquip = (data) => { // Configure base arousal value - if (!getUserVar(data.serverID, data.userID, "base_arousal") || getUserVar(data.serverID, data.userID, "base_arousal") == undefined) setUserVar(data.userID, "base_arousal", getArousal(data.serverID, data.userID) ?? 5); + if (!getUserVar(data.serverID, data.userID, "base_arousal") || getUserVar(data.serverID, data.userID, "base_arousal") == undefined) setUserVar(data.serverID, data.userID, "base_arousal", getArousal(data.serverID, data.userID) ?? 5); } exports.onUnequip = (data) => { setUserVar(data.serverID, data.userID, "base_arousal", undefined); diff --git a/chastity/belt/belt_stasis.js b/chastity/belt/belt_stasis.js index 64f3ff83..6359d288 100644 --- a/chastity/belt/belt_stasis.js +++ b/chastity/belt/belt_stasis.js @@ -6,17 +6,17 @@ const { setUserVar } = require("../../functions/setters/config/setUserVar"); // Modelled after the unique in PoE. This belt restores arousal after letting go // and increases the threshold required to let go in the future. // This modifies the implementation slightly but should still return the same result. -exports.denialCoefficient = (data) => { return 5 * Math.pow(1.2, (getUserVar(data.userID, "chastitystasisprisonorgasms") ?? 0)) } +exports.denialCoefficient = (data) => { return 5 * Math.pow(1.2, (getUserVar(data.serverID, data.userID, "chastitystasisprisonorgasms") ?? 0)) } exports.onOrgasm = (data) => { - addArousal(data.userID, data.prevArousal); - let currentorgasms = getUserVar(data.userID, "chastitystasisprisonorgasms") ?? 0; + addArousal(data.serverID, data.userID, data.prevArousal); + let currentorgasms = getUserVar(data.serverID, data.userID, "chastitystasisprisonorgasms") ?? 0; currentorgasms++; - setUserVar(data.userID, "chastitystasisprisonorgasms", currentorgasms); + setUserVar(data.serverID, data.userID, "chastitystasisprisonorgasms", currentorgasms); } exports.onUnequip = (data) => { - setUserVar(data.userID, "chastitystasisprisonorgasms", 0) + setUserVar(data.serverID, data.userID, "chastitystasisprisonorgasms", 0) } // Name diff --git a/chastity/belt/default.js b/chastity/belt/default.js index 0aa23e17..11be83bf 100644 --- a/chastity/belt/default.js +++ b/chastity/belt/default.js @@ -17,9 +17,9 @@ exports.vibeScaling = (data) => { return 0.6 } // Fumble for belts. exports.fumble = (data) => { - if (getOption(data.userID, "fumbling") == "disabled") { return 0 } - let fumble = rollKeyFumble(data.keyholderID, data.userID); - if (fumble > 1 && (getOption(data.userID, "keyloss") == "disabled")) { + if (getOption(data.serverID, data.userID, "fumbling") == "disabled") { return 0 } + let fumble = rollKeyFumble(data.serverID, data.keyholderID, data.userID); + if (fumble > 1 && (getOption(data.serverID, data.userID, "keyloss") == "disabled")) { fumble = 1; // force it back to a no key loss } return fumble; @@ -27,14 +27,14 @@ exports.fumble = (data) => { // Discard for bras exports.discard = (data) => { - return discardKey(data.userID, data.keyholderID, "chastity belt") + return discardKey(data.serverID, data.userID, data.keyholderID, "chastity belt") } -exports.canUnequip = (data) => { return canAccessChastity(data.userID, data.keyholderID, true).access } +exports.canUnequip = (data) => { return canAccessChastity(data.serverID, data.userID, data.keyholderID, true).access } -exports.canAccessToys = (data) => { return (canAccessChastity(data.userID, data.keyholderID).access) } +exports.canAccessToys = (data) => { return (canAccessChastity(data.serverID, data.userID, data.keyholderID).access) } -exports.canAccessCorset = (data) => { return (canAccessChastity(data.userID, data.keyholderID).access) } +exports.canAccessCorset = (data) => { return (canAccessChastity(data.serverID, data.userID, data.keyholderID).access) } // Category exports.category = "Chastity Belt" diff --git a/chastity/bra/bra_livingwood.js b/chastity/bra/bra_livingwood.js index 60d41dd3..60a3677c 100644 --- a/chastity/bra/bra_livingwood.js +++ b/chastity/bra/bra_livingwood.js @@ -13,25 +13,25 @@ exports.decayCoefficient = (data) => { return 0.1 } // Never Fully Clear Arousal exports.minArousal = (data) => { return 0.5 } exports.minVibe = function(data) { - return Math.max(Math.min(Math.floor((Date.now() - (getUserVar(data.userID, "livingwood_chastity") ?? Date.now())) / 900000), 20), getUserVar(data.userID, "livingwood_vibe")) + return Math.max(Math.min(Math.floor((Date.now() - (getUserVar(data.serverID, data.userID, "livingwood_chastity") ?? Date.now())) / 900000), 20), getUserVar(data.serverID, data.userID, "livingwood_vibe")) } exports.onOrgasm = (data) => { - setUserVar(data.userID, "livingwood_vibe", Math.max((this.minVibe(data) - 10), 0)) - setUserVar(data.userID, "livingwood_chastity", Date.now()); + setUserVar(data.serverID, data.userID, "livingwood_vibe", Math.max((this.minVibe(data) - 10), 0)) + setUserVar(data.serverID, data.userID, "livingwood_chastity", Date.now()); } exports.onFailedOrgasm = (data) => { //console.log(this); - setUserVar(data.userID, "livingwood_vibe", Math.min((this.minVibe(data) + 1), 20)); + setUserVar(data.serverID, data.userID, "livingwood_vibe", Math.min((this.minVibe(data) + 1), 20)); } exports.onEquip = (data) => { - if (!getUserVar(data.userID, "livingwood_vibe") || getUserVar(data.userID, "livingwood_vibe") == undefined) setUserVar(data.userID, "livingwood_vibe", 0); - if (!getUserVar(data.userID, "livingwood_chastity") || getUserVar(data.userID, "livingwood_chastity") == undefined) setUserVar(data.userID, "livingwood_chastity", Date.now()); + if (!getUserVar(data.serverID, data.userID, "livingwood_vibe") || getUserVar(data.serverID, data.userID, "livingwood_vibe") == undefined) setUserVar(data.serverID, data.userID, "livingwood_vibe", 0); + if (!getUserVar(data.serverID, data.userID, "livingwood_chastity") || getUserVar(data.serverID, data.userID, "livingwood_chastity") == undefined) setUserVar(data.serverID, data.userID, "livingwood_chastity", Date.now()); } exports.onUnequip = (data) => { // Check if user is wearing a Livingwood Belt otherwise Null Out Vars - if (getChastity(data.userID)?.chastitytype != "belt_livingwood") { - setUserVar(data.userID, "livingwood_vibe", undefined); - setUserVar(data.userID, "livingwood_chastity", undefined); + if (getChastity(data.serverID, data.userID)?.chastitytype != "belt_livingwood") { + setUserVar(data.serverID, data.userID, "livingwood_vibe", undefined); + setUserVar(data.serverID, data.userID, "livingwood_chastity", undefined); } } diff --git a/chastity/bra/default.js b/chastity/bra/default.js index 6d4e19f3..036b532e 100644 --- a/chastity/bra/default.js +++ b/chastity/bra/default.js @@ -17,9 +17,9 @@ exports.vibeScaling = (data) => { return 0.3 } // Fumble for bras. exports.fumble = (data) => { - if (getOption(data.userID, "fumbling") == "disabled") { return 0 } - let fumble = rollKeyFumble(data.keyholderID, data.userID); - if (fumble > 1 && (getOption(data.userID, "keyloss") == "disabled")) { + if (getOption(data.serverID, data.userID, "fumbling") == "disabled") { return 0 } + let fumble = rollKeyFumble(data.serverID, data.keyholderID, data.userID); + if (fumble > 1 && (getOption(data.serverID, data.userID, "keyloss") == "disabled")) { fumble = 1; // force it back to a no key loss } return fumble; @@ -27,12 +27,12 @@ exports.fumble = (data) => { // Discard for bras exports.discard = (data) => { - return discardKey(data.userID, data.keyholderID, "chastity bra") + return discardKey(data.serverID, data.userID, data.keyholderID, "chastity bra") } -exports.canUnequip = (data) => { return canAccessChastityBra(data.userID, data.keyholderID, true).access } +exports.canUnequip = (data) => { return canAccessChastityBra(data.serverID, data.userID, data.keyholderID, true).access } -exports.canAccessToys = (data) => { return (canAccessChastityBra(data.userID, data.keyholderID).access) } +exports.canAccessToys = (data) => { return (canAccessChastityBra(data.serverID, data.userID, data.keyholderID).access) } // Category exports.category = "Chastity Bra" From c560f68a072d43eedee14db10162f659d70c2082 Mon Sep 17 00:00:00 2001 From: Enraa Date: Sun, 21 Jun 2026 00:47:58 -0700 Subject: [PATCH 25/44] gags --- functions/corsetfunctions.js | 2 +- gags/chocolate.js | 2 +- gags/chocolate~.js | 2 +- gags/forbidden.js | 2 +- gags/goodSub.js | 4 ++-- gags/gummy.js | 2 +- gags/headpatslut.js | 4 ++-- gags/jawbreaker.js | 2 +- gags/jawbreaker~.js | 2 +- gags/politeSub.js | 8 ++++---- gags/third.js | 6 +++--- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/functions/corsetfunctions.js b/functions/corsetfunctions.js index 23f3b869..1ac1fe77 100644 --- a/functions/corsetfunctions.js +++ b/functions/corsetfunctions.js @@ -265,7 +265,7 @@ function calcBreath(serverID, user) { if (process.gags[serverID][user] && process.gags[serverID][user].length > 0) { process.gags[serverID][user].forEach((g) => { if (process.gagtypes && process.gagtypes[g.gagtype]?.breathRecovery) { - recoveryCoefficient *= process.gagtypes[g.gagtype]?.breathRecovery(user, g.intensity ?? 5) + recoveryCoefficient *= process.gagtypes[g.gagtype]?.breathRecovery(user, g.intensity ?? 5, serverID) } }) } diff --git a/gags/chocolate.js b/gags/chocolate.js index 94e1c517..a2229d27 100644 --- a/gags/chocolate.js +++ b/gags/chocolate.js @@ -88,7 +88,7 @@ exports.choicename = "Chocolate Gag"; // Clear Dissolve Timer exports.onUnlock = (data) => { - setUserVar(data.userID, "confectionaryDissolveTimer", undefined) + setUserVar(data.serverID, data.userID, "confectionaryDissolveTimer", undefined) } // Unit Tests diff --git a/gags/chocolate~.js b/gags/chocolate~.js index 14b7e0a9..ab66635e 100644 --- a/gags/chocolate~.js +++ b/gags/chocolate~.js @@ -89,7 +89,7 @@ exports.tags = ["drug"]; // Clear Dissolve Timer exports.onUnlock = (data) => { - setUserVar(data.userID, "confectionaryDissolveTimer", undefined) + setUserVar(data.serverID, data.userID, "confectionaryDissolveTimer", undefined) } // Unit Tests diff --git a/gags/forbidden.js b/gags/forbidden.js index adfee4e3..2f7b1ce4 100644 --- a/gags/forbidden.js +++ b/gags/forbidden.js @@ -4,7 +4,7 @@ const { getOption } = require("../functions/getters/config/getOption"); const garbleText = (text, parent, intensity, msg) => { let newtextparts = text.split(" "); let outtext = text; - let forbiddenwords = getOption(msg.author.id, "forbiddengagpunishwords") ?? []; + let forbiddenwords = getOption(msg.guild.id, msg.author.id, "forbiddengagpunishwords") ?? []; console.log(forbiddenwords) if (!Array.isArray(forbiddenwords)) { return outtext } // Just skip this gag if it's not an array. forbiddenwords.forEach((w) => { diff --git a/gags/goodSub.js b/gags/goodSub.js index 4d9ea637..3e474c7d 100644 --- a/gags/goodSub.js +++ b/gags/goodSub.js @@ -13,7 +13,7 @@ const garbleText = (text, parent, intensity) => { "Mmmghhh~ more please~", "Mmmmmhmmm~ <3", "Please, dont stop~", - "I love Meowstress Enraa!", + //"I love Meowstress Enraa!", "I love being bound!", "I need to live in a kinky dungeon cell!", "Please, tie me up!", @@ -62,7 +62,7 @@ const messageend = (msg, intensity) => { // Add "I am a good girl!" to the list if (msg.member) { - endsoundList.push(convertPronounsText(`\nI am a good USER_PRAISEOBJECT!`, { interactionuser: msg.member, targetuser: msg.member })); + endsoundList.push(convertPronounsText(`\nI am a good USER_PRAISEOBJECT!`, { serverID: msg.guild.id, interactionuser: msg.member, targetuser: msg.member })); } if (intensity > 5) { diff --git a/gags/gummy.js b/gags/gummy.js index a99c7c5a..bf73ad2f 100644 --- a/gags/gummy.js +++ b/gags/gummy.js @@ -88,7 +88,7 @@ exports.choicename = "Gummy Gag"; // Clear Dissolve Timer exports.onUnlock = (data) => { - setUserVar(data.userID, "confectionaryDissolveTimer", undefined) + setUserVar(data.serverID, data.userID, "confectionaryDissolveTimer", undefined) } // Unit Tests diff --git a/gags/headpatslut.js b/gags/headpatslut.js index 5ecf90e6..343d11c2 100644 --- a/gags/headpatslut.js +++ b/gags/headpatslut.js @@ -12,7 +12,7 @@ const headpatlines = [ const messagebegin = (msg, msgTree, msgTreeMods, intensity) => { if (!getUserVar(msg.author.id, "headpatslutgag")) { - let silenced = {"isSilenced": false, id: msg.author.id} + let silenced = {"isSilenced": false, id: msg.author.id, guildid: msg.guild.id } msgTree.callFunc(garble,true,["rawText","moan"],[silenced]) // Run a function on the tree. msgTreeMods.modified = true; } @@ -21,7 +21,7 @@ const messagebegin = (msg, msgTree, msgTreeMods, intensity) => { const garble = (text, parent, silent) => { if (!silent.isSilenced){ silent.isSilenced = true - return convertPronounsText(headpatlines[Math.floor(Math.random() * headpatlines.length)], { interactionuser: { id: silent.id } }) + return convertPronounsText(headpatlines[Math.floor(Math.random() * headpatlines.length)], { interactionuser: { id: silent.id }, serverID: silent.guildid }) } else { return ``; diff --git a/gags/jawbreaker.js b/gags/jawbreaker.js index 89d97cfe..f2d500b9 100644 --- a/gags/jawbreaker.js +++ b/gags/jawbreaker.js @@ -88,7 +88,7 @@ exports.choicename = "Jawbreaker Gag"; // Clear Dissolve Timer exports.onUnlock = (data) => { - setUserVar(data.userID, "confectionaryDissolveTimer", undefined) + setUserVar(data.serverID, data.userID, "confectionaryDissolveTimer", undefined) } // Unit Tests diff --git a/gags/jawbreaker~.js b/gags/jawbreaker~.js index 240216eb..05d59623 100644 --- a/gags/jawbreaker~.js +++ b/gags/jawbreaker~.js @@ -89,7 +89,7 @@ exports.tags = ["drug"]; // Clear Dissolve Timer exports.onUnlock = (data) => { - setUserVar(data.userID, "confectionaryDissolveTimer", undefined) + setUserVar(data.serverID, data.userID, "confectionaryDissolveTimer", undefined) } // Unit Tests diff --git a/gags/politeSub.js b/gags/politeSub.js index d4f54a7c..61b2e951 100644 --- a/gags/politeSub.js +++ b/gags/politeSub.js @@ -62,10 +62,10 @@ const messagebegin = (msg, msgTree, msgTreeMods, intensity) => { if (regexpattern.test(msg.content)) { // They were polite, don't touch it. - setUserVar(msg.member.id, "politeSubisPolite", Date.now() + 30000) + setUserVar(msg.guild.id, msg.member.id, "politeSubisPolite", Date.now() + 30000) return; } - else if (getUserVar(msg.member.id, "politeSubisPolite") > Date.now()) { + else if (getUserVar(msg.guild.id, msg.member.id, "politeSubisPolite") > Date.now()) { // They were polite within the last 30 seconds return; } @@ -74,8 +74,8 @@ const messagebegin = (msg, msgTree, msgTreeMods, intensity) => { msgTree.callFunc(impoliteSub,true,["rawText","moan"],[silenced]) // Run a function on the tree. if(silenced.isSilenced){ msgTreeMods.modified = true - setUserVar(msg.member.id, "politeSubSilenceTime", Date.now() + 300000) // 5 mins of no silenced messages to clear - setUserVar(msg.member.id, "politeSubSilences", (getUserVar(msg.member.id, "politeSubSilences") ?? 0) + 1) + setUserVar(msg.guild.id, msg.member.id, "politeSubSilenceTime", Date.now() + 300000) // 5 mins of no silenced messages to clear + setUserVar(msg.guild.id, msg.member.id, "politeSubSilences", (getUserVar(msg.guild.id, msg.member.id, "politeSubSilences") ?? 0) + 1) } // If the function caught anything, the message is modified. return; } diff --git a/gags/third.js b/gags/third.js index fa0c1ad5..daecc915 100644 --- a/gags/third.js +++ b/gags/third.js @@ -22,9 +22,9 @@ const pregarble = (text, parent, intensity, msg) => { let outtext = text; let replacementstring = "this toy"; - if (getPronouns(msg.author.id, "subject") == "he") { replacementstring = "boy" } - if (getPronouns(msg.author.id, "subject") == "she") { replacementstring = "girl" } - if (getOption(msg.author.id, "deferentialgagsubject").length > 0) { replacementstring = getOption(msg.author.id, "deferentialgagsubject") } + if (getPronouns(msg.guild.id, msg.author.id, "subject") == "he") { replacementstring = "boy" } + if (getPronouns(msg.guild.id, msg.author.id, "subject") == "she") { replacementstring = "girl" } + if (getOption(msg.guild.id, msg.author.id, "deferentialgagsubject").length > 0) { replacementstring = getOption(msg.guild.id, msg.author.id, "deferentialgagsubject") } // Set up sentence array. let docin = nlp(outtext); From 53acaa7c13a0b6b9fea787e1066bc2ede4b64e4f Mon Sep 17 00:00:00 2001 From: Enraa Date: Sun, 21 Jun 2026 00:50:47 -0700 Subject: [PATCH 26/44] Update gasmasklinked.js --- headwear/gasmasklinked.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/headwear/gasmasklinked.js b/headwear/gasmasklinked.js index 2bb667be..b130a0de 100644 --- a/headwear/gasmasklinked.js +++ b/headwear/gasmasklinked.js @@ -6,8 +6,8 @@ exports.tags = ["latex"]; // Remove the shared hose if it is present exports.onUnlock = (data) => { - if (process.headwear && process.headwear[data.userID] && process.headwear[data.userID].sharedbreathhose) { - delete process.headwear[data.userID].sharedbreathhose; + if (process.headwear && process.headwear[data.serverID] && process.headwear[data.serverID][data.userID] && process.headwear[data.serverID][data.userID].sharedbreathhose) { + delete process.headwear[data.serverID][data.userID].sharedbreathhose; } } From df87979c478e55107bd546905efdc7dee028c86a Mon Sep 17 00:00:00 2001 From: Enraa Date: Sun, 21 Jun 2026 09:22:03 -0700 Subject: [PATCH 27/44] Modify config options --- commands/config.js | 6 +- functions/getters/config/getOption.js | 2 +- functions/other/initializeOptions.js | 2 +- lists/configoptions.js | 449 +++++++++++++------------- lists/pronounsMap.js | 9 +- 5 files changed, 232 insertions(+), 236 deletions(-) diff --git a/commands/config.js b/commands/config.js index 69d65b24..df242e30 100644 --- a/commands/config.js +++ b/commands/config.js @@ -110,10 +110,10 @@ module.exports = { let buttonpressed = configoptions[optionparts[2]][optionparts[3]]; let data = { title: buttonpressed.name, desctext: buttonpressed.descmodal, placeholder: buttonpressed.placeholder, page: optionparts[2], pagenum: optionparts[4] }; if (typeof buttonpressed.customtext == "function") { - data.desctext = data.desctext.replace("CUSTOMTEXT", buttonpressed.customtext(interaction.user.id)); + data.desctext = data.desctext.replace("CUSTOMTEXT", buttonpressed.customtext(interaction.guildId, interaction.user.id)); } if (typeof buttonpressed.placeholder == "function") { - data.placeholder = buttonpressed.placeholder(interaction.user.id); + data.placeholder = buttonpressed.placeholder(interaction.guildId, interaction.user.id); } if (!data.pagenum) { data.pagenum = 1 }; @@ -125,7 +125,7 @@ module.exports = { let buttonpressed = configoptions[optionparts[2]][optionparts[3]]; let data = { title: buttonpressed.name, desctext: buttonpressed.descmodal, placeholder: buttonpressed.placeholder, page: optionparts[2], pagenum: optionparts[4] }; if (typeof buttonpressed.customtext == "function") { - data.desctext = data.desctext.replace("CUSTOMTEXT", buttonpressed.customtext(interaction.user.id)); + data.desctext = data.desctext.replace("CUSTOMTEXT", buttonpressed.customtext(interaction.guildId, interaction.user.id)); } if (typeof buttonpressed.placeholder == "function") { data.placeholder = buttonpressed.placeholder(interaction.user.id); diff --git a/functions/getters/config/getOption.js b/functions/getters/config/getOption.js index 04a128ea..f7511e18 100644 --- a/functions/getters/config/getOption.js +++ b/functions/getters/config/getOption.js @@ -34,7 +34,7 @@ function getOption(serverID, userID, option) { optionspages.forEach((k) => { if (k == option) { if (typeof configoptions[p][k].default == "function") { - process.configs.users[serverID][userID][k] = configoptions[p][k].default(userID); + process.configs.users[serverID][userID][k] = configoptions[p][k].default(serverID, userID); } else { process.configs.users[serverID][userID][k] = configoptions[p][k].default; } diff --git a/functions/other/initializeOptions.js b/functions/other/initializeOptions.js index 1743ee2e..bcc72e9f 100644 --- a/functions/other/initializeOptions.js +++ b/functions/other/initializeOptions.js @@ -15,7 +15,7 @@ function initializeOptions(serverID, userID) { let optionspages = Object.keys(configoptions[p]); optionspages.forEach((k) => { if (typeof configoptions[p][k].default == "function") { - process.configs.users[serverID][userID][k] = configoptions[p][k].default(userID); + process.configs.users[serverID][userID][k] = configoptions[p][k].default(serverID, userID); } else { process.configs.users[serverID][userID][k] = configoptions[p][k].default; } diff --git a/lists/configoptions.js b/lists/configoptions.js index bfa3c790..5f8143e0 100644 --- a/lists/configoptions.js +++ b/lists/configoptions.js @@ -3,6 +3,7 @@ const { removeToy } = require("../functions/setters/toy/removeToy") const { setOption } = require("../functions/setters/config/setOption") const { ButtonStyle } = require("discord.js"); const { markForSave } = require("../functions/other/markForSave"); +const { setPronouns } = require("../functions/setters/config/setPronouns"); /*********** @@ -38,24 +39,24 @@ const configoptions = { name: "Set Link", helptext: "Link set to \n", helptextnone: "*No profile link*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `https://discord.gg/`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `https://discord.gg/`; }, textvaluedisplay: (val) => { return val; }, menutype: "choice_textentry", - default: (userID) => { + default: (serverID, userID) => { return ``; }, disabled: () => { @@ -71,24 +72,24 @@ const configoptions = { name: "Set Link", helptext: "Link set to \n", helptextnone: "*No kink list link*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `https://discord.gg/`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `https://discord.gg/`; }, textvaluedisplay: (val) => { return val; }, menutype: "choice_textentry", - default: (userID) => { + default: (serverID, userID) => { return ``; }, disabled: () => { @@ -104,24 +105,24 @@ const configoptions = { name: "Set Title", helptext: "Displaying as **", helptextnone: "*No Preferred Titles Set*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `Miss, Lady, Sir, Master`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `Miss, Lady, Sir, Master`; }, textvaluedisplay: (val) => { return `${val}**`; }, menutype: "choice_textentry", - default: (userID) => { + default: (serverID, userID) => { return ``; }, disabled: () => { @@ -135,11 +136,8 @@ const configoptions = { { name: "She/her", helptext: "Feminine Pronouns (she, her, hers, herself)", - select_function: (userID) => { - if (process.pronouns == undefined) { - process.pronouns = {}; - } - process.pronouns[userID] = { subject: "she", object: "her", possessive: "hers", possessiveDeterminer: "her", reflexive: "herself", subjectIs: "she's", subjectWill: "she'll" } + select_function: (serverID, userID) => { + setPronouns(serverID, userID, "she/her") markForSave("pronouns"); }, value: "she", @@ -148,11 +146,8 @@ const configoptions = { { name: "He/him", helptext: "Masculine Pronouns (he, him, his, himself)", - select_function: (userID) => { - if (process.pronouns == undefined) { - process.pronouns = {}; - } - process.pronouns[userID] = { subject: "he", object: "him", possessive: "his", possessiveDeterminer: "his", reflexive: "himself", subjectIs: "he's", subjectWill: "he'll" } + select_function: (serverID, userID) => { + setPronouns(serverID, userID, "he/him") markForSave("pronouns"); }, value: "he", @@ -161,11 +156,8 @@ const configoptions = { { name: "They/them", helptext: "Nonbinary Pronouns (they, them, their, themself)", - select_function: (userID) => { - if (process.pronouns == undefined) { - process.pronouns = {}; - } - process.pronouns[userID] = { subject: "they", object: "them", possessive: "theirs", possessiveDeterminer: "their", reflexive: "themself", subjectIs: "they're", subjectWill: "they'll" } + select_function: (serverID, userID) => { + setPronouns(serverID, userID, "they/them") markForSave("pronouns"); }, value: "they", @@ -174,11 +166,8 @@ const configoptions = { { name: "It/its", helptext: "Object Pronouns (it, it, its, itself)", - select_function: (userID) => { - if (process.pronouns == undefined) { - process.pronouns = {}; - } - process.pronouns[userID] = { subject: "it", object: "it", possessive: "its", possessiveDeterminer: "its", reflexive: "itself", subjectIs: "it's", subjectWill: "it'll" } + select_function: (serverID, userID) => { + setPronouns(serverID, userID, "it/its") markForSave("pronouns"); }, value: "it", @@ -187,12 +176,9 @@ const configoptions = { { name: "Not Set", helptext: "Pronouns have not been set yet", - select_function: (userID) => { - setOption(userID, "pronouns", "she"); - if (process.pronouns == undefined) { - process.pronouns = {}; - } - process.pronouns[userID] = { subject: "she", object: "her", possessive: "hers", possessiveDeterminer: "her", reflexive: "herself", subjectIs: "she's", subjectWill: "she'll" } + select_function: (serverID, userID) => { + setOption(serverID, userID, "pronouns", "she"); + setPronouns(serverID, userID, "she/her") markForSave("pronouns"); }, value: "notset", @@ -212,42 +198,42 @@ const configoptions = { { name: "Follow Gender", helptext: "Follow Selected Pronouns/State", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "follow", style: ButtonStyle.Secondary, }, { name: "Girl", helptext: "Good **Girl!**", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "girl", style: ButtonStyle.Secondary, }, { name: "Boy", helptext: "Good **Boy!**", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "boy", style: ButtonStyle.Secondary, }, { name: "Toy", helptext: "Good **Toy!**", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "toy", style: ButtonStyle.Secondary, }, { name: "Doll", helptext: "Good **Doll.**", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "doll", style: ButtonStyle.Secondary, }, { name: "Drone", helptext: "Good **Drone.**", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "drone", style: ButtonStyle.Secondary, }, @@ -265,35 +251,35 @@ const configoptions = { { name: "Everyone", helptext: "Everyone is allowed to pat you without prompts", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "everyonenoprompt", style: ButtonStyle.Secondary, }, { name: "Everyone (Prompt)", helptext: "Everyone but keyholders will prompt to pat you", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "everyone", style: ButtonStyle.Secondary, }, { name: "Keyholders", helptext: "Only Keyholders can pat you and without prompts", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "keyholdernoprompt", style: ButtonStyle.Secondary, }, { name: "Keyholders (Prompt)", helptext: "Only Keyholders can pat you with prompts", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "keyholder", style: ButtonStyle.Secondary, }, { name: "Nobody", helptext: "Nobody can pat you", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "nobody", style: ButtonStyle.Danger, }, @@ -313,24 +299,24 @@ const configoptions = { name: "Set Users", helptext: "Users set to ", helptextnone: "*No Users Set*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `https://discord.gg/`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `https://discord.gg/`; }, uservaluedisplay: (val) => { return val; }, menutype: "choice_userentry", - default: (userID) => { + default: (serverID, userID) => { return ``; }, disabled: () => { @@ -344,28 +330,28 @@ const configoptions = { { name: "Everyone", helptext: "Everyone is allowed to shock you", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "everyonenoprompt", style: ButtonStyle.Secondary, }, { name: "Collar Access", helptext: "Anyone with access to your collar is allowed to shock you", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "collaraccess", style: ButtonStyle.Secondary, }, { name: "Keyholders", helptext: "Only Keyholders can shock you", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "keyholdernoprompt", style: ButtonStyle.Secondary, }, { name: "Nobody", helptext: "Nobody can shock you", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "nobody", style: ButtonStyle.Danger, }, @@ -385,24 +371,24 @@ const configoptions = { name: "Set Users", helptext: "Users set to ", helptextnone: "*No Users Set*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `https://discord.gg/`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `https://discord.gg/`; }, uservaluedisplay: (val) => { return val; }, menutype: "choice_userentry", - default: (userID) => { + default: (serverID, userID) => { return ``; }, disabled: () => { @@ -416,21 +402,21 @@ const configoptions = { { name: "Playful", helptext: "Playful, teasing shock messages", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "playful", style: ButtonStyle.Secondary, }, { name: "Painful", helptext: `Painful shocks intended for masochistic recipients`, - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "painful", style: ButtonStyle.Secondary, }, { name: "Both", helptext: `Randomly selects the tone when shocked`, - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "both", style: ButtonStyle.Secondary, }, @@ -448,14 +434,14 @@ const configoptions = { { name: "None", helptext: "*No Third-Party Shocker*", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "none", style: ButtonStyle.Secondary, }, { name: "Pishock", helptext: `Utilizing the Pishock API. Check menu choices for **Pishock Config**`, - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "pishock", style: ButtonStyle.Secondary, }, @@ -477,24 +463,24 @@ const configoptions = { name: "Set Username", helptext: "Displaying as **", helptextnone: "*No Shocker Username Set*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `Gagbot`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `Gagbot`; }, textvaluedisplay: (val) => { return `${val}**`; }, menutype: "choice_textentry", - default: (userID) => { + default: (serverID, userID) => { return ``; }, disabled: () => { @@ -510,24 +496,24 @@ const configoptions = { name: "Set Name", helptext: "Shocker Name is **", helptextnone: "*No Shocker Name Set*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `Gagbot`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `Gagbot`; }, textvaluedisplay: (val) => { return `${val}**`; }, menutype: "choice_textentry", - default: (userID) => { + default: (serverID, userID) => { return ``; }, disabled: () => { @@ -543,24 +529,24 @@ const configoptions = { name: "Set Shocker Code", helptext: "Shocker Code: **", helptextnone: "*No Shocker Code Set*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `Shocker Code...`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `Shocker Code...`; }, textvaluedisplay: (val) => { return `${val}**`; }, menutype: "choice_textentry", - default: (userID) => { + default: (serverID, userID) => { return ``; }, disabled: () => { @@ -576,24 +562,24 @@ const configoptions = { name: "Set API Key", helptext: "API Key: **", helptextnone: "*No API Key Set*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `Shocker API Key...`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `Shocker API Key...`; }, textvaluedisplay: (val) => { return `${val}**`; }, menutype: "choice_textentry", - default: (userID) => { + default: (serverID, userID) => { return ``; }, disabled: () => { @@ -607,21 +593,21 @@ const configoptions = { { name: "Shock", helptext: "Shock when triggered", - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "0", style: ButtonStyle.Secondary, }, { name: "Vibrate", helptext: `Vibrate when Triggered`, - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "1", style: ButtonStyle.Secondary, }, { name: "Beep", helptext: `Beep when Triggered`, - select_function: (userID) => { return true }, + select_function: (serverID, userID) => { return true }, value: "2", style: ButtonStyle.Secondary, }, @@ -641,9 +627,9 @@ const configoptions = { { name: "Off", helptext: "*Arousal disabled*", - select_function: (userID) => { - removeToy(userID, userID, undefined, true); - clearArousal(userID) + select_function: (serverID, userID) => { + removeToy(serverID, userID, userID, undefined, true); + clearArousal(serverID, userID) }, value: 0, style: ButtonStyle.Danger, @@ -652,7 +638,7 @@ const configoptions = { { name: "Static Arousal", helptext: "Static Arousal (when vibed)", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 1, @@ -662,7 +648,7 @@ const configoptions = { { name: "Dynamic Arousal", helptext: "Dynamic Arousal", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 2, @@ -683,7 +669,7 @@ const configoptions = { { name: "Disabled", helptext: "*Fumbling is disabled*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "disabled", @@ -693,7 +679,7 @@ const configoptions = { { name: "Self Only", helptext: "Can fumble your own keys", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "self", @@ -703,7 +689,7 @@ const configoptions = { { name: "Self and Others", helptext: "You and others can fumble your keys", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "everyone", @@ -724,7 +710,7 @@ const configoptions = { { name: "Disabled", helptext: "*Key Loss is disabled*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "disabled", @@ -734,7 +720,7 @@ const configoptions = { { name: "Enabled", helptext: "**Your keys can be lost**", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -755,7 +741,7 @@ const configoptions = { { name: "No", helptext: "*Blessed Luck is disabled*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "disabled", @@ -765,7 +751,7 @@ const configoptions = { { name: "Yes", helptext: "Failed rolls add to future success chance", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -786,7 +772,7 @@ const configoptions = { { name: "Disabled", helptext: "*Frustration is disabled*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 0, @@ -796,7 +782,7 @@ const configoptions = { { name: "0.5x", helptext: "Frustration adds up to 50% over 2 months", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 0.5, @@ -806,7 +792,7 @@ const configoptions = { { name: "1x", helptext: "Frustration adds up to 50% over 1 month", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 1, @@ -816,7 +802,7 @@ const configoptions = { { name: "2x", helptext: "Frustration adds up to 50% over 2 weeks", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 2, @@ -826,7 +812,7 @@ const configoptions = { { name: "4x", helptext: "Frustration adds up to 50% over 1 week", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 4, @@ -836,7 +822,7 @@ const configoptions = { { name: "10x", helptext: "Frustration adds up to 50% over 3 days", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 10, @@ -846,7 +832,7 @@ const configoptions = { { name: "20x", helptext: "Frustration adds up to 50% over 1.5 days", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 20, @@ -867,7 +853,7 @@ const configoptions = { { name: "Only Mine", helptext: "You will only be able to find keys for restraints you are the primary keyholder of", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "self", @@ -876,7 +862,7 @@ const configoptions = { { name: "Others", helptext: "You will be able to find any fumbled keys. When you discover a key that isn't yours, you will return it after a short period of time.", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "others", @@ -896,7 +882,7 @@ const configoptions = { { name: "Only Keyholder", helptext: "Only your keyholder can discover the keys to your restraints. Others may detect a sparkle.", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "onlykh", @@ -905,7 +891,7 @@ const configoptions = { { name: "Immediately", helptext: "If others find your keys, they'll return them immediately.", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 0, @@ -914,7 +900,7 @@ const configoptions = { { name: "2 Minutes", helptext: "Others can discover your keys and play with you for 2 minutes before automatically returning them.", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 120000, @@ -923,7 +909,7 @@ const configoptions = { { name: "5 Minutes", helptext: "Others can discover your keys and play with you for 5 minutes before automatically returning them.", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 300000, @@ -932,7 +918,7 @@ const configoptions = { { name: "15 Minutes", helptext: "Others can discover your keys and play with you for 15 minutes before automatically returning them.", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 900000, @@ -941,7 +927,7 @@ const configoptions = { { name: "30 Minutes", helptext: "Others can discover your keys and play with you for 30 minutes before automatically returning them.", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 1800000, @@ -961,7 +947,7 @@ const configoptions = { { name: "Very Little", helptext: "*33% of base*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 0.33, @@ -971,7 +957,7 @@ const configoptions = { { name: "Less", helptext: "*66% of base*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 0.66, @@ -981,7 +967,7 @@ const configoptions = { { name: "Normal", helptext: "100% of base", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 1.0, @@ -991,7 +977,7 @@ const configoptions = { { name: "More", helptext: "133% of base", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 1.33, @@ -1001,7 +987,7 @@ const configoptions = { { name: "Much More", helptext: "166% of base", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 1.66, @@ -1011,7 +997,7 @@ const configoptions = { { name: "Too Much...", helptext: "200% of base", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 2.0, @@ -1032,7 +1018,7 @@ const configoptions = { { name: "Bar", helptext: "Displays as a bar representing arousal % of orgasm threshold", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "bar", @@ -1041,7 +1027,7 @@ const configoptions = { { name: "Description", helptext: "Displays as a roleplay flavor text", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "desc", @@ -1050,7 +1036,7 @@ const configoptions = { { name: "Numbers", helptext: "Displays exact Arousal and Orgasm Threshold numbers", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "numbers", @@ -1072,7 +1058,7 @@ const configoptions = { { name: "No", helptext: "*Key giving is disabled*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "disabled", @@ -1082,7 +1068,7 @@ const configoptions = { { name: "Prompt", helptext: "You will be prompted for key transfers", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "prompt", @@ -1092,7 +1078,7 @@ const configoptions = { { name: "Automatic", helptext: "āš ļø **You will accept keygiving requests automatically**", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "auto", @@ -1113,7 +1099,7 @@ const configoptions = { { name: "No", helptext: "*Key cloning is disabled*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "disabled", @@ -1123,7 +1109,7 @@ const configoptions = { { name: "Prompt", helptext: "You will be prompted for key clones", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "prompt", @@ -1133,7 +1119,7 @@ const configoptions = { { name: "Automatic", helptext: "āš ļø **You will accept key cloning requests automatically**", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "auto", @@ -1154,7 +1140,7 @@ const configoptions = { { name: "No", helptext: "*Non-collar Keyholder major bondage will be rejected automatically*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "disabled", @@ -1164,7 +1150,7 @@ const configoptions = { { name: "Yes", helptext: "Others can offer to bind you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -1185,7 +1171,7 @@ const configoptions = { { name: "No", helptext: "*Public Access is disabled*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "disabled", @@ -1195,7 +1181,7 @@ const configoptions = { { name: "Yes", helptext: "**āš ļø You can select public access options on collars and timelocks!**", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -1216,7 +1202,7 @@ const configoptions = { { name: "Everyone", helptext: "Prompt for anyone to remove non-keyed bondage", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "all", @@ -1226,7 +1212,7 @@ const configoptions = { { name: "Everyone except Binder", helptext: "Prompt for anyone besides who put something on you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "all_binder", @@ -1236,7 +1222,7 @@ const configoptions = { { name: "Everyone except Binder and Keyholder(s)", helptext: "Prompt for anyone besides who put something on you or keyholders", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "all_binder_and_keyholder", @@ -1246,7 +1232,7 @@ const configoptions = { { name: "Disabled", helptext: "Automatically allow bondage to be removed", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "accept", @@ -1267,7 +1253,7 @@ const configoptions = { { name: "No", helptext: "*Editing messages will use the edited contents*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "disabled", @@ -1277,7 +1263,7 @@ const configoptions = { { name: "Yes", helptext: "Editing Bot messages will use original contents", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -1298,7 +1284,7 @@ const configoptions = { { name: "10 minutes", helptext: "Only a short while...", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 600000, @@ -1307,7 +1293,7 @@ const configoptions = { { name: "30 minutes", helptext: "A little while!", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 1800000, @@ -1316,7 +1302,7 @@ const configoptions = { { name: "60 minutes", helptext: "A while!", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 3600000, @@ -1325,7 +1311,7 @@ const configoptions = { { name: "3 hours", helptext: "A *while!*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 10800000, @@ -1334,7 +1320,7 @@ const configoptions = { { name: "24 hours", helptext: "A decent time", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 86400000, @@ -1343,7 +1329,7 @@ const configoptions = { { name: "72 hours", helptext: "A long time", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 259200000, @@ -1363,7 +1349,7 @@ const configoptions = { { name: "Revoke", helptext: "*Revoking helptext that'll never be used lol*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "disabled", @@ -1388,24 +1374,24 @@ const configoptions = { name: "Set Name", helptext: "Doll Visor name is set to ", helptextnone: "*Doll Visor name has not been set*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `DOLL-${userID.slice(-4)}`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `DOLL-${userID.slice(-4)}`; }, textvaluedisplay: (val) => { return val; }, menutype: "choice_textentry", - default: (userID) => { + default: (serverID, userID) => { return `DOLL-${userID.slice(-4)}`; }, disabled: () => { @@ -1438,7 +1424,7 @@ const configoptions = { { name: "No", helptext: "*Doll Visor will not affect pronouns*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "disabled", @@ -1448,7 +1434,7 @@ const configoptions = { { name: "Yes", helptext: "You will use it/its pronouns while wearing a visor", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -1469,7 +1455,7 @@ const configoptions = { { name: "No", helptext: "*Doll Visor will not punish the wearer*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "disabled", @@ -1479,7 +1465,7 @@ const configoptions = { { name: "Warn", helptext: "Doll Visor will warn on violations, but not punish", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "warning", @@ -1489,7 +1475,7 @@ const configoptions = { { name: "Yes", helptext: "Doll Visor will punish the wearer. This can apply mittens and heavy!", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -1510,7 +1496,7 @@ const configoptions = { { name: "1 Violation", helptext: "Every violation is a punishment", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 1, @@ -1520,7 +1506,7 @@ const configoptions = { { name: "2 Violations", helptext: "Every 2 violations", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 2, @@ -1530,7 +1516,7 @@ const configoptions = { { name: "3 Violations", helptext: "Every 3 violations", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 3, @@ -1540,7 +1526,7 @@ const configoptions = { { name: "4 Violations", helptext: "Every 4 violations", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 4, @@ -1550,7 +1536,7 @@ const configoptions = { { name: "5 Violations", helptext: "Every 5 violations", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 5, @@ -1573,24 +1559,24 @@ const configoptions = { name: "Set Forbidden Words", helptext: "Forbidden words set to: ", helptextnone: "*No forbidden words*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `person,/h+u+m+a+n+/`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `person,/h+u+m+a+n+/,grin`; }, textvaluedisplay: (val) => { return (val ? val.join(", ") : "**None Set**") }, menutype: "choice_textentry", - default: (userID) => { + default: (serverID, userID) => { return ``; }, disabled: () => { @@ -1606,24 +1592,24 @@ const configoptions = { name: "Set Name", helptext: "⬔-Drone Visor name is set to ", helptextnone: "*⬔-Drone Visor name has not been set*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `${userID.slice(-4)}`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `${userID.slice(-4)}`; }, textvaluedisplay: (val) => { return val; }, menutype: "choice_textentry", - default: (userID) => { + default: (serverID, userID) => { return `${userID.slice(-4)}`; }, disabled: () => { @@ -1639,24 +1625,24 @@ const configoptions = { name: "Set Name", helptext: "Engraved Collar Name set to: ", helptextnone: "*No Engraved Collar Name*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `Your name...`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `Your name...`; }, textvaluedisplay: (val) => { return val; }, menutype: "choice_textentry", - default: (userID) => { + default: (serverID, userID) => { return ``; }, disabled: () => { @@ -1672,24 +1658,24 @@ const configoptions = { name: "Set Name", helptext: "Deferential subject set to: ", helptextnone: "*No Deferential Name*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `Your deferential name...`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `Your deferential name...`; }, textvaluedisplay: (val) => { return val; }, menutype: "choice_textentry", - default: (userID) => { + default: (serverID, userID) => { return ``; }, disabled: () => { @@ -1705,24 +1691,24 @@ const configoptions = { name: "Set Forbidden Words", helptext: "Forbidden words set to: ", helptextnone: "*No forbidden words*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "None", style: ButtonStyle.Primary, }, ], - customtext: (userID) => { + customtext: (serverID, userID) => { return `person,/h+u+m+a+n+/`; }, - placeholder: (userID) => { + placeholder: (serverID, userID) => { return `person,/h+u+m+a+n+/,grin`; }, textvaluedisplay: (val) => { return (val ? val.join(", ") : "**None Set**") }, menutype: "choice_textentry", - default: (userID) => { + default: (serverID, userID) => { return ``; }, disabled: () => { @@ -1736,7 +1722,7 @@ const configoptions = { { name: "0.5x", helptext: "Effects are half as long", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 0.5, @@ -1746,7 +1732,7 @@ const configoptions = { { name: "1x", helptext: "Effects are standard length", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 1, @@ -1756,7 +1742,7 @@ const configoptions = { { name: "2x", helptext: "Effects are twice as long", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 2, @@ -1766,7 +1752,7 @@ const configoptions = { { name: "3x", helptext: "Effects are thrice as long", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: 3, @@ -1789,7 +1775,7 @@ const configoptions = { { name: "None", helptext: "*Others will not be able to put items of this tag on you*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "none", @@ -1798,7 +1784,7 @@ const configoptions = { { name: "Yes", helptext: "Items of this tag can be added to you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -1807,7 +1793,7 @@ const configoptions = { { name: "Preferred", helptext: "Items of this tag will have priority in random effects on you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "preferred", @@ -1827,7 +1813,7 @@ const configoptions = { { name: "None", helptext: "*Others will not be able to put items of this tag on you*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "none", @@ -1836,7 +1822,7 @@ const configoptions = { { name: "Yes", helptext: "Items of this tag can be added to you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -1845,7 +1831,7 @@ const configoptions = { { name: "Preferred", helptext: "Items of this tag will have priority in random effects on you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "preferred", @@ -1865,7 +1851,7 @@ const configoptions = { { name: "None", helptext: "*Others will not be able to put items of this tag on you*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "none", @@ -1874,7 +1860,7 @@ const configoptions = { { name: "Yes", helptext: "Items of this tag can be added to you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -1883,7 +1869,7 @@ const configoptions = { { name: "Preferred", helptext: "Items of this tag will have priority in random effects on you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "preferred", @@ -1903,7 +1889,7 @@ const configoptions = { { name: "None", helptext: "*Others will not be able to put items of this tag on you*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "none", @@ -1912,7 +1898,7 @@ const configoptions = { { name: "Yes", helptext: "Items of this tag can be added to you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -1921,7 +1907,7 @@ const configoptions = { { name: "Preferred", helptext: "Items of this tag will have priority in random effects on you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "preferred", @@ -1941,7 +1927,7 @@ const configoptions = { { name: "None", helptext: "*Others will not be able to put items of this tag on you*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "none", @@ -1950,7 +1936,7 @@ const configoptions = { { name: "Yes", helptext: "Items of this tag can be added to you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -1959,7 +1945,7 @@ const configoptions = { { name: "Preferred", helptext: "Items of this tag will have priority in random effects on you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "preferred", @@ -1979,7 +1965,7 @@ const configoptions = { { name: "None", helptext: "*Others will not be able to put items of this tag on you*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "none", @@ -1988,7 +1974,7 @@ const configoptions = { { name: "Yes", helptext: "Items of this tag can be added to you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -1997,7 +1983,7 @@ const configoptions = { { name: "Preferred", helptext: "Items of this tag will have priority in random effects on you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "preferred", @@ -2017,7 +2003,7 @@ const configoptions = { { name: "None", helptext: "*Others will not be able to put items of this tag on you*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "none", @@ -2026,7 +2012,7 @@ const configoptions = { { name: "Yes", helptext: "Items of this tag can be added to you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -2035,7 +2021,7 @@ const configoptions = { { name: "Preferred", helptext: "Items of this tag will have priority in random effects on you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "preferred", @@ -2055,7 +2041,7 @@ const configoptions = { { name: "None", helptext: "*Others will not be able to put items of this tag on you*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "none", @@ -2064,7 +2050,7 @@ const configoptions = { { name: "Yes", helptext: "Items of this tag can be added to you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -2073,7 +2059,7 @@ const configoptions = { { name: "Preferred", helptext: "Items of this tag will have priority in random effects on you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "preferred", @@ -2093,7 +2079,7 @@ const configoptions = { { name: "None", helptext: "*Others will not be able to put items of this tag on you*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "none", @@ -2102,7 +2088,7 @@ const configoptions = { { name: "Yes", helptext: "Items of this tag can be added to you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -2111,7 +2097,7 @@ const configoptions = { { name: "Preferred", helptext: "Items of this tag will have priority in random effects on you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "preferred", @@ -2131,7 +2117,7 @@ const configoptions = { { name: "None", helptext: "*Others will not be able to put items of this tag on you*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "none", @@ -2140,7 +2126,7 @@ const configoptions = { { name: "Yes", helptext: "Items of this tag can be added to you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -2149,7 +2135,7 @@ const configoptions = { { name: "Preferred", helptext: "Items of this tag will have priority in random effects on you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "preferred", @@ -2169,7 +2155,7 @@ const configoptions = { { name: "None", helptext: "*Others will not be able to put items of this tag on you*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "none", @@ -2178,7 +2164,7 @@ const configoptions = { { name: "Yes", helptext: "Items of this tag can be added to you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -2187,7 +2173,7 @@ const configoptions = { { name: "Preferred", helptext: "Items of this tag will have priority in random effects on you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "preferred", @@ -2207,7 +2193,7 @@ const configoptions = { { name: "None", helptext: "*Others will not be able to put items of this tag on you*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "none", @@ -2216,7 +2202,7 @@ const configoptions = { { name: "Yes", helptext: "Items of this tag can be added to you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "enabled", @@ -2225,7 +2211,7 @@ const configoptions = { { name: "Preferred", helptext: "Items of this tag will have priority in random effects on you", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, value: "preferred", @@ -3202,7 +3188,7 @@ const configoptions = { { name: "Disabled", helptext: "*Bot will not respond to messages*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, // We will need to have this update commands value: "Disabled", @@ -3211,7 +3197,7 @@ const configoptions = { { name: "Enabled", helptext: "āœ”ļø Bot responds to messages", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, // We will need to have this update commands value: "Enabled", @@ -3231,7 +3217,7 @@ const configoptions = { { name: "Disabled", helptext: "*Bot will not allow new setups except from you*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, // We will need to have this update commands value: "Disabled", @@ -3240,7 +3226,7 @@ const configoptions = { { name: "Enabled", helptext: "āš ļø Bot will allow new setups if added to server", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, // We will need to have this update commands value: "Enabled", @@ -3334,7 +3320,7 @@ const configoptions = { { name: "Disabled", helptext: "*Users will not be able to find keys*", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, // We will need to have this update commands value: "Disabled", @@ -3343,7 +3329,7 @@ const configoptions = { { name: "Enabled", helptext: "āœ”ļø Users can find keys", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, // We will need to have this update commands value: "Enabled", @@ -3363,15 +3349,18 @@ const configoptions = { { name: "Disabled", helptext: "*Users will not be able to fumble their keys*", - select_function: (userID) => { + select_function: (serverID, userID) => { // Purge all fumbled keys let processvars = ["collar", "chastity", "chastitybra"]; processvars.forEach((pv) => { if (process[pv] == undefined) { process[pv] = {} } - Object.entries(process[pv]).forEach((en) => { - if (en[1]?.fumbled) { - delete en[1].fumbled; - } + Object.keys(process[pv]).forEach((server) => { + if (process[pv][server] == undefined) { process[pv][server] = {} } + Object.entries(process[pv][server]).forEach((en) => { + if (en[1]?.fumbled) { + delete en[1].fumbled; + } + }) }) }) }, // We will need to have this update commands @@ -3381,7 +3370,7 @@ const configoptions = { { name: "Enabled", helptext: "āœ”ļø Users can fumble keys", - select_function: (userID) => { + select_function: (serverID, userID) => { return false; }, // We will need to have this update commands value: "Enabled", diff --git a/lists/pronounsMap.js b/lists/pronounsMap.js index 59cc2207..402ce442 100644 --- a/lists/pronounsMap.js +++ b/lists/pronounsMap.js @@ -1,4 +1,11 @@ -// Pronoun types +/******** + * Pronoun Types + * + * - she/her + * - he/him + * - they/them + * - it/its + ********/ const pronounsMap = new Map([ ["she/her", { subject: "she", object: "her", possessive: "hers", possessiveDeterminer: "her", reflexive: "herself", subjectIs: "she's", subjectWill: "she'll" }], ["he/him", { subject: "he", object: "him", possessive: "his", possessiveDeterminer: "his", reflexive: "himself", subjectIs: "he's", subjectWill: "he'll" }], From 071a70c242d64edb7dbef7139fdc575ac4dabaf5 Mon Sep 17 00:00:00 2001 From: Enraa Date: Sun, 21 Jun 2026 09:30:40 -0700 Subject: [PATCH 28/44] Toys --- toys/Misc/default.js | 2 +- toys/Misc/ice.js | 2 +- toys/Nipple/default.js | 14 +++++++------- toys/Plugs/default.js | 16 ++++++++-------- toys/Plugs/plug_motionsensitive.js | 6 +++--- toys/Vibrator/default.js | 14 +++++++------- toys/Vibrator/vibe_headpatbattery.js | 8 ++++---- toys/Vibrator/vibe_polite.js | 6 +++--- toys/Vibrator/vibe_reverb.js | 16 ++++++++-------- toys/Wand/default.js | 4 ++-- toys/Wand/wand_raising.js | 2 +- 11 files changed, 45 insertions(+), 45 deletions(-) diff --git a/toys/Misc/default.js b/toys/Misc/default.js index 93369d65..e15a0876 100644 --- a/toys/Misc/default.js +++ b/toys/Misc/default.js @@ -33,7 +33,7 @@ exports.fumble = (data) => { return 0 }; exports.discard = (data) => { return () => { return false }} // Action when equipping -exports.onEquip = (data) => { addArousal(data.userID, 0.0) }; // hopefully enough to jumpstart, if not oh well +exports.onEquip = (data) => { addArousal(data.serverID, data.userID, 0.0) }; // hopefully enough to jumpstart, if not oh well // Calculation for effective arousal // Note, this should be used for checks more focused around the vibe - it will be diff --git a/toys/Misc/ice.js b/toys/Misc/ice.js index 8b5dc5f1..9d95b6d5 100644 --- a/toys/Misc/ice.js +++ b/toys/Misc/ice.js @@ -5,7 +5,7 @@ const { getChastity } = require("../../functions/getters/chastity/getChastity") // This reduces the arousal of the wearer by a proportion of their current arousal exports.vibescale = (data) => { return (Math.max(Math.min(getArousal(data.serverID, data.userID) / 10, 10), 1) * -1) } exports.calcVibeEffect = function (data) { - if (getChastity(data.userID)) { + if (getChastity(data.serverID, data.userID)) { return data.intensity * 0.4 * (this.vibescale(data) * 0.40) // 40% effectiveness if in chastity } else { diff --git a/toys/Nipple/default.js b/toys/Nipple/default.js index 229c2d92..0cd6c9aa 100644 --- a/toys/Nipple/default.js +++ b/toys/Nipple/default.js @@ -13,33 +13,33 @@ exports.intensitychange = (data) => { return 0 } exports.postLetGo = (data) => { return false } // Condition for allowing equip -exports.canEquip = (data) => { return (!getChastityBra(data.userID) || getBaseChastity(getChastityBra(data.userID).chastitytype ?? "bra_silver").canAccessToys(data)) } +exports.canEquip = (data) => { return (!getChastityBra(data.serverID, data.userID) || getBaseChastity(getChastityBra(data.serverID, data.userID).chastitytype ?? "bra_silver").canAccessToys(data)) } // Condition for allowing unequip -exports.canUnequip = (data) => { return (!getChastityBra(data.userID) || getBaseChastity(getChastityBra(data.userID).chastitytype ?? "bra_silver").canAccessToys(data)) } +exports.canUnequip = (data) => { return (!getChastityBra(data.serverID, data.userID) || getBaseChastity(getChastityBra(data.serverID, data.userID).chastitytype ?? "bra_silver").canAccessToys(data)) } // Condition to force unequip on refresh exports.forceUnequip = (data) => { return false } // Condition to check if wearer is wearing a potential blocker -exports.blocker = (data) => { return getChastityBra(data.userID) } +exports.blocker = (data) => { return getChastityBra(data.serverID, data.userID) } // Condition to allow modification -exports.canModify = (data) => { return (!getChastityBra(data.userID) || getBaseChastity(getChastityBra(data.userID).chastitytype ?? "bra_silver").canAccessToys(data)) }; +exports.canModify = (data) => { return (!getChastityBra(data.serverID, data.userID) || getBaseChastity(getChastityBra(data.serverID, data.userID).chastitytype ?? "bra_silver").canAccessToys(data)) }; // Condition that rolls a fumble function, returning it's results // 0 = Success, 1 = Fail, no loss, 2 = Fail, loss exports.fumble = (data) => { - return getBaseChastity(getChastityBra(data.userID).chastitytype ?? "bra_silver").fumble(data); + return getBaseChastity(getChastityBra(data.serverID, data.userID).chastitytype ?? "bra_silver").fumble(data); }; // Discard function if the .fumble causes it exports.discard = (data) => { - return getBaseChastity(getChastityBra(data.userID).chastitytype ?? "bra_silver").discard(data); + return getBaseChastity(getChastityBra(data.serverID, data.userID).chastitytype ?? "bra_silver").discard(data); }; // Action when equipping -exports.onEquip = (data) => { addArousal(data.userID, data.intensity / 4) }; +exports.onEquip = (data) => { addArousal(data.serverID, data.userID, data.intensity / 4) }; // Calculation for effective arousal // Note, this should be used for checks more focused around the vibe - it will be diff --git a/toys/Plugs/default.js b/toys/Plugs/default.js index 2194080f..583dbb38 100644 --- a/toys/Plugs/default.js +++ b/toys/Plugs/default.js @@ -15,37 +15,37 @@ exports.intensitychange = (data) => { return 0 } exports.postLetGo = (data) => { return false } // Condition for allowing equip -exports.canEquip = (data) => { return (!getChastity(data.userID) || getBaseChastity(getChastity(data.userID).chastitytype ?? "belt_silver").canAccessToys(data)) } +exports.canEquip = (data) => { return (!getChastity(data.serverID, data.userID) || getBaseChastity(getChastity(data.serverID, data.userID).chastitytype ?? "belt_silver").canAccessToys(data)) } // Condition for allowing unequip -exports.canUnequip = (data) => { return (!getChastity(data.userID) || getBaseChastity(getChastity(data.userID).chastitytype ?? "belt_silver").canAccessToys(data)) } +exports.canUnequip = (data) => { return (!getChastity(data.serverID, data.userID) || getBaseChastity(getChastity(data.serverID, data.userID).chastitytype ?? "belt_silver").canAccessToys(data)) } // Condition to force unequip on refresh exports.forceUnequip = (data) => { return false } // Condition to check if wearer is wearing a potential blocker -exports.blocker = (data) => { return getChastity(data.userID) } +exports.blocker = (data) => { return getChastity(data.serverID, data.userID) } // Condition to allow modification -exports.canModify = (data) => { return (!getChastity(data.userID) || getBaseChastity(getChastity(data.userID).chastitytype ?? "belt_silver").canAccessToys(data)) }; +exports.canModify = (data) => { return (!getChastity(data.serverID, data.userID) || getBaseChastity(getChastity(data.serverID, data.userID).chastitytype ?? "belt_silver").canAccessToys(data)) }; // Condition that rolls a fumble function from the blocking device, returning it's results // 0 = Success, 1 = Fail, no loss, 2 = Fail, loss exports.fumble = (data) => { - return getBaseChastity(getChastity(data.userID).chastitytype ?? "belt_silver").fumble(data); + return getBaseChastity(getChastity(data.serverID, data.userID).chastitytype ?? "belt_silver").fumble(data); }; // Discard function if the .fumble causes it exports.discard = (data) => { - return getBaseChastity(getChastity(data.userID).chastitytype ?? "belt_silver").discard(data); + return getBaseChastity(getChastity(data.serverID, data.userID).chastitytype ?? "belt_silver").discard(data); } // Action when equipping -exports.onEquip = (data) => { addArousal(data.userID, data.intensity) }; +exports.onEquip = (data) => { addArousal(data.serverID, data.userID, data.intensity) }; // Action when unequipping - The relief is so good, arouse them again. // Since data.intensity is gone, lets just add a flat 5 -exports.onUnequip = (data) => { addArousal(data.userID, 5) }; +exports.onUnequip = (data) => { addArousal(data.serverID, data.userID, 5) }; // Calculation for effective arousal // Note, this should be used for checks more focused around the plug - it will be diff --git a/toys/Plugs/plug_motionsensitive.js b/toys/Plugs/plug_motionsensitive.js index b6243485..d4373dd4 100644 --- a/toys/Plugs/plug_motionsensitive.js +++ b/toys/Plugs/plug_motionsensitive.js @@ -4,15 +4,15 @@ const { setUserVar } = require("../../functions/setters/config/setUserVar"); // This plug will vibrate when the wearer speaks, setting the vibe scale HIGH for it exports.calcVibeEffect = function (data) { - return (getUserVar(data.userID, "motionplugtime") ? (data.intensity * 4) * this.vibescale() : data.intensity * this.vibescale() * 0.7) + return (getUserVar(data.serverID, data.userID, "motionplugtime") ? (data.intensity * 4) * this.vibescale() : data.intensity * this.vibescale() * 0.7) } exports.onUnequip = function (data) { - setUserVar(data.userID, "motionplugtime", undefined); + setUserVar(data.serverID, data.userID, "motionplugtime", undefined); } exports.onEquip = function (data) { - setUserVar(data.userID, "motionplugtime", undefined); + setUserVar(data.serverID, data.userID, "motionplugtime", undefined); } exports.toyname = "Motion Sensitive Plug" \ No newline at end of file diff --git a/toys/Vibrator/default.js b/toys/Vibrator/default.js index 768dbf8d..ac06c560 100644 --- a/toys/Vibrator/default.js +++ b/toys/Vibrator/default.js @@ -13,33 +13,33 @@ exports.intensitychange = (data) => { return 0 } exports.postLetGo = (data) => { return false } // Condition for allowing equip -exports.canEquip = (data) => { return (!getChastity(data.userID) || getBaseChastity(getChastity(data.userID).chastitytype ?? "belt_silver").canAccessToys(data)) } +exports.canEquip = (data) => { return (!getChastity(data.serverID, data.userID) || getBaseChastity(getChastity(data.serverID, data.userID).chastitytype ?? "belt_silver").canAccessToys(data)) } // Condition for allowing unequip -exports.canUnequip = (data) => { return (!getChastity(data.userID) || getBaseChastity(getChastity(data.userID).chastitytype ?? "belt_silver").canAccessToys(data)) } +exports.canUnequip = (data) => { return (!getChastity(data.serverID, data.userID) || getBaseChastity(getChastity(data.serverID, data.userID).chastitytype ?? "belt_silver").canAccessToys(data)) } // Condition to force unequip on refresh exports.forceUnequip = (data) => { return false } // Condition to check if wearer is wearing a potential blocker -exports.blocker = (data) => { return getChastity(data.userID) } +exports.blocker = (data) => { return getChastity(data.serverID, data.userID) } // Condition to allow modification -exports.canModify = (data) => { return (!getChastity(data.userID) || getBaseChastity(getChastity(data.userID).chastitytype ?? "belt_silver").canAccessToys(data)) }; +exports.canModify = (data) => { return (!getChastity(data.serverID, data.userID) || getBaseChastity(getChastity(data.serverID, data.userID).chastitytype ?? "belt_silver").canAccessToys(data)) }; // Condition that rolls a fumble function from the blocking device, returning it's results // 0 = Success, 1 = Fail, no loss, 2 = Fail, loss exports.fumble = (data) => { - return getBaseChastity(getChastity(data.userID).chastitytype ?? "belt_silver").fumble(data); + return getBaseChastity(getChastity(data.serverID, data.userID).chastitytype ?? "belt_silver").fumble(data); }; // Discard function if the .fumble causes it exports.discard = (data) => { - return getBaseChastity(getChastity(data.userID).chastitytype ?? "belt_silver").discard(data); + return getBaseChastity(getChastity(data.serverID, data.userID).chastitytype ?? "belt_silver").discard(data); } // Action when equipping -exports.onEquip = (data) => { addArousal(data.userID, data.intensity / 2) }; +exports.onEquip = (data) => { addArousal(data.serverID, data.userID, data.intensity / 2) }; // Calculation for effective arousal // Note, this should be used for checks more focused around the vibe - it will be diff --git a/toys/Vibrator/vibe_headpatbattery.js b/toys/Vibrator/vibe_headpatbattery.js index 0291b294..ecc884f1 100644 --- a/toys/Vibrator/vibe_headpatbattery.js +++ b/toys/Vibrator/vibe_headpatbattery.js @@ -4,19 +4,19 @@ const { setUserVar } = require("../../functions/setters/config/setUserVar"); // This vibrator will only function if getUserVar(userID, "headpatvibecharge") has any value exports.vibescale = (data) => { - return (getUserVar(data.userID, "headpatvibecharge") ? 1.5 : 0.0); + return (getUserVar(data.serverID, data.userID, "headpatvibecharge") ? 1.5 : 0.0); } // Ranging between 0 and 2 exports.calcVibeEffect = function(data) { - return (getUserVar(data.userID, "headpatvibecharge") ? data.intensity * this.vibescale(data) : 0.0) + return (getUserVar(data.serverID, data.userID, "headpatvibecharge") ? data.intensity * this.vibescale(data) : 0.0) } exports.onUnequip = (data) => { - setUserVar(data.userID, "headpatvibecharge", undefined) + setUserVar(data.serverID, data.userID, "headpatvibecharge", undefined) } exports.onEquip = (data) => { - setUserVar(data.userID, "headpatvibecharge", 0.0) + setUserVar(data.serverID, data.userID, "headpatvibecharge", 0.0) } exports.toyname = "Headpat Capacitor Vibe" \ No newline at end of file diff --git a/toys/Vibrator/vibe_polite.js b/toys/Vibrator/vibe_polite.js index 75454793..2371638a 100644 --- a/toys/Vibrator/vibe_polite.js +++ b/toys/Vibrator/vibe_polite.js @@ -6,15 +6,15 @@ const { setUserVar } = require("../../functions/setters/config/setUserVar") exports.vibescale = (data) => { return 3.0 } // Not a mistake. Very arousing to be compliant! exports.calcVibeEffect = function (data) { - return (getUserVar(data.userID, "politeSubVibeTime") ? data.intensity * this.vibescale() : 0) + return (getUserVar(data.serverID, data.userID, "politeSubVibeTime") ? data.intensity * this.vibescale() : 0) } exports.onUnequip = function (data) { - setUserVar(data.userID, "politeSubVibeTime", null); + setUserVar(data.serverID, data.userID, "politeSubVibeTime", null); } exports.onEquip = function (data) { - setUserVar(data.userID, "politeSubVibeTime", null); + setUserVar(data.serverID, data.userID, "politeSubVibeTime", null); } exports.toyname = "Polite Vibe" \ No newline at end of file diff --git a/toys/Vibrator/vibe_reverb.js b/toys/Vibrator/vibe_reverb.js index fe9f8c97..67a65d3a 100644 --- a/toys/Vibrator/vibe_reverb.js +++ b/toys/Vibrator/vibe_reverb.js @@ -6,24 +6,24 @@ const { setUserVar } = require("../../functions/setters/config/setUserVar"); exports.vibescale = (data) => { //console.log(`${data.userID}`) //console.log(`${getUserVar(data.userID, "reverbVibeIntensity")/10}`); - return (isNaN(Math.max(0, Math.min(getUserVar(data.userID, "reverbVibeIntensity")/10, 2))) ? 0 : Math.max(0, Math.min(getUserVar(data.userID, "reverbVibeIntensity")/10, 2))); + return (isNaN(Math.max(0, Math.min(getUserVar(data.serverID, data.userID, "reverbVibeIntensity")/10, 2))) ? 0 : Math.max(0, Math.min(getUserVar(data.serverID, data.userID, "reverbVibeIntensity")/10, 2))); } // Ranging between 0 and 2 exports.calcVibeEffect = function(data) { //console.log(`${data.userID}`) - return (getUserVar(data.userID, "reverbEndTime") ? data.intensity * this.vibescale(data) : 0) + return (getUserVar(data.serverID, data.userID, "reverbEndTime") ? data.intensity * this.vibescale(data) : 0) } exports.onUnequip = (data) => { - setUserVar(data.userID, "reverbEndTime", undefined); - setUserVar(data.userID, "reverbDecayTime", undefined); - setUserVar(data.userID, "reverbVibeIntensity", 0); + setUserVar(data.serverID, data.userID, "reverbEndTime", undefined); + setUserVar(data.serverID, data.userID, "reverbDecayTime", undefined); + setUserVar(data.serverID, data.userID, "reverbVibeIntensity", 0); } exports.onEquip = (data) => { - setUserVar(data.userID, "reverbEndTime", undefined); - setUserVar(data.userID, "reverbDecayTime", undefined); - setUserVar(data.userID, "reverbVibeIntensity", 0); + setUserVar(data.serverID, data.userID, "reverbEndTime", undefined); + setUserVar(data.serverID, data.userID, "reverbDecayTime", undefined); + setUserVar(data.serverID, data.userID, "reverbVibeIntensity", 0); } exports.toyname = "Reverb Vibe" \ No newline at end of file diff --git a/toys/Wand/default.js b/toys/Wand/default.js index 4a753793..66621f0f 100644 --- a/toys/Wand/default.js +++ b/toys/Wand/default.js @@ -34,13 +34,13 @@ exports.fumble = (data) => { return 0 }; exports.discard = (data) => { return () => { return false }} // Action when equipping -exports.onEquip = (data) => { addArousal(data.userID, 0.2) }; // hopefully enough to jumpstart, if not oh well +exports.onEquip = (data) => { addArousal(data.serverID, data.userID, 0.2) }; // hopefully enough to jumpstart, if not oh well // Calculation for effective arousal // Note, this should be used for checks more focused around the vibe - it will be // further multiplied by the chastity's checks for this, if applicable. exports.calcVibeEffect = function (data) { - if (getChastity(data.userID)) { + if (getChastity(data.serverID, data.userID)) { return data.intensity * (this.vibescale() * 0.25) // 25% effectiveness if in chastity } else { diff --git a/toys/Wand/wand_raising.js b/toys/Wand/wand_raising.js index fd79f54e..ffe4412a 100644 --- a/toys/Wand/wand_raising.js +++ b/toys/Wand/wand_raising.js @@ -8,7 +8,7 @@ const { getChastity } = require("../../functions/getters/chastity/getChastity") // the exact timespan. exports.calcVibeEffect = function (data) { - if (getChastity(data.userID)) { + if (getChastity(data.serverID, data.userID)) { // 25% effectiveness if in chastity return (data.intensity * (this.vibescale() * 0.25) * 3.0 * ((performance.now() % 300000) / 300000)) } From bef8b3907402fc139614f0b657cfea8e4908344d Mon Sep 17 00:00:00 2001 From: Enraa Date: Sun, 21 Jun 2026 10:44:20 -0700 Subject: [PATCH 29/44] index.js This modifies index.js to include a function to hopefully build the new server based data structure. Also includes a potential fix to ignore any message with forwarded or crossposted content. --- functions/other/findUserInGuild.js | 26 +++++++++ functions/other/preloadGuilds.js | 11 ++++ index.js | 90 +++++++++++++++++++++--------- 3 files changed, 101 insertions(+), 26 deletions(-) create mode 100644 functions/other/findUserInGuild.js create mode 100644 functions/other/preloadGuilds.js diff --git a/functions/other/findUserInGuild.js b/functions/other/findUserInGuild.js new file mode 100644 index 00000000..56a2a86d --- /dev/null +++ b/functions/other/findUserInGuild.js @@ -0,0 +1,26 @@ +const { logConsole } = require("../logfunctions"); + +/********** + * Finds a user in any guilds the bot is a part of and returns that list. Must be run after preloadGuilds! + * + * - (user id) userID - The user we're checking + * --- + * ##### Returns an array of guild IDs that the user was found in + **********/ +async function findUserInGuild(userID) { + let useringuilds = []; + if (process.client) { + let guilds = process.client.guilds.cache.map(guild => guild.id) + for (const guildID of guilds) { + let guild = process.client.guilds.cache.get(guildID); + try { + await guild.members.fetch(userID) + useringuilds.push(guildID) + } + catch (err) { + // Not in the guild + logConsole(`User ${userID} is not in ${guildID}`, 4) + } + } + } +} \ No newline at end of file diff --git a/functions/other/preloadGuilds.js b/functions/other/preloadGuilds.js new file mode 100644 index 00000000..1e325421 --- /dev/null +++ b/functions/other/preloadGuilds.js @@ -0,0 +1,11 @@ +/********* + * Does a full fetch on all guilds the bot currently belongs to. As the information is unnecessary, this does NOT include members or presences. + * + * --- + * ##### *No return value* + *********/ +async function preloadGuilds() { + if (process.client) { + await process.client.guilds.fetch(); + } +} \ No newline at end of file diff --git a/index.js b/index.js index a7174531..d714e0df 100644 --- a/index.js +++ b/index.js @@ -22,7 +22,8 @@ const { loadCollarTypes } = require('./functions/collarfunctions.js'); const { buttonboard } = require('./contextcommands/message/Button Board.js'); const { setUpEventFunctions } = require('./functions/eventhandling.js'); const { getBotOption } = require('./functions/getters/config/getBotOption.js'); -const { getAllJoinedGuilds } = require("./functions/getters/config/getAllJoinedGuilds.js") +const { getAllJoinedGuilds } = require("./functions/getters/config/getAllJoinedGuilds.js"); +const { logConsole } = require('./functions/logfunctions.js'); // Prevent node from killing us immediately when we do the next line. process.stdin.resume(); @@ -79,30 +80,30 @@ let GagbotSavedFileDirectory = process.env.GAGBOTFILEDIRECTORY ? process.env.GAG process.GagbotSavedFileDirectory = GagbotSavedFileDirectory // Because honestly, I dont know WHY global stuff in index.js can't be accessble everywhere let processdatatoload = [ - { textname: "gaggedusers.txt", processvar: "gags", default: {} }, - { textname: "mittenedusers.txt", processvar: "mitten", default: {} }, - { textname: "chastityusers.txt", processvar: "chastity", default: {} }, - { textname: "chastitybrausers.txt", processvar: "chastitybra", default: {} }, - { textname: "toyusers.txt", processvar: "toys", default: {} }, - { textname: "collarusers.txt", processvar: "collar", default: {} }, - { textname: "heavyusers.txt", processvar: "heavy", default: {} }, - { textname: "pronounsusers.txt", processvar: "pronouns", default: {} }, - { textname: "usersdata.txt", processvar: "usercontext", default: {} }, + { textname: "gaggedusers.txt", processvar: "gags", default: {}, hasusers: true }, + { textname: "mittenedusers.txt", processvar: "mitten", default: {}, hasusers: true }, + { textname: "chastityusers.txt", processvar: "chastity", default: {}, hasusers: true }, + { textname: "chastitybrausers.txt", processvar: "chastitybra", default: {}, hasusers: true }, + { textname: "toyusers.txt", processvar: "toys", default: {}, hasusers: true }, + { textname: "collarusers.txt", processvar: "collar", default: {}, hasusers: true }, + { textname: "heavyusers.txt", processvar: "heavy", default: {}, hasusers: true }, + { textname: "pronounsusers.txt", processvar: "pronouns", default: {}, hasusers: true }, + { textname: "usersdata.txt", processvar: "usercontext", default: {}, hasusers: true }, { textname: "consentusers.txt", processvar: "consented", default: {} }, - { textname: "corsetusers.txt", processvar: "corset", default: {} }, - { textname: "arousal.txt", processvar: "arousal", default: {} }, - { textname: "headwearusers.txt", processvar: "headwear", default: {} }, + { textname: "corsetusers.txt", processvar: "corset", default: {}, hasusers: true }, + { textname: "arousal.txt", processvar: "arousal", default: {}, hasusers: true }, + { textname: "headwearusers.txt", processvar: "headwear", default: {}, hasusers: true }, { textname: "discardedkeys.txt", processvar: "discardedKeys", default: [] }, - { textname: "configs.txt", processvar: "configs", default: {}}, - { textname: "outfits.txt", processvar: "outfits", default: {}}, - { textname: "dollusers.txt", processvar: "dolls", default: {}}, - { textname: "wearables.txt", processvar: "wearable", default: {}}, - { textname: "webhooks.txt", processvar: "webhookstoload", default: {}}, - { textname: "recordedmessages.txt", processvar: "recordedmessages", default: {}}, - { textname: "delveuserdata.txt", processvar: "delveuserdata", default: {}}, - { textname: "userstats.txt", processvar: "userstats", default: {}}, - { textname: "memberavatars.txt", processvar: "memberavatars", default: {}}, - { textname: "heldkeytimers.txt", processvar: "heldkeytimers", default: {}}, + { textname: "configs.txt", processvar: "configs", default: {} }, + { textname: "outfits.txt", processvar: "outfits", default: {} }, + { textname: "dollusers.txt", processvar: "dolls", default: {}, hasusers: true }, + { textname: "wearables.txt", processvar: "wearable", default: {}, hasusers: true }, + { textname: "webhooks.txt", processvar: "webhookstoload", default: {} }, + { textname: "recordedmessages.txt", processvar: "recordedmessages", default: {} }, + { textname: "delveuserdata.txt", processvar: "delveuserdata", default: {}, hasusers: true }, + { textname: "userstats.txt", processvar: "userstats", default: {}, hasusers: true }, + { textname: "memberavatars.txt", processvar: "memberavatars", default: {}, hasusers: true }, + { textname: "heldkeytimers.txt", processvar: "heldkeytimers", default: {}, hasusers: true }, ] processdatatoload.forEach((s) => { @@ -262,6 +263,45 @@ client.on("clientReady", async () => { generateListTexts(); + // This code will be removed in a later update! + let guilds = process.client.guilds.cache.map(guild => guild.id) + processdatatoload.forEach(async (pd) => { + try { + if (pd.processvar) { + Object.keys(pd.processvar).forEach((user) => { + let useringuilds = []; + if (!guilds.includes(user) && pd.hasusers) { // This is a USER object! + let inaguild = false; + for (const guildID of guilds) { + let guild = process.client.guilds.cache.get(guildID); + try { + let founduser = await guild.members.fetch(user) + if (founduser) { + if (process[pd.processvar][guildID] == undefined) { process[pd.processvar][guildID] = {} } + process[pd.processvar][guildID][user] = Object.assign({}, process[pd.processvar][user]) + inaguild = true; + } + } + catch (err) { + // Not in the guild + logConsole(`User ${user} is not in ${guildID}`, 4) + } + } + if (inaguild) { + delete process[pd.processvar][user] + } + else { + console.log(`User ${user} is not in ANY guild, leaving in place`) + } + } + }) + } + } + catch (err) { + console.log(err); + } + }) + scavengeUsers(client); setInterval(() => { try { @@ -306,7 +346,7 @@ client.on("messageCreate", async (msg) => { process.recentmessages[msg.author.id] = msg.channel.id; modifymessage(msg, thread ? msg.channelId : null); } - if ((msg.channel.id != process.env.CHANNELID && msg.channel.parentId != process.env.CHANNELID) || (msg.webhookId) || (msg.author.bot) || (msg.stickers?.first())) { return } + if ((msg.channel.id != process.env.CHANNELID && msg.channel.parentId != process.env.CHANNELID) || (msg.webhookId) || (msg.author.bot) || (msg.stickers?.first()) || (message.flags && message.flags.has(discord.MessageFlags.HasSnapshot)) || (message.flags && message.flags.has(discord.MessageFlags.IsCrosspost))) { return } } catch (err) { console.log(err); @@ -335,8 +375,6 @@ client.on('interactionCreate', async (interaction) => { process.recentmessages[message.author.id] = interaction.channelId; } } - - //process.recentmessages[interaction.targetId] = interaction.channelId; } if (interaction.isUserContextMenuCommand()) { usercontextcommands.get(`${interaction.commandName}`)?.execute(interaction) From 717a59a30e89f82420cc17fe7c91c74cb70f53c4 Mon Sep 17 00:00:00 2001 From: Enraa Date: Sun, 21 Jun 2026 10:47:28 -0700 Subject: [PATCH 30/44] The toast gets an ad --- functions/gagfunctions.js | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/gagfunctions.js b/functions/gagfunctions.js index ff900bb4..c74bdca2 100644 --- a/functions/gagfunctions.js +++ b/functions/gagfunctions.js @@ -554,6 +554,7 @@ async function appendCollarEffects(msg, outtext, msgTreeMods) { `Cassandra's Secret - Witch by Day, Obedient Doll by Night`, `Sponsorship Collar - Put me on. Advertise our corporate overlords like a good little subbie drone you are!`, `DommeDash - Feeding Subs, One Door at a Time!`, + `Toast - The single piece that carries a hungry cat` ] appendmessages.push(`-# Sponsored by ${sponsors[Math.floor(sponsors.length * Math.random())]}`); setUserVar(msg.guild.id, msg.author.id, "sponsorcollartrigger", Date.now()); From 6c9c3377fbb523a6bcc46afa07e1a3b25aca0e1b Mon Sep 17 00:00:00 2001 From: Enraa Date: Sun, 21 Jun 2026 10:55:39 -0700 Subject: [PATCH 31/44] move aroused texts into lists --- functions/getters/arousal/getArousedTexts.js | 2 +- {vibes/aroused => lists}/aroused_texts.js | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {vibes/aroused => lists}/aroused_texts.js (100%) diff --git a/functions/getters/arousal/getArousedTexts.js b/functions/getters/arousal/getArousedTexts.js index 8ff48fa3..1954de1e 100644 --- a/functions/getters/arousal/getArousedTexts.js +++ b/functions/getters/arousal/getArousedTexts.js @@ -1,4 +1,4 @@ -const { arousedtexts } = require("../../../vibes/aroused/aroused_texts"); +const { arousedtexts } = require("../../../lists/aroused_texts"); const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); const { calcStaticVibeIntensity } = require("../../vibefunctions"); const { getOption } = require("../config/getOption"); diff --git a/vibes/aroused/aroused_texts.js b/lists/aroused_texts.js similarity index 100% rename from vibes/aroused/aroused_texts.js rename to lists/aroused_texts.js From 284dee6de9c5e9f64b52a8948043f54c3206701d Mon Sep 17 00:00:00 2001 From: Enraa Date: Sun, 21 Jun 2026 19:30:36 -0700 Subject: [PATCH 32/44] so many eventfunctions --- .../chastity/belt_seal_falsecalm.js | 10 +- eventfunctions/collar/collar_maidtraining.js | 10 +- eventfunctions/collar/collar_struggle.js | 39 ++-- eventfunctions/collar/collarengraved.js | 4 +- eventfunctions/collar/collarheadpatvuln.js | 32 +-- eventfunctions/gags/chocolate.js | 18 +- eventfunctions/gags/chocolate~.js | 34 +-- eventfunctions/gags/gummy.js | 18 +- eventfunctions/gags/headpatslut.js | 10 +- eventfunctions/gags/jawbreaker.js | 18 +- eventfunctions/gags/jawbreaker~.js | 26 +-- eventfunctions/gags/politeSub.js | 16 +- eventfunctions/headwear/gasmasklinked.js | 41 ++-- eventfunctions/heavy/capture_sphere.js | 93 +++++---- eventfunctions/heavy/capture_sphere_great.js | 83 ++++---- eventfunctions/heavy/capture_sphere_love.js | 84 ++++---- eventfunctions/heavy/capture_sphere_master.js | 83 ++++---- eventfunctions/heavy/capture_sphere_ultra.js | 83 ++++---- eventfunctions/heavy/costumer_mimic.js | 197 +++++++++--------- eventfunctions/heavy/costumer_mimic_chaos.js | 183 ++++++++-------- eventfunctions/heavy/costumer_mimic_latex.js | 179 ++++++++-------- eventfunctions/heavy/doll_processing.js | 147 ++++++------- eventfunctions/heavy/windupclockwork.js | 24 +-- eventfunctions/toys/plug_motionsensitive.js | 14 +- eventfunctions/toys/vibe_headpatbattery.js | 24 +-- eventfunctions/toys/vibe_polite.js | 16 +- eventfunctions/toys/vibe_reverb.js | 30 +-- 27 files changed, 768 insertions(+), 748 deletions(-) diff --git a/eventfunctions/chastity/belt_seal_falsecalm.js b/eventfunctions/chastity/belt_seal_falsecalm.js index 8301a31c..e28c9d39 100644 --- a/eventfunctions/chastity/belt_seal_falsecalm.js +++ b/eventfunctions/chastity/belt_seal_falsecalm.js @@ -5,21 +5,21 @@ const { getToys } = require("../../functions/getters/toy/getToys"); const { setUserVar } = require("../../functions/setters/config/setUserVar"); -let tick = async function(userid, data) { +let tick = async function(serverID, userid, data) { //Tickrate Modifier let tickMod = (getBotOption("bot-timetickrate") / 60000) - if(getToys(userid).length > 0) + if(getToys(serverID, userid).length > 0) { // Calc Impact of Toys and increment Base_Arousal - getToys(userid).forEach(toy => { - setUserVar(userid, "base_arousal", getUserVar(userid, "base_arousal") + (getBaseToy(toy.type).calcVibeEffect({ userID: userid, intensity: toy.intensity }) * tickMod)) + getToys(serverID, userid).forEach(toy => { + setUserVar(serverID, userid, "base_arousal", getUserVar(serverID, userid, "base_arousal") + (getBaseToy(serverID, toy.type).calcVibeEffect({ serverID: serverID, userID: userid, intensity: toy.intensity }) * tickMod)) }); } else { // Slow Decrement of Arousal if no Toys - setUserVar(userid, "base_arousal", Math.max(getUserVar(userid, "base_arousal") - tickMod, 0)); + setUserVar(serverID, userid, "base_arousal", Math.max(getUserVar(serverID, userid, "base_arousal") - tickMod, 0)); } } diff --git a/eventfunctions/collar/collar_maidtraining.js b/eventfunctions/collar/collar_maidtraining.js index 515a1457..11893791 100644 --- a/eventfunctions/collar/collar_maidtraining.js +++ b/eventfunctions/collar/collar_maidtraining.js @@ -2,12 +2,12 @@ const { getPronouns } = require("../../functions/getters/config/getPronouns"); const { messageSendChannel } = require("../../functions/messagefunctions"); const { assignGag } = require("../../functions/setters/gag/assignGag"); -function msgfunction(userid, data) { +function msgfunction(serverID, userid, data) { const curses = ["fuck", "fucking", "fuckin", "motherfucker", "damn", "dammit", "bitch", "shit", "bitchin'", "ass", "asshole", "arse", "goddammit", "piss", "dick", "dickhead", "damned", "bullshit", "fucked", "fucker", "crap", "hell", "cunt", "bollocks", "slut", "sluts", "idiot"]; const uncouthreminders = [ - `<@${userid}> has quite the mouth, so unbecoming of a trainee maid! ${getPronouns(userid, "subject", true)} ${(getPronouns(userid, "subject") == "they") ? "have" : "has"} been gagged with a bar of soap to teach ${getPronouns(userid, "object")} how to speak properly!`, - `Apparently forgetting that ${getPronouns(userid, "subject")} ${getPronouns(userid, "subject") == "they" ? "are" : "is"} on a training program, <@${userid}> has spoken foul language! A soap gag will hopefully correct this error.`, - `A **good** maid does not use such unrefined language! <@${userid}> will wear a bar of soap while ${getPronouns(userid, "subject")} think${(getPronouns(userid, "subject") == "they") ? "" : "s"} about what ${getPronouns(userid, "subject")} said.` + `<@${userid}> has quite the mouth, so unbecoming of a trainee maid! ${getPronouns(serverID, userid, "subject", true)} ${(getPronouns(serverID, userid, "subject") == "they") ? "have" : "has"} been gagged with a bar of soap to teach ${getPronouns(serverID, userid, "object")} how to speak properly!`, + `Apparently forgetting that ${getPronouns(serverID, userid, "subject")} ${getPronouns(serverID, userid, "subject") == "they" ? "are" : "is"} on a training program, <@${userid}> has spoken foul language! A soap gag will hopefully correct this error.`, + `A **good** maid does not use such unrefined language! <@${userid}> will wear a bar of soap while ${getPronouns(serverID, userid, "subject")} think${(getPronouns(serverID, userid, "subject") == "they") ? "" : "s"} about what ${getPronouns(serverID, userid, "subject")} said.` ] let cursesmap = curses.join("|"); @@ -16,7 +16,7 @@ function msgfunction(userid, data) { if (regexpattern.test(data.outtext)) { // They are UNCOUTH! Their speech somehow included foul language // Gag them with the soap gag. - assignGag(userid, "soap", 8, userid); + assignGag(serverID, userid, "soap", 8, userid); messageSendChannel(uncouthreminders[Math.floor(Math.random() * uncouthreminders.length)], process.recentmessages[userid]) return; diff --git a/eventfunctions/collar/collar_struggle.js b/eventfunctions/collar/collar_struggle.js index de0f2ef9..a027cd92 100644 --- a/eventfunctions/collar/collar_struggle.js +++ b/eventfunctions/collar/collar_struggle.js @@ -19,17 +19,17 @@ const { getText } = require("../../functions/textfunctions"); exports.tick = async (serverID, userID, data) => { try { // Cancel until the user has said AT LEAST three things or has waited long enough. - if (getUserVar(userID, "struggleCollarMsgs") < 5) { return } - if (getUserVar(userID, "struggleCollarDelay") >= Date.now()) { return } + if (getUserVar(serverID, userID, "struggleCollarMsgs") < 5) { return } + if (getUserVar(serverID, userID, "struggleCollarDelay") >= Date.now()) { return } - let heavybondage = getHeavy(userID)?.displayname; + let heavybondage = getHeavy(serverID, userID)?.displayname; let gagbondage = getGagLast(serverID, userID); - let mittenbondage = getMitten(userID); - let chastitybondage = getChastity(userID); - let chastitybrabondage = getChastityBra(userID) - let headbondage = getHeadwear(userID); - let corsetbondage = getCorset(userID); - let collarbondage = getCollar(userID); + let mittenbondage = getMitten(serverID, userID); + let chastitybondage = getChastity(serverID, userID); + let chastitybrabondage = getChastityBra(serverID, userID) + let headbondage = getHeadwear(serverID, userID); + let corsetbondage = getCorset(serverID, userID); + let collarbondage = getCollar(serverID, userID); let chooseopts = []; if (heavybondage) { chooseopts.push("heavy") } @@ -45,14 +45,15 @@ exports.tick = async (serverID, userID, data) => { let data = { textarray: "texts_struggle", textdata: { + serverID: serverID, interactionuser: { id: userID }, targetuser: { id: userID }, // Doesn't really matter but we're adding to avoid a crash - c1: getHeavy(userID)?.displayname, // heavy bondage type - c2: convertGagText(getGagLast(interaction.guildId, userID)), - c3: getMittenName(userID) ?? "mittens", - c4: getChastityName(userID) ?? "chastity belt", - c5: getCollarName(userID) ?? "collar", - c6: getChastityBraName(userID) ?? "chastity bra" + c1: getHeavy(serverID, userID)?.displayname, // heavy bondage type + c2: convertGagText(getGagLast(serverID, userID)), + c3: getMittenName(serverID, userID) ?? "mittens", + c4: getChastityName(serverID, userID) ?? "chastity belt", + c5: getCollarName(serverID, userID) ?? "collar", + c6: getChastityBraName(serverID, userID) ?? "chastity bra" }, }; @@ -245,13 +246,13 @@ exports.tick = async (serverID, userID, data) => { } // Wait between 4 and 14 minutes for another struggle. - setUserVar(userID, "struggleCollarDelay", Date.now() + 240000 + Math.floor(Math.random() * 600000)) - setUserVar(userID, "struggleCollarMsgs", 0); + setUserVar(serverID, userID, "struggleCollarDelay", Date.now() + 240000 + Math.floor(Math.random() * 600000)) + setUserVar(serverID, userID, "struggleCollarMsgs", 0); } catch (err) { console.log(err); } } -exports.msgfunction = (userid, data) => { - setUserVar(userid, "struggleCollarMsgs", (getUserVar(userid, "struggleCollarMsgs") ?? 1) + 1); +exports.msgfunction = (serverID, userid, data) => { + setUserVar(serverID, userid, "struggleCollarMsgs", (getUserVar(userid, "struggleCollarMsgs") ?? 1) + 1); } \ No newline at end of file diff --git a/eventfunctions/collar/collarengraved.js b/eventfunctions/collar/collarengraved.js index ac86f727..eade259f 100644 --- a/eventfunctions/collar/collarengraved.js +++ b/eventfunctions/collar/collarengraved.js @@ -27,6 +27,6 @@ exports.modal = async (interaction, userid) => { exports.modalexecute = async (interaction) => { interaction.deferUpdate(); - setOption(interaction.user.id, "engravedcollarname", interaction.fields.getTextInputValue("choiceinput").slice(0,30)); - await interaction.reply({ content: `Updated your engraved pet tag to ${getOption(interaction.user.id, "engravedcollarname")}`, flags: MessageFlags.Ephemeral }) + setOption(interaction.guildId, interaction.user.id, "engravedcollarname", interaction.fields.getTextInputValue("choiceinput").slice(0,30)); + await interaction.reply({ content: `Updated your engraved pet tag to ${getOption(interaction.guildId, interaction.user.id, "engravedcollarname")}`, flags: MessageFlags.Ephemeral }) } \ No newline at end of file diff --git a/eventfunctions/collar/collarheadpatvuln.js b/eventfunctions/collar/collarheadpatvuln.js index 3cd5ff81..b04e15b1 100644 --- a/eventfunctions/collar/collarheadpatvuln.js +++ b/eventfunctions/collar/collarheadpatvuln.js @@ -6,38 +6,38 @@ const { setUserVar } = require("../../functions/setters/config/setUserVar"); const { getTextGeneric } = require("../../functions/textfunctions"); // Since headpats can only ever crit if they hit, then we should just simply check for that! -function headpatfunction(recipient, data) { +function headpatfunction(serverID, recipient, data) { const critheadpatmessages = [ - `The headpat felt so good that it left <@${recipient}> stunned for a few moments! One could capitalize on this opportunity to further bind ${getPronouns(recipient, "object")}!`, - `<@${recipient}>'s eyes are a bit hazy as ${getPronouns(recipient, "subject")} is lost in thought after that headpat. ${getPronouns(recipient, "subject", true)} could easily be bound right now...`, - `Unexpectedly, <@${recipient}>'s movements look a little sluggish. Now would be the best time to combo ${getPronouns(recipient, "object")} with bondage!`, - `<@${recipient}> sighs in delight at receiving that amazing headpat, blissfully unaware of anyone who might want to bind ${getPronouns(recipient, "object")} super tightly!`, - `<@${recipient}> lowers ${getPronouns(recipient, "possessiveDeterminer")} guard as that headpat was in just the perfect place! ${getPronouns(recipient, "subject", true)} probably won't say no to some bondage!` + `The headpat felt so good that it left <@${recipient}> stunned for a few moments! One could capitalize on this opportunity to further bind ${getPronouns(serverID, recipient, "object")}!`, + `<@${recipient}>'s eyes are a bit hazy as ${getPronouns(serverID, recipient, "subject")} is lost in thought after that headpat. ${getPronouns(serverID, recipient, "subject", true)} could easily be bound right now...`, + `Unexpectedly, <@${recipient}>'s movements look a little sluggish. Now would be the best time to combo ${getPronouns(serverID, recipient, "object")} with bondage!`, + `<@${recipient}> sighs in delight at receiving that amazing headpat, blissfully unaware of anyone who might want to bind ${getPronouns(serverID, recipient, "object")} super tightly!`, + `<@${recipient}> lowers ${getPronouns(serverID, recipient, "possessiveDeterminer")} guard as that headpat was in just the perfect place! ${getPronouns(serverID, recipient, "subject", true)} probably won't say no to some bondage!` ] - if (data.returnedobject && data.returnedobject.crit && !getUserVar(recipient, "headpatvulntimer")) { + if (data.returnedobject && data.returnedobject.crit && !getUserVar(serverID, recipient, "headpatvulntimer")) { try { // Delay by 3 seconds to attempt to arrange the order setTimeout(() => { - messageSendChannel(critheadpatmessages[Math.floor(Math.random() * critheadpatmessages.length)], process.recentmessages[recipient]) + messageSendChannel(critheadpatmessages[Math.floor(Math.random() * critheadpatmessages.length)], process.recentmessages[serverID][recipient]) }, 3000); } catch (err) { console.log(err) } - setUserVar(recipient, "headpatvulntimer", Date.now() + 300000) - if (getCollar(recipient).keyholder_only) { - getCollar(recipient).headpatvulnerable = (Date.now() + 300000); + setUserVar(serverID, recipient, "headpatvulntimer", Date.now() + 300000) + if (getCollar(serverID, recipient).keyholder_only) { + getCollar(serverID, recipient).headpatvulnerable = (Date.now() + 300000); } } } // Clear crit cooldown if we somehow crashed. -async function tick(userid, data) { - if (getUserVar(userid, "headpatvulntimer") && (Date.now() > getUserVar(userid, "headpatvulntimer"))) { - setUserVar(userid, "headpatvulntimer", undefined); +async function tick(serverID, userid, data) { + if (getUserVar(serverID, userid, "headpatvulntimer") && (Date.now() > getUserVar(userid, "headpatvulntimer"))) { + setUserVar(serverID, userid, "headpatvulntimer", undefined); } - if (getCollar(userid).headpatvulnerable < Date.now()) { - getCollar(userid).headpatvulnerable = undefined; + if (getCollar(serverID, userid).headpatvulnerable < Date.now()) { + getCollar(serverID, userid).headpatvulnerable = undefined; } } diff --git a/eventfunctions/gags/chocolate.js b/eventfunctions/gags/chocolate.js index e3f1be37..fa52899e 100644 --- a/eventfunctions/gags/chocolate.js +++ b/eventfunctions/gags/chocolate.js @@ -10,24 +10,24 @@ const DISSOLVE_RATE_MS = 60000; async function tick(serverID, userID, data) { // Init Countdown Variable on First Run if not already present - if (getUserVar(userID, "confectionaryDissolveTimer") == undefined) { - setUserVar(userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) + if (getUserVar(serverID, userID, "confectionaryDissolveTimer") == undefined) { + setUserVar(serverID, userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) } // Decrement Intensity every timer interval - if (getUserVar(userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "chocolate") && process.recentmessages[userID]) { + if (getUserVar(serverID, userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "chocolate") && process.recentmessages[serverID][userID]) { if(getGag(serverID, userID, "chocolate").intensity > 1){ - setUserVar(userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) + setUserVar(serverID, userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) // Get Intensity and push decremented version let oldIntensity = getGag(serverID, userID, "chocolate").intensity - assignGag(userID, "chocolate", oldIntensity - 1) - messageSendChannel(`<@${userID}>'s licking has shrunk ${getPronouns(userID, "possessiveDeterminer")} Chocolate Gag a little bit!`, process.recentmessages[userID]) + assignGag(serverID, userID, "chocolate", oldIntensity - 1) + messageSendChannel(`<@${userID}>'s licking has shrunk ${getPronouns(serverID, userID, "possessiveDeterminer")} Chocolate Gag a little bit!`, process.recentmessages[serverID][userID]) } else { // Clear Gag and Dissolve Timer - setUserVar(userID, "confectionaryDissolveTimer", undefined) - removeGag(userID, "chocolate") - messageSendChannel(`<@${userID}>'s Chocolate Gag has dissolved away!`, process.recentmessages[userID]) + setUserVar(serverID, userID, "confectionaryDissolveTimer", undefined) + removeGag(serverID, userID, "chocolate") + messageSendChannel(`<@${userID}>'s Chocolate Gag has dissolved away!`, process.recentmessages[serverID][userID]) } } } diff --git a/eventfunctions/gags/chocolate~.js b/eventfunctions/gags/chocolate~.js index ee9d4141..90e5c520 100644 --- a/eventfunctions/gags/chocolate~.js +++ b/eventfunctions/gags/chocolate~.js @@ -9,39 +9,39 @@ const { setUserVar } = require("../../functions/setters/config/setUserVar.js"); const DISSOLVE_RATE_MS = 60000; -async function tick(userID, data) { +async function tick(serverID, userID, data) { // Init Countdown Variable on First Run if not already present - if (getUserVar(userID, "aphroConfectionaryDissolveTimer") == undefined) { - setUserVar(userID, "aphroConfectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) + if (getUserVar(serverID, userID, "aphroConfectionaryDissolveTimer") == undefined) { + setUserVar(serverID, userID, "aphroConfectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) // init the Aphrodisiac Counter - setUserVar(userID, "aphroCount", 1) + setUserVar(serverID, userID, "aphroCount", 1) } // Decrement Intensity every timer interval - if (getUserVar(userID, "aphroConfectionaryDissolveTimer") < Date.now() && getGag(userID, "chocolate~") && process.recentmessages[userID]) { - if(getGag(userID, "chocolate~").intensity > 1){ - setUserVar(userID, "aphroConfectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) + if (getUserVar(serverID, userID, "aphroConfectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "chocolate~") && process.recentmessages[serverID][userID]) { + if(getGag(serverID, userID, "chocolate~").intensity > 1){ + setUserVar(serverID, userID, "aphroConfectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) // Get Intensity and push decremented version - let oldIntensity = getGag(userID, "chocolate~").intensity - assignGag(userID, "chocolate~", oldIntensity - 1) + let oldIntensity = getGag(serverID, userID, "chocolate~").intensity + assignGag(serverID, userID, "chocolate~", oldIntensity - 1) // Add arousal, growing with each count of chocolate melted then increment the count - addArousal(userID, (0.2 * getUserVar(userID, "aphroCount"))) - setUserVar(userID, "aphroCount", getUserVar(userID, "aphroCount") + 1) + addArousal(serverID, userID, (0.2 * getUserVar(serverID, userID, "aphroCount"))) + setUserVar(serverID, userID, "aphroCount", getUserVar(serverID, userID, "aphroCount") + 1) - messageSendChannel(`<@${userID}>'s licking has shrunk ${getPronouns(userID, "possessiveDeterminer")} Chocolate Gag a little bit. The chocolate was particularly tasty and makes ${getPronouns(userID, "object")} a little warm inside!`, process.recentmessages[userID]) + messageSendChannel(`<@${userID}>'s licking has shrunk ${getPronouns(serverID, userID, "possessiveDeterminer")} Chocolate Gag a little bit. The chocolate was particularly tasty and makes ${getPronouns(serverID, userID, "object")} a little warm inside!`, process.recentmessages[serverID][userID]) } else { // Clear Gag and Dissolve Timer - setUserVar(userID, "aphroConfectionaryDissolveTimer", undefined) + setUserVar(serverID, userID, "aphroConfectionaryDissolveTimer", undefined) // Add final double strength burst of arousal as they finish the chocolate then clear counter - addArousal(userID, (0.4 * getUserVar(userID, "aphroCount"))) - setUserVar(userID, "aphroCount", undefined) + addArousal(serverID, userID, (0.4 * getUserVar(serverID, userID, "aphroCount"))) + setUserVar(serverID, userID, "aphroCount", undefined) - deleteGag(userID, "chocolate~") - messageSendChannel(`<@${userID}>'s Chocolate Gag has dissolved away, leaving haunting memories of how good it tasted and how much ${getPronouns(userID, "subject")} want${(getPronouns(userID, "subject") == "they") ? "" : "s"} to touch down there...`, process.recentmessages[userID]) + deleteGag(serverID, userID, "chocolate~") + messageSendChannel(`<@${userID}>'s Chocolate Gag has dissolved away, leaving haunting memories of how good it tasted and how much ${getPronouns(serverID, userID, "subject")} want${(getPronouns(serverID, userID, "subject") == "they") ? "" : "s"} to touch down there...`, process.recentmessages[serverID][userID]) } } } diff --git a/eventfunctions/gags/gummy.js b/eventfunctions/gags/gummy.js index ccaf1d0a..cc5582fa 100644 --- a/eventfunctions/gags/gummy.js +++ b/eventfunctions/gags/gummy.js @@ -10,24 +10,24 @@ const DISSOLVE_RATE_MS = 300000; async function tick(serverID, userID, data) { // Init Countdown Variable on First Run if not already present - if (getUserVar(userID, "confectionaryDissolveTimer") == undefined) { - setUserVar(userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) + if (getUserVar(serverID, userID, "confectionaryDissolveTimer") == undefined) { + setUserVar(serverID, userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) } // Decrement Intensity every timer interval - if (getUserVar(userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "gummy") && process.recentmessages[userID]) { + if (getUserVar(serverID, userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "gummy") && process.recentmessages[serverID][userID]) { if(getGag(serverID, userID, "gummy").intensity > 1){ - setUserVar(userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) + setUserVar(serverID, userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) // Get Intensity and push decremented version let oldIntensity = getGag(serverID, userID, "gummy").intensity - assignGag(userID, "gummy", oldIntensity - 1) - messageSendChannel(`<@${userID}>'s licking has shrunk ${getPronouns(userID, "possessiveDeterminer")} Gummy Gag a little bit!`, process.recentmessages[userID]) + assignGag(serverID, userID, "gummy", oldIntensity - 1) + messageSendChannel(`<@${userID}>'s licking has shrunk ${getPronouns(serverID, userID, "possessiveDeterminer")} Gummy Gag a little bit!`, process.recentmessages[serverID][userID]) } else { // Clear Gag and Dissolve Timer - setUserVar(userID, "confectionaryDissolveTimer", undefined) - removeGag(userID, "gummy") - messageSendChannel(`<@${userID}>'s Gummy Gag has dissolved away!`, process.recentmessages[userID]) + setUserVar(serverID, userID, "confectionaryDissolveTimer", undefined) + removeGag(serverID, userID, "gummy") + messageSendChannel(`<@${userID}>'s Gummy Gag has dissolved away!`, process.recentmessages[serverID][userID]) } } } diff --git a/eventfunctions/gags/headpatslut.js b/eventfunctions/gags/headpatslut.js index a50969fe..489498ab 100644 --- a/eventfunctions/gags/headpatslut.js +++ b/eventfunctions/gags/headpatslut.js @@ -3,16 +3,16 @@ const { getUserVar } = require("../../functions/getters/config/getUserVar"); const { setUserVar } = require("../../functions/setters/config/setUserVar"); // Successful headpats will recharge the battery on the recipient's vibe by 5%. Each minute drains 2%. -function headpatfunction(recipient, data) { +function headpatfunction(serverID, recipient, data) { if (data.returnedobject.hit) { - setUserVar(recipient, "headpatslutgag", Date.now() + (300000 * getOption(recipient, "headpatrestraintpotency"))); + setUserVar(serverID, recipient, "headpatslutgag", Date.now() + (300000 * getOption(serverID, recipient, "headpatrestraintpotency"))); } } // Update battery -async function tick(userid, data) { - if (getUserVar(userid, "headpatslutgag") && (getUserVar(userid, "headpatslutgag") < Date.now())) { - setUserVar(userid, "headpatslutgag", undefined); +async function tick(serverID, userid, data) { + if (getUserVar(serverID, userid, "headpatslutgag") && (getUserVar(serverID, userid, "headpatslutgag") < Date.now())) { + setUserVar(serverID, userid, "headpatslutgag", undefined); } } diff --git a/eventfunctions/gags/jawbreaker.js b/eventfunctions/gags/jawbreaker.js index c2e6d239..9b8000ee 100644 --- a/eventfunctions/gags/jawbreaker.js +++ b/eventfunctions/gags/jawbreaker.js @@ -10,24 +10,24 @@ const DISSOLVE_RATE_MS = 1200000; async function tick(serverID, userID, data) { // Init Countdown Variable on First Run if not already present - if (getUserVar(userID, "confectionaryDissolveTimer") == undefined) { - setUserVar(userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) + if (getUserVar(serverID, userID, "confectionaryDissolveTimer") == undefined) { + setUserVar(serverID, userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) } // Decrement Intensity every timer interval - if (getUserVar(userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "jawbreaker") && process.recentmessages[userID]) { + if (getUserVar(serverID, userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "jawbreaker") && process.recentmessages[serverID][userID]) { if(getGag(serverID, userID, "jawbreaker").intensity > 1){ - setUserVar(userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) + setUserVar(serverID, userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) // Get Intensity and push decremented version let oldIntensity = getGag(serverID, userID, "jawbreaker").intensity - assignGag(userID, "jawbreaker", oldIntensity - 1) - messageSendChannel(`<@${userID}>'s licking has shrunk ${getPronouns(userID, "possessiveDeterminer")} Jawbreaker Gag a little bit!`, process.recentmessages[userID]) + assignGag(serverID, userID, "jawbreaker", oldIntensity - 1) + messageSendChannel(`<@${userID}>'s licking has shrunk ${getPronouns(serverID, userID, "possessiveDeterminer")} Jawbreaker Gag a little bit!`, process.recentmessages[serverID][userID]) } else { // Clear Gag and Dissolve Timer - setUserVar(userID, "confectionaryDissolveTimer", undefined) - removeGag(userID, "jawbreaker") - messageSendChannel(`<@${userID}>'s Jawbreaker Gag has dissolved away!`, process.recentmessages[userID]) + setUserVar(serverID, userID, "confectionaryDissolveTimer", undefined) + removeGag(serverID, userID, "jawbreaker") + messageSendChannel(`<@${userID}>'s Jawbreaker Gag has dissolved away!`, process.recentmessages[serverID][userID]) } } } diff --git a/eventfunctions/gags/jawbreaker~.js b/eventfunctions/gags/jawbreaker~.js index 367080e9..6fa02d23 100644 --- a/eventfunctions/gags/jawbreaker~.js +++ b/eventfunctions/gags/jawbreaker~.js @@ -9,29 +9,29 @@ const { setUserVar } = require("../../functions/setters/config/setUserVar.js"); const DISSOLVE_RATE_MS = 1200000; -async function tick(userID, data) { +async function tick(serverID, userID, data) { // Init Countdown Variable on First Run if not already present - if (getUserVar(userID, "confectionaryDissolveTimer") == undefined) { - setUserVar(userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) + if (getUserVar(serverID, userID, "confectionaryDissolveTimer") == undefined) { + setUserVar(serverID, userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) } // Decrement Intensity every timer interval - if (getUserVar(userID, "confectionaryDissolveTimer") < Date.now() && getGag(userID, "jawbreaker~") && process.recentmessages[userID]) { - if(getGag(userID, "jawbreaker~").intensity > 1){ - setUserVar(userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) + if (getUserVar(serverID, userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "jawbreaker~") && process.recentmessages[serverID][userID]) { + if(getGag(serverID, userID, "jawbreaker~").intensity > 1){ + setUserVar(serverID, userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) // Get Intensity and push decremented version - let oldIntensity = getGag(userID, "jawbreaker~").intensity - assignGag(userID, "jawbreaker~", oldIntensity - 1) - messageSendChannel(`<@${userID}>'s licking has shrunk ${getPronouns(userID, "possessiveDeterminer")} Jawbreaker Gag a little bit! The sacchrine flavors remind ${getPronouns(userID, "object")} of wonderful things!`, process.recentmessages[userID]) + let oldIntensity = getGag(serverID, userID, "jawbreaker~").intensity + assignGag(serverID, userID, "jawbreaker~", oldIntensity - 1) + messageSendChannel(`<@${userID}>'s licking has shrunk ${getPronouns(serverID, userID, "possessiveDeterminer")} Jawbreaker Gag a little bit! The sacchrine flavors remind ${getPronouns(serverID, userID, "object")} of wonderful things!`, process.recentmessages[serverID][userID]) } else { // Clear Gag and Dissolve Timer - setUserVar(userID, "confectionaryDissolveTimer", undefined) - deleteGag(userID, "jawbreaker~") + setUserVar(serverID, userID, "confectionaryDissolveTimer", undefined) + deleteGag(serverID, userID, "jawbreaker~") // Apply Burst of Arousal - addArousal(userID, 10) + addArousal(serverID, userID, 10) - messageSendChannel(`<@${userID}>'s Jawbreaker Gag dissolves away, but the sweet juices of the candy linger on ${getPronouns(userID, "possessiveDeterminer")} tongue, along with a desire to share them with someone!`, process.recentmessages[userID]) + messageSendChannel(`<@${userID}>'s Jawbreaker Gag dissolves away, but the sweet juices of the candy linger on ${getPronouns(serverID, userID, "possessiveDeterminer")} tongue, along with a desire to share them with someone!`, process.recentmessages[serverID][userID]) } } } diff --git a/eventfunctions/gags/politeSub.js b/eventfunctions/gags/politeSub.js index 52fd0409..347ac915 100644 --- a/eventfunctions/gags/politeSub.js +++ b/eventfunctions/gags/politeSub.js @@ -2,17 +2,17 @@ const { getUserVar } = require("../../functions/getters/config/getUserVar") const { messageSendChannel } = require("../../functions/messagefunctions") const { setUserVar } = require("../../functions/setters/config/setUserVar") -async function tick(userID, data) { +async function tick(serverID, userID, data) { // Remind them on the third infraction and reset - if (getUserVar(userID, "politeSubSilences") > 2) { - messageSendChannel(`<@${userID}> should speak with titles to people, such as "Miss," "Mxtress," "Sir," "-sama" and the like.`, process.recentmessages[userID]) - setUserVar(userID, "politeSubSilenceTime", undefined) - setUserVar(userID, "politeSubSilences", undefined) + if (getUserVar(serverID, userID, "politeSubSilences") > 2) { + messageSendChannel(`<@${userID}> should speak with titles to people, such as "Miss," "Mxtress," "Sir," "-sama" and the like.`, process.recentmessages[serverID][userID]) + setUserVar(serverID, userID, "politeSubSilenceTime", undefined) + setUserVar(serverID, userID, "politeSubSilences", undefined) } - if (getUserVar(userID, "politeSubSilenceTime") < Date.now()) { + if (getUserVar(serverID, userID, "politeSubSilenceTime") < Date.now()) { console.log(`Clearing silence timer for ${userID}`) - setUserVar(userID, "politeSubSilenceTime", undefined) - setUserVar(userID, "politeSubSilences", undefined) + setUserVar(serverID, userID, "politeSubSilenceTime", undefined) + setUserVar(serverID, userID, "politeSubSilences", undefined) } } diff --git a/eventfunctions/headwear/gasmasklinked.js b/eventfunctions/headwear/gasmasklinked.js index 5cf8ea3e..629125c7 100644 --- a/eventfunctions/headwear/gasmasklinked.js +++ b/eventfunctions/headwear/gasmasklinked.js @@ -1,6 +1,7 @@ const { ModalBuilder, UserSelectMenuBuilder, LabelBuilder, SectionBuilder, ButtonStyle, TextDisplayBuilder, ButtonBuilder, ActionRowBuilder } = require("discord.js"); const { messageSendChannel } = require("../../functions/messagefunctions"); const { getPronouns } = require("../../functions/getters/config/getPronouns"); +const { getProcessVariable } = require("../../functions/getters/config/getProcessVariable"); // This is called and replaces the "equipping ___" in the chain exports.extraconfig = async (interaction, userid) => { @@ -33,36 +34,36 @@ exports.extraconfigresponse = async (interaction, userid) => { if (interaction.user.id == wearerid) { // Handling our own breath if (interaction.members.first().id == interaction.user.id) { - interaction.reply(`<@${interaction.user.id}> holds onto ${getPronouns(interaction.user.id, "possessiveDeterminer")} gasmask tube for now...`) + interaction.reply(`<@${interaction.user.id}> holds onto ${getPronouns(interaction.guildId, interaction.user.id, "possessiveDeterminer")} gasmask tube for now...`) } else { - if (process.headwear && process.headwear[sharebreathuser] && (process.headwear[sharebreathuser].sharedbreathhose == wearerid)) { + if (getProcessVariable(interaction.guildId, sharebreathuser, "headwear")?.sharedbreathhose == wearerid) { // The other person already shared a breath with them, acknowledge that. - interaction.reply(`<@${interaction.user.id}> takes the breath hose from <@${sharebreathuser}> and connects it to ${getPronouns(interaction.user.id, "possessiveDeterminer")} gasmask, limiting both of their abilities to get fresh air!`) + interaction.reply(`<@${interaction.user.id}> takes the breath hose from <@${sharebreathuser}> and connects it to ${getPronouns(interaction.guildId, interaction.user.id, "possessiveDeterminer")} gasmask, limiting both of their abilities to get fresh air!`) } else { - interaction.reply(`<@${interaction.user.id}> gives ${getPronouns(interaction.user.id, "possessiveDeterminer")} gasmask tube to <@${sharebreathuser}>!`) + interaction.reply(`<@${interaction.user.id}> gives ${getPronouns(interaction.guildId, interaction.user.id, "possessiveDeterminer")} gasmask tube to <@${sharebreathuser}>!`) } } } else { if (interaction.members.first().id == wearerid) { - interaction.reply(`<@${interaction.user.id}> gives <@${wearerid}>'s gasmask tube to ${getPronouns(wearerid, "object")} for now...`) + interaction.reply(`<@${interaction.user.id}> gives <@${wearerid}>'s gasmask tube to ${getPronouns(interaction.guildId, wearerid, "object")} for now...`) } if (interaction.members.first().id == interaction.user.id) { - if (process.headwear && process.headwear[sharebreathuser] && (process.headwear[sharebreathuser].sharedbreathhose == wearerid)) { - interaction.reply(`<@${interaction.user.id}> grabs <@${wearerid}>'s gasmask tube and connects it up to ${getPronouns(interaction.user.id, "possessiveDeterminer")} gasmask, limiting their abilities to breathe freely!`) + if (getProcessVariable(interaction.guildId, sharebreathuser, "headwear")?.sharedbreathhose == wearerid) { + interaction.reply(`<@${interaction.user.id}> grabs <@${wearerid}>'s gasmask tube and connects it up to ${getPronouns(interaction.guildId, interaction.user.id, "possessiveDeterminer")} gasmask, limiting their abilities to breathe freely!`) } } - if (process.headwear && process.headwear[sharebreathuser] && (process.headwear[sharebreathuser].sharedbreathhose == wearerid)) { + if (getProcessVariable(interaction.guildId, sharebreathuser, "headwear")?.sharedbreathhose == wearerid) { interaction.reply(`<@${interaction.user.id}> takes the breath hose from <@${sharebreathuser}> and connects it to <@${wearerid}>'s gasmask, limiting both of their abilities to get fresh air!`) } else { interaction.reply(`<@${interaction.user.id}> gives <@${wearerid}>'s gasmask tube to <@${sharebreathuser}>!`) } } - if (process.headwear[wearerid]) { - process.headwear[wearerid].sharedbreathhose = sharebreathuser + if (getProcessVariable(interaction.guildId, wearerid, "headwear")) { + getProcessVariable(interaction.guildId, wearerid, "headwear").sharedbreathhose = sharebreathuser } } @@ -101,35 +102,35 @@ exports.modalexecute = async (interaction) => { if (weareruser == sharebreathuser) { // They're the same person lol if (weareruser == interactionuser) { - messageSendChannel(`<@${interaction.user.id}> holds onto ${getPronouns(interaction.user.id, "possessiveDeterminer")} gasmask tube for now...`, interaction.channelId) + messageSendChannel(`<@${interaction.user.id}> holds onto ${getPronouns(interaction.guildId, interaction.user.id, "possessiveDeterminer")} gasmask tube for now...`, interaction.channelId) } else { - messageSendChannel(`<@${interaction.user.id}> gives <@${weareruser}>'s gasmask tube to ${getPronouns(weareruser, "object")} for now...`, interaction.channelId) + messageSendChannel(`<@${interaction.user.id}> gives <@${weareruser}>'s gasmask tube to ${getPronouns(interaction.guildId, weareruser, "object")} for now...`, interaction.channelId) } } else { if (weareruser == interactionuser) { - if (process.headwear && process.headwear[sharebreathuser] && (process.headwear[sharebreathuser].sharedbreathhose == weareruser)) { + if (getProcessVariable(interaction.guildId, sharebreathuser, "headwear")?.sharedbreathhose == weareruser) { // The other person already shared a breath with them, acknowledge that. - messageSendChannel(`<@${interaction.user.id}> takes the breath hose from <@${sharebreathuser}> and connects it to ${getPronouns(interaction.user.id, "possessiveDeterminer")} gasmask, limiting both of their abilities to get fresh air!`, interaction.channelId) + messageSendChannel(`<@${interaction.user.id}> takes the breath hose from <@${sharebreathuser}> and connects it to ${getPronouns(interaction.guildId, interaction.user.id, "possessiveDeterminer")} gasmask, limiting both of their abilities to get fresh air!`, interaction.channelId) } else { - messageSendChannel(`<@${interaction.user.id}> gives ${getPronouns(interaction.user.id, "possessiveDeterminer")} gasmask tube to <@${sharebreathuser}>!`, interaction.channelId) + messageSendChannel(`<@${interaction.user.id}> gives ${getPronouns(interaction.guildId, interaction.user.id, "possessiveDeterminer")} gasmask tube to <@${sharebreathuser}>!`, interaction.channelId) } - if (process.headwear[weareruser]) { - process.headwear[weareruser].sharedbreathhose = sharebreathuser + if (getProcessVariable(interaction.guildId, weareruser, "headwear")) { + getProcessVariable(interaction.guildId, weareruser, "headwear").sharedbreathhose = sharebreathuser } } else { - if (process.headwear && process.headwear[sharebreathuser] && (process.headwear[sharebreathuser].sharedbreathhose == weareruser)) { + if (getProcessVariable(interaction.guildId, sharebreathuser, "headwear")?.sharedbreathhose == weareruser) { // The other person already shared a breath with them, acknowledge that. messageSendChannel(`<@${interaction.user.id}> takes the breath hose from <@${sharebreathuser}> and connects it to <@${weareruser}>'s gasmask, limiting both of their abilities to get fresh air!`, interaction.channelId) } else { messageSendChannel(`<@${interaction.user.id}> gives <@${weareruser}>'s gasmask tube to <@${sharebreathuser}>!`, interaction.channelId) } - if (process.headwear[weareruser]) { - process.headwear[weareruser].sharedbreathhose = sharebreathuser + if (getProcessVariable(interaction.guildId, weareruser, "headwear")) { + getProcessVariable(interaction.guildId, weareruser, "headwear").sharedbreathhose = sharebreathuser } } } diff --git a/eventfunctions/heavy/capture_sphere.js b/eventfunctions/heavy/capture_sphere.js index 5388fcbc..2e4a8446 100644 --- a/eventfunctions/heavy/capture_sphere.js +++ b/eventfunctions/heavy/capture_sphere.js @@ -8,6 +8,7 @@ const { getClonedChastityKeysOwned } = require("../../functions/getters/chastity const { getClonedCollarKeysOwned } = require("../../functions/getters/collar/getClonedCollarKeysOwned") const { getCollar } = require("../../functions/getters/collar/getCollar") const { getCollarKeys } = require("../../functions/getters/collar/getCollarKeys") +const { getProcessVariable } = require("../../functions/getters/config/getProcessVariable") const { getUserVar } = require("../../functions/getters/config/getUserVar") const { getCorset } = require("../../functions/getters/corset/getCorset") const { getGag } = require("../../functions/getters/gag/getGag") @@ -15,6 +16,7 @@ const { getHeadwearRestrictions } = require("../../functions/getters/headwear/ge const { getHeavy } = require("../../functions/getters/heavy/getHeavy") const { getMitten } = require("../../functions/getters/mitten/getMitten") const { messageSendChannel } = require("../../functions/messagefunctions") +const { setProcessVariable } = require("../../functions/setters/config/setProcessVariable") const { setUserVar } = require("../../functions/setters/config/setUserVar") const { removeHeavy } = require("../../functions/setters/heavy/removeHeavy") const { getText } = require("../../functions/textfunctions") @@ -29,8 +31,8 @@ function calculatecapture(serverID, userid, ballbonusnum = 1.0) { let darkgrass = 1 // Not used, but formula has this, so we'll add it // Catch rate will be a base of 150, minus 10 for each held key, down to 3 (the catch rate for Articuno!) - let heldkeysnum = [...getClonedChastityBraKeysOwned(userid), ...getClonedChastityKeysOwned(userid), ...getClonedCollarKeysOwned(userid), - ...getChastityKeys(userid), ...getChastityBraKeys(userid), ...getCollarKeys(userid)] + let heldkeysnum = [...getClonedChastityBraKeysOwned(serverID, userid), ...getClonedChastityKeysOwned(serverID, userid), ...getClonedCollarKeysOwned(serverID, userid), + ...getChastityKeys(serverID, userid), ...getChastityBraKeys(serverID, userid), ...getCollarKeys(serverID, userid)] console.log(`${userid} Catchrate: ${Math.max(150 - (heldkeysnum.length * 10), 3)}`) let catchrate = Math.max(150 - (heldkeysnum.length * 10), 3) let ballbonus = ballbonusnum; @@ -38,10 +40,10 @@ function calculatecapture(serverID, userid, ballbonusnum = 1.0) { // Bonus if the target is bound! let statusbonus = 1; - if (getMitten(userid) || !getHeadwearRestrictions(userid).canInspect || getCorset(userid)) { + if (getMitten(serverID, userid) || !getHeadwearRestrictions(serverID, userid).canInspect || getCorset(serverID, userid)) { statusbonus = 2.5; } - else if (getGag(serverID, userid) || getChastity(userid) || getChastityBra(userid) || getCollar(userid)) { + else if (getGag(serverID, userid) || getChastity(serverID, userid) || getChastityBra(serverID, userid) || getCollar(serverID, userid)) { statusbonus = 1.5; } console.log(`Status Multiplier: ${statusbonus}`) @@ -86,33 +88,34 @@ function calculatecapture(serverID, userid, ballbonusnum = 1.0) { return catches; } -let tick = async (userID, datain) => { - if (process.userevents == undefined) { process.userevents = {} } - if (process.userevents[userID] == undefined) { process.userevents[userID] = {} } - if (process.userevents[userID].capturesphere == undefined) { - process.userevents[userID].capturesphere = { - capture: calculatecapture(userID, 1.0), +let tick = async (serverID, userID, datain) => { + if (getProcessVariable(serverID, userID, "userevents") == undefined) { + setProcessVariable(serverID, userID, "userevents", {}); + } + if (getProcessVariable(serverID, userID, "userevents").capturesphere == undefined) { + getProcessVariable(serverID, userID, "userevents").capturesphere = { + capture: calculatecapture(serverID, userID, 1.0), ballname: "Capture Sphere", captureprogress: -1, nextupdate: Date.now() + 2000 } } // If the last update was over 2 minutes ago, this was probably an orphaned ball. - if ((process.userevents[userID].capturesphere.nextupdate + 120000 ?? 0) < Date.now()) { - delete process.userevents[userID].capturesphere + if ((getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate + 120000 ?? 0) < Date.now()) { + delete getProcessVariable(serverID, userID, "userevents").capturesphere return; } // Only update every 5 seconds - if ((process.userevents[userID].capturesphere.nextupdate ?? 0) < Date.now()) { - process.userevents[userID].capturesphere.nextupdate = Date.now() + 2000; + if ((getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate ?? 0) < Date.now()) { + getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate = Date.now() + 2000; } else { return }; // get the user object, if it doesn't exist, go away let userobject = await process.client.users.fetch(userID); // The person that's been captured! - let targetobject = await process.client.users.fetch(getHeavy(userID).origbinder ?? userID); // The cruel person who threw the pokeball! + let targetobject = await process.client.users.fetch(getHeavy(serverID, userID).origbinder ?? userID); // The cruel person who threw the pokeball! // Something's wrong. - if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[userID]) || getUserVar(userID, "captureSphereCaptured")) { + if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[serverID][userID]) || getUserVar(serverID, userID, "captureSphereCaptured")) { return; } // Build data tree: @@ -121,50 +124,50 @@ let tick = async (userID, datain) => { textdata: { interactionuser: userobject, targetuser: targetobject, - c1: process.userevents[userID].capturesphere.ballname + c1: getProcessVariable(serverID, userID, "userevents").capturesphere.ballname } } data.heavy = true; data.capturesphere = true; // -1 to force an initial delay after equipping the sphere. - if (process.userevents[userID].capturesphere.captureprogress == -1) { - process.userevents[userID].capturesphere.captureprogress++; + if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == -1) { + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++; return; } - else if (process.userevents[userID].capturesphere.captureprogress < 2) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress]) { + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress < 2) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress]) { // Successful wiggle! - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]); + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]); } else { - data[`wigglefail${process.userevents[userID].capturesphere.captureprogress}`] = true - messageSendChannel(getText(data), process.recentmessages[userID]) - removeHeavy(userID, "capture_sphere"); + data[`wigglefail${getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress}`] = true + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) + removeHeavy(serverID, userID, "capture_sphere"); return; } } - process.userevents[userID].capturesphere.captureprogress++; + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++; return; } // Last wiggle! Note, if the third check fails, we still wiggle for it and then break free on captureprogress 3. // Yes this could have been an if/else clause above, but this was broken down here for readability. - else if (process.userevents[userID].capturesphere.captureprogress == 2) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress]) { - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]); + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 2) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress]) { + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]); } else { - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]) + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]) } } - process.userevents[userID].capturesphere.captureprogress++ + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++ return; } - else if (process.userevents[userID].capturesphere.captureprogress == 3) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress - 1]) { + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 3) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress - 1]) { // This was a successful capture! if (userobject.id == targetobject.id) { data.capturesuccess_self = true @@ -172,29 +175,29 @@ let tick = async (userID, datain) => { else { data.capturesuccess_other = true } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { // This broke free on the third wiggle. data.wigglefail2 = true; - messageSendChannel(getText(data), process.recentmessages[userID]); - removeHeavy(userID, "capture_sphere"); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); + removeHeavy(serverID, userID, "capture_sphere"); return; } } - process.userevents[userID].capturesphere.captureprogress++ + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++ return; } - else if (process.userevents[userID].capturesphere.captureprogress == 4) { - setUserVar(userID, "captureSphereCaptured", true) + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 4) { + setUserVar(serverID, userID, "captureSphereCaptured", true) } } // Called when the item is removed. Only implemented for heavy bondage presently. // This should be used to clear any lingering data from above. -let functiononremove = async (userID) => { - setUserVar(userID, "captureSphereCaptured", undefined) - delete process.userevents[userID].capturesphere; +let functiononremove = async (serverID, userID) => { + setUserVar(serverID, userID, "captureSphereCaptured", undefined) + delete getProcessVariable(serverID, userID, "userevents").capturesphere; } exports.calculatecapture = calculatecapture; diff --git a/eventfunctions/heavy/capture_sphere_great.js b/eventfunctions/heavy/capture_sphere_great.js index 8a654b84..a6dcf9fb 100644 --- a/eventfunctions/heavy/capture_sphere_great.js +++ b/eventfunctions/heavy/capture_sphere_great.js @@ -6,33 +6,34 @@ const { removeHeavy } = require("../../functions/setters/heavy/removeHeavy") const { getText } = require("../../functions/textfunctions") const { calculatecapture } = require("./capture_sphere.js") // reuse the calculation! -let tick = async (userID, datain) => { - if (process.userevents == undefined) { process.userevents = {} } - if (process.userevents[userID] == undefined) { process.userevents[userID] = {} } - if (process.userevents[userID].capturesphere == undefined) { - process.userevents[userID].capturesphere = { - capture: calculatecapture(userID, 1.5), +let tick = async (serverID, userID, datain) => { + if (getProcessVariable(serverID, userID, "userevents") == undefined) { + setProcessVariable(serverID, userID, "userevents", {}); + } + if (getProcessVariable(serverID, userID, "userevents").capturesphere == undefined) { + getProcessVariable(serverID, userID, "userevents").capturesphere = { + capture: calculatecapture(serverID, userID, 1.5), ballname: "Great Sphere", captureprogress: -1, nextupdate: Date.now() + 2000 } } // If the last update was over 2 minutes ago, this was probably an orphaned ball. - if ((process.userevents[userID].capturesphere.nextupdate + 120000 ?? 0) < Date.now()) { - delete process.userevents[userID].capturesphere + if ((getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate + 120000 ?? 0) < Date.now()) { + delete getProcessVariable(serverID, userID, "userevents").capturesphere return; } // Only update every 5 seconds - if ((process.userevents[userID].capturesphere.nextupdate ?? 0) < Date.now()) { - process.userevents[userID].capturesphere.nextupdate = Date.now() + 2000; + if ((getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate ?? 0) < Date.now()) { + getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate = Date.now() + 2000; } else { return }; // get the user object, if it doesn't exist, go away let userobject = await process.client.users.fetch(userID); // The person that's been captured! - let targetobject = await process.client.users.fetch(getHeavy(userID).origbinder ?? userID); // The cruel person who threw the pokeball! + let targetobject = await process.client.users.fetch(getHeavy(serverID, userID).origbinder ?? userID); // The cruel person who threw the pokeball! // Something's wrong. - if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[userID]) || getUserVar(userID, "captureSphereCaptured")) { + if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[serverID][userID]) || getUserVar(serverID, userID, "captureSphereCaptured")) { return; } // Build data tree: @@ -41,50 +42,50 @@ let tick = async (userID, datain) => { textdata: { interactionuser: userobject, targetuser: targetobject, - c1: process.userevents[userID].capturesphere.ballname + c1: getProcessVariable(serverID, userID, "userevents").capturesphere.ballname } } data.heavy = true; data.capturesphere = true; // -1 to force an initial delay after equipping the sphere. - if (process.userevents[userID].capturesphere.captureprogress == -1) { - process.userevents[userID].capturesphere.captureprogress++; + if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == -1) { + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++; return; } - else if (process.userevents[userID].capturesphere.captureprogress < 2) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress]) { + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress < 2) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress]) { // Successful wiggle! - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]); + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]); } else { - data[`wigglefail${process.userevents[userID].capturesphere.captureprogress}`] = true - messageSendChannel(getText(data), process.recentmessages[userID]) - removeHeavy(userID, "capture_sphere_great"); + data[`wigglefail${getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress}`] = true + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) + removeHeavy(serverID, userID, "capture_sphere"); return; } } - process.userevents[userID].capturesphere.captureprogress++; + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++; return; } // Last wiggle! Note, if the third check fails, we still wiggle for it and then break free on captureprogress 3. // Yes this could have been an if/else clause above, but this was broken down here for readability. - else if (process.userevents[userID].capturesphere.captureprogress == 2) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress]) { - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]); + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 2) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress]) { + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]); } else { - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]) + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]) } } - process.userevents[userID].capturesphere.captureprogress++ + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++ return; } - else if (process.userevents[userID].capturesphere.captureprogress == 3) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress - 1]) { + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 3) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress - 1]) { // This was a successful capture! if (userobject.id == targetobject.id) { data.capturesuccess_self = true @@ -92,29 +93,29 @@ let tick = async (userID, datain) => { else { data.capturesuccess_other = true } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { // This broke free on the third wiggle. data.wigglefail2 = true; - messageSendChannel(getText(data), process.recentmessages[userID]); - removeHeavy(userID, "capture_sphere_great"); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); + removeHeavy(serverID, userID, "capture_sphere"); return; } } - process.userevents[userID].capturesphere.captureprogress++ + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++ return; } - else if (process.userevents[userID].capturesphere.captureprogress == 4) { - setUserVar(userID, "captureSphereCaptured", true) + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 4) { + setUserVar(serverID, userID, "captureSphereCaptured", true) } } // Called when the item is removed. Only implemented for heavy bondage presently. // This should be used to clear any lingering data from above. -let functiononremove = async (userID) => { - setUserVar(userID, "captureSphereCaptured", undefined) - delete process.userevents[userID].capturesphere; +let functiononremove = async (serverID, userID) => { + setUserVar(serverID, userID, "captureSphereCaptured", undefined) + delete getProcessVariable(serverID, userID, "userevents").capturesphere; } exports.tick = tick; diff --git a/eventfunctions/heavy/capture_sphere_love.js b/eventfunctions/heavy/capture_sphere_love.js index 36d433b1..478b3731 100644 --- a/eventfunctions/heavy/capture_sphere_love.js +++ b/eventfunctions/heavy/capture_sphere_love.js @@ -4,6 +4,7 @@ const { getClonedChastityBraKey } = require("../../functions/getters/chastity/ge const { getClonedChastityKey } = require("../../functions/getters/chastity/getClonedChastityKey") const { getClonedCollarKey } = require("../../functions/getters/collar/getClonedCollarKey") const { getCollar } = require("../../functions/getters/collar/getCollar") +const { getProcessVariable } = require("../../functions/getters/config/getProcessVariable.js") const { getUserVar } = require("../../functions/getters/config/getUserVar") const { getHeavy } = require("../../functions/getters/heavy/getHeavy") const { messageSendChannel } = require("../../functions/messagefunctions") @@ -12,10 +13,11 @@ const { removeHeavy } = require("../../functions/setters/heavy/removeHeavy") const { getText } = require("../../functions/textfunctions") const { calculatecapture } = require("./capture_sphere.js") // reuse the calculation! -let tick = async (userID, datain) => { - if (process.userevents == undefined) { process.userevents = {} } - if (process.userevents[userID] == undefined) { process.userevents[userID] = {} } - if (process.userevents[userID].capturesphere == undefined) { +let tick = async (serverID, userID, datain) => { + if (getProcessVariable(serverID, userID, "userevents") == undefined) { + setProcessVariable(serverID, userID, "userevents", {}); + } + if (getProcessVariable(serverID, userID, "userevents").capturesphere == undefined) { let capturerate = 1.0; let origbinder = getHeavy(userID)?.origbinder ?? 0; // If the person who bound this person has a key to the target, do the original @@ -29,29 +31,29 @@ let tick = async (userID, datain) => { if (getClonedChastityBraKey(userID).includes(origbinder)) { capturerate = 8.0 } if (getClonedCollarKey(userID).includes(origbinder)) { capturerate = 8.0 } } - process.userevents[userID].capturesphere = { - capture: calculatecapture(userID, capturerate), + getProcessVariable(serverID, userID, "userevents").capturesphere = { + capture: calculatecapture(serverID, userID, capturerate), ballname: "Love Sphere", captureprogress: -1, nextupdate: Date.now() + 2000 } } // If the last update was over 2 minutes ago, this was probably an orphaned ball. - if ((process.userevents[userID].capturesphere.nextupdate + 120000 ?? 0) < Date.now()) { - delete process.userevents[userID].capturesphere + if ((getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate + 120000 ?? 0) < Date.now()) { + delete getProcessVariable(serverID, userID, "userevents").capturesphere return; } // Only update every 5 seconds - if ((process.userevents[userID].capturesphere.nextupdate ?? 0) < Date.now()) { - process.userevents[userID].capturesphere.nextupdate = Date.now() + 2000; + if ((getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate ?? 0) < Date.now()) { + getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate = Date.now() + 2000; } else { return }; // get the user object, if it doesn't exist, go away let userobject = await process.client.users.fetch(userID); // The person that's been captured! - let targetobject = await process.client.users.fetch(getHeavy(userID).origbinder ?? userID); // The cruel person who threw the pokeball! + let targetobject = await process.client.users.fetch(getHeavy(serverID, userID).origbinder ?? userID); // The cruel person who threw the pokeball! // Something's wrong. - if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[userID]) || getUserVar(userID, "captureSphereCaptured")) { + if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[serverID][userID]) || getUserVar(serverID, userID, "captureSphereCaptured")) { return; } // Build data tree: @@ -60,50 +62,50 @@ let tick = async (userID, datain) => { textdata: { interactionuser: userobject, targetuser: targetobject, - c1: process.userevents[userID].capturesphere.ballname + c1: getProcessVariable(serverID, userID, "userevents").capturesphere.ballname } } data.heavy = true; data.capturesphere = true; // -1 to force an initial delay after equipping the sphere. - if (process.userevents[userID].capturesphere.captureprogress == -1) { - process.userevents[userID].capturesphere.captureprogress++; + if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == -1) { + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++; return; } - else if (process.userevents[userID].capturesphere.captureprogress < 2) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress]) { + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress < 2) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress]) { // Successful wiggle! - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]); + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]); } else { - data[`wigglefail${process.userevents[userID].capturesphere.captureprogress}`] = true - messageSendChannel(getText(data), process.recentmessages[userID]) - removeHeavy(userID, "capture_sphere_love"); + data[`wigglefail${getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress}`] = true + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) + removeHeavy(serverID, userID, "capture_sphere"); return; } } - process.userevents[userID].capturesphere.captureprogress++; + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++; return; } // Last wiggle! Note, if the third check fails, we still wiggle for it and then break free on captureprogress 3. // Yes this could have been an if/else clause above, but this was broken down here for readability. - else if (process.userevents[userID].capturesphere.captureprogress == 2) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress]) { - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]); + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 2) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress]) { + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]); } else { - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]) + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]) } } - process.userevents[userID].capturesphere.captureprogress++ + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++ return; } - else if (process.userevents[userID].capturesphere.captureprogress == 3) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress - 1]) { + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 3) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress - 1]) { // This was a successful capture! if (userobject.id == targetobject.id) { data.capturesuccess_self = true @@ -111,29 +113,29 @@ let tick = async (userID, datain) => { else { data.capturesuccess_other = true } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { // This broke free on the third wiggle. data.wigglefail2 = true; - messageSendChannel(getText(data), process.recentmessages[userID]); - removeHeavy(userID, "capture_sphere_love"); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); + removeHeavy(serverID, userID, "capture_sphere"); return; } } - process.userevents[userID].capturesphere.captureprogress++ + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++ return; } - else if (process.userevents[userID].capturesphere.captureprogress == 4) { - setUserVar(userID, "captureSphereCaptured", true) + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 4) { + setUserVar(serverID, userID, "captureSphereCaptured", true) } } // Called when the item is removed. Only implemented for heavy bondage presently. // This should be used to clear any lingering data from above. -let functiononremove = async (userID) => { - setUserVar(userID, "captureSphereCaptured", undefined) - delete process.userevents[userID].capturesphere; +let functiononremove = async (serverID, userID) => { + setUserVar(serverID, userID, "captureSphereCaptured", undefined) + delete getProcessVariable(serverID, userID, "userevents").capturesphere; } exports.tick = tick; diff --git a/eventfunctions/heavy/capture_sphere_master.js b/eventfunctions/heavy/capture_sphere_master.js index 5ce33d7c..27c6161e 100644 --- a/eventfunctions/heavy/capture_sphere_master.js +++ b/eventfunctions/heavy/capture_sphere_master.js @@ -6,33 +6,34 @@ const { removeHeavy } = require("../../functions/setters/heavy/removeHeavy") const { getText } = require("../../functions/textfunctions") const { calculatecapture } = require("./capture_sphere.js") // reuse the calculation! -let tick = async (userID, datain) => { - if (process.userevents == undefined) { process.userevents = {} } - if (process.userevents[userID] == undefined) { process.userevents[userID] = {} } - if (process.userevents[userID].capturesphere == undefined) { - process.userevents[userID].capturesphere = { - capture: calculatecapture(userID, 10000.0), // Guaranteed to catch without fail! +let tick = async (serverID, userID, datain) => { + if (getProcessVariable(serverID, userID, "userevents") == undefined) { + setProcessVariable(serverID, userID, "userevents", {}); + } + if (getProcessVariable(serverID, userID, "userevents").capturesphere == undefined) { + getProcessVariable(serverID, userID, "userevents").capturesphere = { + capture: calculatecapture(serverID, userID, 10000.0), ballname: "Master Sphere", captureprogress: -1, nextupdate: Date.now() + 2000 } } // If the last update was over 2 minutes ago, this was probably an orphaned ball. - if ((process.userevents[userID].capturesphere.nextupdate + 120000 ?? 0) < Date.now()) { - delete process.userevents[userID].capturesphere + if ((getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate + 120000 ?? 0) < Date.now()) { + delete getProcessVariable(serverID, userID, "userevents").capturesphere return; } // Only update every 5 seconds - if ((process.userevents[userID].capturesphere.nextupdate ?? 0) < Date.now()) { - process.userevents[userID].capturesphere.nextupdate = Date.now() + 2000; + if ((getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate ?? 0) < Date.now()) { + getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate = Date.now() + 2000; } else { return }; // get the user object, if it doesn't exist, go away let userobject = await process.client.users.fetch(userID); // The person that's been captured! - let targetobject = await process.client.users.fetch(getHeavy(userID).origbinder ?? userID); // The cruel person who threw the pokeball! + let targetobject = await process.client.users.fetch(getHeavy(serverID, userID).origbinder ?? userID); // The cruel person who threw the pokeball! // Something's wrong. - if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[userID]) || getUserVar(userID, "captureSphereCaptured")) { + if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[serverID][userID]) || getUserVar(serverID, userID, "captureSphereCaptured")) { return; } // Build data tree: @@ -41,50 +42,50 @@ let tick = async (userID, datain) => { textdata: { interactionuser: userobject, targetuser: targetobject, - c1: process.userevents[userID].capturesphere.ballname + c1: getProcessVariable(serverID, userID, "userevents").capturesphere.ballname } } data.heavy = true; data.capturesphere = true; // -1 to force an initial delay after equipping the sphere. - if (process.userevents[userID].capturesphere.captureprogress == -1) { - process.userevents[userID].capturesphere.captureprogress++; + if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == -1) { + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++; return; } - else if (process.userevents[userID].capturesphere.captureprogress < 2) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress]) { + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress < 2) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress]) { // Successful wiggle! - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]); + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]); } else { - data[`wigglefail${process.userevents[userID].capturesphere.captureprogress}`] = true - messageSendChannel(getText(data), process.recentmessages[userID]) - removeHeavy(userID, "capture_sphere_master"); + data[`wigglefail${getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress}`] = true + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) + removeHeavy(serverID, userID, "capture_sphere"); return; } } - process.userevents[userID].capturesphere.captureprogress++; + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++; return; } // Last wiggle! Note, if the third check fails, we still wiggle for it and then break free on captureprogress 3. // Yes this could have been an if/else clause above, but this was broken down here for readability. - else if (process.userevents[userID].capturesphere.captureprogress == 2) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress]) { - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]); + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 2) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress]) { + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]); } else { - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]) + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]) } } - process.userevents[userID].capturesphere.captureprogress++ + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++ return; } - else if (process.userevents[userID].capturesphere.captureprogress == 3) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress - 1]) { + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 3) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress - 1]) { // This was a successful capture! if (userobject.id == targetobject.id) { data.capturesuccess_self = true @@ -92,29 +93,29 @@ let tick = async (userID, datain) => { else { data.capturesuccess_other = true } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { // This broke free on the third wiggle. data.wigglefail2 = true; - messageSendChannel(getText(data), process.recentmessages[userID]); - removeHeavy(userID, "capture_sphere_master"); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); + removeHeavy(serverID, userID, "capture_sphere"); return; } } - process.userevents[userID].capturesphere.captureprogress++ + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++ return; } - else if (process.userevents[userID].capturesphere.captureprogress == 4) { - setUserVar(userID, "captureSphereCaptured", true) + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 4) { + setUserVar(serverID, userID, "captureSphereCaptured", true) } } // Called when the item is removed. Only implemented for heavy bondage presently. // This should be used to clear any lingering data from above. -let functiononremove = async (userID) => { - setUserVar(userID, "captureSphereCaptured", undefined) - delete process.userevents[userID].capturesphere; +let functiononremove = async (serverID, userID) => { + setUserVar(serverID, userID, "captureSphereCaptured", undefined) + delete getProcessVariable(serverID, userID, "userevents").capturesphere; } exports.tick = tick; diff --git a/eventfunctions/heavy/capture_sphere_ultra.js b/eventfunctions/heavy/capture_sphere_ultra.js index fad4ca51..6a1f8eb4 100644 --- a/eventfunctions/heavy/capture_sphere_ultra.js +++ b/eventfunctions/heavy/capture_sphere_ultra.js @@ -6,33 +6,34 @@ const { removeHeavy } = require("../../functions/setters/heavy/removeHeavy") const { getText } = require("../../functions/textfunctions") const { calculatecapture } = require("./capture_sphere.js") // reuse the calculation! -let tick = async (userID, datain) => { - if (process.userevents == undefined) { process.userevents = {} } - if (process.userevents[userID] == undefined) { process.userevents[userID] = {} } - if (process.userevents[userID].capturesphere == undefined) { - process.userevents[userID].capturesphere = { - capture: calculatecapture(userID, 2.0), +let tick = async (serverID, userID, datain) => { + if (getProcessVariable(serverID, userID, "userevents") == undefined) { + setProcessVariable(serverID, userID, "userevents", {}); + } + if (getProcessVariable(serverID, userID, "userevents").capturesphere == undefined) { + getProcessVariable(serverID, userID, "userevents").capturesphere = { + capture: calculatecapture(serverID, userID, 2.0), ballname: "Ultra Sphere", captureprogress: -1, nextupdate: Date.now() + 2000 } } // If the last update was over 2 minutes ago, this was probably an orphaned ball. - if ((process.userevents[userID].capturesphere.nextupdate + 120000 ?? 0) < Date.now()) { - delete process.userevents[userID].capturesphere + if ((getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate + 120000 ?? 0) < Date.now()) { + delete getProcessVariable(serverID, userID, "userevents").capturesphere return; } // Only update every 5 seconds - if ((process.userevents[userID].capturesphere.nextupdate ?? 0) < Date.now()) { - process.userevents[userID].capturesphere.nextupdate = Date.now() + 2000; + if ((getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate ?? 0) < Date.now()) { + getProcessVariable(serverID, userID, "userevents").capturesphere.nextupdate = Date.now() + 2000; } else { return }; // get the user object, if it doesn't exist, go away let userobject = await process.client.users.fetch(userID); // The person that's been captured! - let targetobject = await process.client.users.fetch(getHeavy(userID).origbinder ?? userID); // The cruel person who threw the pokeball! + let targetobject = await process.client.users.fetch(getHeavy(serverID, userID).origbinder ?? userID); // The cruel person who threw the pokeball! // Something's wrong. - if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[userID]) || getUserVar(userID, "captureSphereCaptured")) { + if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[serverID][userID]) || getUserVar(serverID, userID, "captureSphereCaptured")) { return; } // Build data tree: @@ -41,50 +42,50 @@ let tick = async (userID, datain) => { textdata: { interactionuser: userobject, targetuser: targetobject, - c1: process.userevents[userID].capturesphere.ballname + c1: getProcessVariable(serverID, userID, "userevents").capturesphere.ballname } } data.heavy = true; data.capturesphere = true; // -1 to force an initial delay after equipping the sphere. - if (process.userevents[userID].capturesphere.captureprogress == -1) { - process.userevents[userID].capturesphere.captureprogress++; + if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == -1) { + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++; return; } - else if (process.userevents[userID].capturesphere.captureprogress < 2) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress]) { + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress < 2) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress]) { // Successful wiggle! - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]); + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]); } else { - data[`wigglefail${process.userevents[userID].capturesphere.captureprogress}`] = true - messageSendChannel(getText(data), process.recentmessages[userID]) - removeHeavy(userID, "capture_sphere_ultra"); + data[`wigglefail${getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress}`] = true + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) + removeHeavy(serverID, userID, "capture_sphere"); return; } } - process.userevents[userID].capturesphere.captureprogress++; + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++; return; } // Last wiggle! Note, if the third check fails, we still wiggle for it and then break free on captureprogress 3. // Yes this could have been an if/else clause above, but this was broken down here for readability. - else if (process.userevents[userID].capturesphere.captureprogress == 2) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress]) { - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]); + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 2) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress]) { + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]); } else { - messageSendChannel(`*wiggle...*`, process.recentmessages[userID]) + messageSendChannel(`*wiggle...*`, process.recentmessages[serverID][userID]) } } - process.userevents[userID].capturesphere.captureprogress++ + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++ return; } - else if (process.userevents[userID].capturesphere.captureprogress == 3) { - if (process.userevents[userID].capturesphere.capture) { - if (process.userevents[userID].capturesphere.capture[process.userevents[userID].capturesphere.captureprogress - 1]) { + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 3) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture) { + if (getProcessVariable(serverID, userID, "userevents").capturesphere.capture[getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress - 1]) { // This was a successful capture! if (userobject.id == targetobject.id) { data.capturesuccess_self = true @@ -92,29 +93,29 @@ let tick = async (userID, datain) => { else { data.capturesuccess_other = true } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { // This broke free on the third wiggle. data.wigglefail2 = true; - messageSendChannel(getText(data), process.recentmessages[userID]); - removeHeavy(userID, "capture_sphere_ultra"); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); + removeHeavy(serverID, userID, "capture_sphere"); return; } } - process.userevents[userID].capturesphere.captureprogress++ + getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress++ return; } - else if (process.userevents[userID].capturesphere.captureprogress == 4) { - setUserVar(userID, "captureSphereCaptured", true) + else if (getProcessVariable(serverID, userID, "userevents").capturesphere.captureprogress == 4) { + setUserVar(serverID, userID, "captureSphereCaptured", true) } } // Called when the item is removed. Only implemented for heavy bondage presently. // This should be used to clear any lingering data from above. -let functiononremove = async (userID) => { - setUserVar(userID, "captureSphereCaptured", undefined) - delete process.userevents[userID].capturesphere; +let functiononremove = async (serverID, userID) => { + setUserVar(serverID, userID, "captureSphereCaptured", undefined) + delete getProcessVariable(serverID, userID, "userevents").capturesphere; } exports.tick = tick; diff --git a/eventfunctions/heavy/costumer_mimic.js b/eventfunctions/heavy/costumer_mimic.js index d5b10590..9f58de55 100644 --- a/eventfunctions/heavy/costumer_mimic.js +++ b/eventfunctions/heavy/costumer_mimic.js @@ -4,6 +4,7 @@ const { getChastityBraName } = require("../../functions/getters/chastity/getChas const { getChastityName } = require("../../functions/getters/chastity/getChastityName.js"); const { getCollar } = require("../../functions/getters/collar/getCollar.js"); const { getCollarName } = require("../../functions/getters/collar/getCollarName.js"); +const { getProcessVariable } = require("../../functions/getters/config/getProcessVariable.js"); const { getGag } = require("../../functions/getters/gag/getGag.js"); const { convertGagText } = require("../../functions/getters/gag/getGagName.js"); const { getHeadwear } = require("../../functions/getters/headwear/getHeadwear.js"); @@ -19,6 +20,7 @@ const { addArousal } = require("../../functions/setters/arousal/addArousal.js"); const { assignChastity } = require("../../functions/setters/chastity/assignChastity.js"); const { assignChastityBra } = require("../../functions/setters/chastity/assignChastityBra.js"); const { assignCollar } = require("../../functions/setters/collar/assignCollar.js"); +const { setProcessVariable } = require("../../functions/setters/config/setProcessVariable.js"); const { assignGag } = require("../../functions/setters/gag/assignGag.js"); const { assignHeadwear } = require("../../functions/setters/headwear/assignHeadwear.js"); const { assignHeavy } = require("../../functions/setters/heavy/assignHeavy.js"); @@ -379,31 +381,31 @@ function shuffleWearables(inputArray) { let tick = async (serverID, userID, datain) => { if (process.userevents == undefined) { process.userevents = {} } - if (process.userevents[userID] == undefined) { process.userevents[userID] = {} } - if (process.userevents[userID].costumermimic == undefined) { process.userevents[userID].costumermimic = { stage: 0 } } - if (process.userevents[userID].costumermimic.costumeidx == undefined) { process.userevents[userID].costumermimic.costumeidx = 0 } - if (process.userevents[userID].costumermimic.origbinder == undefined) { process.userevents[userID].costumermimic.origbinder = getHeavy(userID).origbinder } + if (getProcessVariable(serverID, userID, "userevents") == undefined) { setProcessVariable(serverID, userID, "userevents", {}) } + if (getProcessVariable(serverID, userID, "userevents").costumermimic == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic = { stage: 0 } } + if (getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx = 0 } + if (getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder = getHeavy(userID).origbinder } // Randomly select an outfit from mimicCostumes.js - if (process.userevents[userID].costumermimic.outfit == undefined) { process.userevents[userID].costumermimic.outfit = Object.keys(mimicCostumes)[Math.floor(Math.random() * Object.keys(mimicCostumes).length)]; } + if (getProcessVariable(serverID, userID, "userevents").costumermimic.outfit == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.outfit = Object.keys(mimicCostumes)[Math.floor(Math.random() * Object.keys(mimicCostumes).length)]; } let currclothes = getWearable(userID).filter((f) => (!getLockedWearable(userID).includes(f))); // Current clothes that can be removed let shuffledclothes = shuffleWearables(currclothes); // I admittedly dont think a big shuffler's necessary but its fine // Capture length of initial Removable Wearables array - if (process.userevents[userID].costumermimic.removableclothes == undefined) { process.userevents[userID].costumermimic.removableclothes = shuffledclothes.length } - let consumeperpass = Math.round(process.userevents[userID].costumermimic.removableclothes / 4); + if (getProcessVariable(serverID, userID, "userevents").costumermimic.removableclothes == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.removableclothes = shuffledclothes.length } + let consumeperpass = Math.round(getProcessVariable(serverID, userID, "userevents").costumermimic.removableclothes / 4); // get the user object, if it doesn't exist, go away let userobject = await process.client.users.fetch(userID); // The person in the processing terminal! let targetobject = await process.client.users.fetch(getHeavy(userID).origbinder ?? userID); // The cruel person who threw this person in the terminal! // Something's wrong. - if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[userID])) { + if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[serverID][userID])) { return; } // Only update a max of once every 20 seconds. - if ((process.userevents[userID].costumermimic.nextupdate ?? 0) < Date.now()) { - //process.userevents[userID].costumermimic.nextupdate = Date.now() + 2000; // Test Speed - process.userevents[userID].costumermimic.nextupdate = Date.now() + 20000; + if ((getProcessVariable(serverID, userID, "userevents").costumermimic.nextupdate ?? 0) < Date.now()) { + //getProcessVariable(serverID, userID, "userevents").costumermimic.nextupdate = Date.now() + 2000; // Test Speed + getProcessVariable(serverID, userID, "userevents").costumermimic.nextupdate = Date.now() + 20000; } else { return }; @@ -411,6 +413,7 @@ let tick = async (serverID, userID, datain) => { let data = { textarray: "texts_eventfunctions", textdata: { + serverID: serverID, interactionuser: userobject, targetuser: targetobject, } @@ -419,22 +422,22 @@ let tick = async (serverID, userID, datain) => { // The Mimic is teasing the Victim during the entire event~ (Arousal Gain can be increased or decreased as desired) addArousal(userID, 1); - console.log(process.userevents[userID].costumermimic) + console.log(getProcessVariable(serverID, userID, "userevents").costumermimic) // Select Item from Chosen Outfit based in index - let nextitem = mimicCostumes[process.userevents[userID].costumermimic.outfit][process.userevents[userID].costumermimic.costumeidx]; + let nextitem = mimicCostumes[getProcessVariable(serverID, userID, "userevents").costumermimic.outfit][getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx]; let itemtoequipcolored = null; let nom_idx = 0; let itemsconsumed = ""; - console.log("Consume: ", consumeperpass, ", Total: ", getWearable(userID).filter((f) => (!getLockedWearable(userID).includes(f))).length, ", Stage: ", process.userevents[userID].costumermimic.stage); + console.log("Consume: ", consumeperpass, ", Total: ", getWearable(serverID, userID).filter((f) => (!getLockedWearable(serverID, userID).includes(f))).length, ", Stage: ", getProcessVariable(serverID, userID, "userevents").costumermimic.stage); // Initial Text Formatting data.heavy = true; data.costumer_mimic = true; // Stripping Clothes - if (process.userevents[userID].costumermimic.stage < 3) { + if (getProcessVariable(serverID, userID, "userevents").costumermimic.stage < 3) { if (shuffledclothes.length > consumeperpass && consumeperpass >= 2) { while (nom_idx < consumeperpass && shuffledclothes[nom_idx] != null) { // Fetch Wearable name and concatenate onto string @@ -444,7 +447,7 @@ let tick = async (serverID, userID, datain) => { itemsconsumed += "and " + getWearableName(undefined, shuffledclothes[nom_idx]); } // remove it - deleteWearable(userID, shuffledclothes[nom_idx]); + deleteWearable(serverID, userID, shuffledclothes[nom_idx]); nom_idx++; } data.textdata.c1 = itemsconsumed; @@ -452,39 +455,39 @@ let tick = async (serverID, userID, datain) => { data.removeclothing = true; // Send a message saying it stripped things off the wearer <3 - messageSendChannel(getText(data), process.recentmessages[userID]) - process.userevents[userID].costumermimic.stage++ + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) + getProcessVariable(serverID, userID, "userevents").costumermimic.stage++ return; } else if (shuffledclothes.length <= consumeperpass && shuffledclothes.length > 0) { console.log("Not enough Clothes remaining for a full cycle! Skipping to stage 3!") // Skip to Stage 4 and consume all remaining items - process.userevents[userID].costumermimic.stage = 3 + getProcessVariable(serverID, userID, "userevents").costumermimic.stage = 3 } else if (shuffledclothes.length == 0) { // Victim Stripped of all unprotected clothing unexpectedly, progress to next stage console.log("Unexpectedly Naked! Skipping to Dress Up!") - process.userevents[userID].costumermimic.stage = 4; + getProcessVariable(serverID, userID, "userevents").costumermimic.stage = 4; data.textdata.c1 = "Naked"; data.donestripping = true; data.noneremaining = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) return; } else { console.log("Initial Clothes count less than 4! Skipping to stage 3!") // Skip to Stage 4 and consume all remaining items - process.userevents[userID].costumermimic.stage = 3 + getProcessVariable(serverID, userID, "userevents").costumermimic.stage = 3 } } - if (process.userevents[userID].costumermimic.stage == 3) { + if (getProcessVariable(serverID, userID, "userevents").costumermimic.stage == 3) { console.log("Entering Final Consumption!") // Handle all remaining Wearables data.donestripping = true; - let remainingwearables = getWearable(userID).filter((f) => (!getLockedWearable(userID).includes(f))) + let remainingwearables = getWearable(serverID, userID).filter((f) => (!getLockedWearable(serverID, userID).includes(f))) let concat = [] remainingwearables.forEach((w) => { concat.push(getWearableName(undefined, w)); - deleteWearable(userID, w); + deleteWearable(serverID, userID, w); }) if (concat.length > 0) { data.textdata.c1 = concat.join(", ") @@ -502,14 +505,14 @@ let tick = async (serverID, userID, datain) => { } // Send a message saying it has consumed all remaining wearables - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) - process.userevents[userID].costumermimic.stage++ + getProcessVariable(serverID, userID, "userevents").costumermimic.stage++ return; } // Apply Outfit Items once stripped until last index of array is reached or a heavy item is found - if (process.userevents[userID].costumermimic.stage >= 4 && process.userevents[userID].costumermimic.costumeidx < mimicCostumes[process.userevents[userID].costumermimic.outfit].length && nextitem.category != "end") { + if (getProcessVariable(serverID, userID, "userevents").costumermimic.stage >= 4 && getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx < mimicCostumes[getProcessVariable(serverID, userID, "userevents").costumermimic.outfit].length && nextitem.category != "end") { data.applyingOutfit = true; switch (nextitem.category) { @@ -518,33 +521,33 @@ let tick = async (serverID, userID, datain) => { itemtoequipcolored = colourItem(nextitem.itemtowear, nextitem.color); if (itemtoequipcolored != null) { data.textdata.c1 = getWearableName(undefined, itemtoequipcolored) - assignWearable(userID, itemtoequipcolored); + assignWearable(serverID, userID, itemtoequipcolored); data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } else { data.textdata.c1 = getWearableName(undefined, nextitem.itemtowear) - assignWearable(userID, itemtoequipcolored); + assignWearable(serverID, userID, itemtoequipcolored); data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "headwear": - if (!getHeadwear(userID) || (getHeadwear(userID) && (getHeadwear(userID).getHeadwearName != nextitem.itemtowear))) { + if (!getHeadwear(serverID, userID) || (getHeadwear(serverID, userID) && (getHeadwear(serverID, userID).getHeadwearName != nextitem.itemtowear))) { data.headwear = true; data.textdata.c1 = getHeadwearName(undefined, nextitem.itemtowear), // headwear name // Apply the headwear - assignHeadwear(userID, nextitem.itemtowear, targetobject.id) + assignHeadwear(serverID, userID, nextitem.itemtowear, targetobject.id) data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "gag": @@ -552,129 +555,129 @@ let tick = async (serverID, userID, datain) => { data.gag = true; data.textdata.c1 = convertGagText(nextitem.itemtowear), // gag name // Apply the gag - assignGag(userID, nextitem.itemtowear, Math.floor(Math.random() * 10) + 1, process.userevents[userID].costumermimic.origbinder) + assignGag(serverID, userID, nextitem.itemtowear, Math.floor(Math.random() * 10) + 1, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder) data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "mittens": - if (!getMitten(userID) || (getMitten(userID) && (getMitten(userID).getMittenName != nextitem.itemtowear))) { + if (!getMitten(serverID, userID) || (getMitten(serverID, userID) && (getMitten(serverID, userID).getMittenName != nextitem.itemtowear))) { data.mitten = true; - if (getMitten(userID)) { - data.textdata.c1 = getMittenName(undefined, getMitten(userID).mittenname) ?? "mittens", // mitten name - data.textdata.c2 = getMittenName(undefined, nextitem.itemtowear), // new mitten name - assignMitten(userID, nextitem.itemtowear, getMitten(userID).origbinder) + if (getMitten(serverID, userID)) { + data.textdata.c1 = getMittenName(serverID, undefined, getMitten(userID).mittenname) ?? "mittens", // mitten name + data.textdata.c2 = getMittenName(serverID, undefined, nextitem.itemtowear), // new mitten name + assignMitten(serverID, userID, nextitem.itemtowear, getMitten(userID).origbinder) data.replace = true; } else { - data.textdata.c1 = getMittenName(undefined, nextitem.itemtowear), // mitten name - assignMitten(userID, nextitem.itemtowear, process.userevents[userID].costumermimic.origbinder) + data.textdata.c1 = getMittenName(serverID, undefined, nextitem.itemtowear), // mitten name + assignMitten(serverID, userID, nextitem.itemtowear, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder) data.add = true; } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "chastitybelt": - if (!getChastity(userID) || (getChastity(userID) && (getChastity(userID).getChastityName != nextitem.itemtowear))) { + if (!getChastity(serverID, userID) || (getChastity(serverID, userID) && (getChastity(serverID, userID).getChastityName != nextitem.itemtowear))) { data.chastitybelt = true; - if (getChastity(userID)) { - data.textdata.c1 = getChastityName(undefined, getChastity(userID).getChastityName) ?? "chastity belt", // chastity name - data.textdata.c2 = getChastityName(undefined, nextitem.itemtowear), // new chastity name + if (getChastity(serverID, userID)) { + data.textdata.c1 = getChastityName(serverID, undefined, getChastity(serverID, userID).getChastityName) ?? "chastity belt", // chastity name + data.textdata.c2 = getChastityName(serverID, undefined, nextitem.itemtowear), // new chastity name // Update Chastity Belt Name with new type - process.chastity[userID].chastitytype = nextitem.itemtowear + getChastity(serverID, userID).chastitytype = nextitem.itemtowear data.replace = true; } else { - data.textdata.c2 = getChastityName(undefined, nextitem.itemtowear), // chastity name - assignChastity(userID, process.userevents[userID].costumermimic.origbinder, nextitem.itemtowear) + data.textdata.c2 = getChastityName(serverID, undefined, nextitem.itemtowear), // chastity name + assignChastity(serverID, userID, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder, nextitem.itemtowear) data.add = true; } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "chastitybra": - if (!getChastityBra(userID) || (getChastityBra(userID) && (getChastityBra(userID).getChastityBraName != nextitem.itemtowear))) { + if (!getChastityBra(serverID, userID) || (getChastityBra(serverID, userID) && (getChastityBra(serverID, userID).getChastityBraName != nextitem.itemtowear))) { data.chastitybra = true; - if (getChastityBra(userID)) { - data.textdata.c1 = getChastityBraName(undefined, getChastityBra(userID).getChastityBraName) ?? "chastity bra", // chastity bra name - data.textdata.c2 = getChastityBraName(undefined, nextitem.itemtowear), // new chastity bra name + if (getChastityBra(serverID, userID)) { + data.textdata.c1 = getChastityBraName(serverID, undefined, getChastityBra(userID).getChastityBraName) ?? "chastity bra", // chastity bra name + data.textdata.c2 = getChastityBraName(serverID, undefined, nextitem.itemtowear), // new chastity bra name // Update Chastity Bra Name with new type - process.chastitybra[userID].chastitytype = nextitem.itemtowear + getChastityBra(serverID, userID).chastitytype = nextitem.itemtowear data.replace = true; } else { - data.textdata.c2 = getChastityBraName(undefined, nextitem.itemtowear), // chastity bra name - assignChastityBra(userID, process.userevents[userID].costumermimic.origbinder, nextitem.itemtowear) + data.textdata.c2 = getChastityBraName(serverID, undefined, nextitem.itemtowear), // chastity bra name + assignChastityBra(serverID, userID, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder, nextitem.itemtowear) data.add = true; } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "collar": - if (!getCollar(userID) || (getCollar(userID) && (getCollar(userID).getCollarName != nextitem.itemtowear))) { + if (!getCollar(serverID, userID) || (getCollar(serverID, userID) && (getCollar(serverID, userID).getCollarName != nextitem.itemtowear))) { data.collar = true; - if (getCollar(userID)) { - data.textdata.c1 = getCollarName(undefined, getCollar(userID).getCollarName) ?? "collar", // collar name - data.textdata.c2 = getCollarName(undefined, nextitem.itemtowear), // new collar name + if (getCollar(serverID, userID)) { + data.textdata.c1 = getCollarName(serverID, undefined, getCollar(serverID, userID).getCollarName) ?? "collar", // collar name + data.textdata.c2 = getCollarName(serverID, undefined, nextitem.itemtowear), // new collar name // Update Collar Name with new type - process.collar[userID].collartype = nextitem.itemtowear + getCollar(serverID, userID).collartype = nextitem.itemtowear data.replace = true; } else { - data.textdata.c2 = getCollarName(undefined, nextitem.itemtowear), // collar name - assignCollar(userID, process.userevents[userID].costumermimic.origbinder, {}, false, nextitem.itemtowear) + data.textdata.c2 = getCollarName(serverID, undefined, nextitem.itemtowear), // collar name + assignCollar(serverID, userID, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder, {}, false, nextitem.itemtowear) data.add = true; } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "heavy": - if (!getHeavy(userID, nextitem.itemtowear)) { + if (!getHeavy(serverID, userID, nextitem.itemtowear)) { // Apply the Heavy Restraint - assignHeavy(userID, nextitem.itemtowear, process.userevents[userID].costumermimic.origbinder); + assignHeavy(serverID, userID, nextitem.itemtowear, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder); // Configure Message Parameters data.heavyrestraint = true; - data.textdata.c1 = getHeavy(userID, nextitem.itemtowear).displayname; // heavy name + data.textdata.c1 = getHeavy(serverID, userID, nextitem.itemtowear).displayname; // heavy name data.add = true; //Send Message to Channel - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "toy": - if (!getToys(userID).find((t) => t.type === nextitem.itemtowear)) { + if (!getToys(serverID, userID).find((t) => t.type === nextitem.itemtowear)) { // Assign the Toy at a random power between 1 and 5 - assignToy(userID, getHeavy(userID).origbinder, Math.max(Math.round(Math.random() * 5), 1), nextitem.itemtowear, getHeavy(userID).origbinder); + assignToy(serverID, userID, getHeavy(serverID, userID).origbinder, Math.max(Math.round(Math.random() * 5), 1), nextitem.itemtowear, getHeavy(serverID, userID).origbinder); // Configure Message Parameters data.toy = true; @@ -682,23 +685,23 @@ let tick = async (serverID, userID, datain) => { data.add = true; //Send Message to Channel - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; default: // Unknown Item Category in Outfit data.unknown = true; data.textdata.c1 = nextitem.itemtowear; // item name - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); // Increment Costume Index to bypass unknown item - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; } - if (process.userevents[userID].costumermimic.costumeidx >= mimicCostumes[process.userevents[userID].costumermimic.outfit].length) { + if (getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx >= mimicCostumes[getProcessVariable(serverID, userID, "userevents").costumermimic.outfit].length) { // Remove Current Heavy (Mimic) if end of Costume Array Reached Without End Marker let data = { textarray: "texts_eventfunctions", @@ -709,34 +712,34 @@ let tick = async (serverID, userID, datain) => { } data.heavy = true; data.costumer_mimic = true; - removeHeavy(userID, "costumer_mimic"); + removeHeavy(serverID, userID, "costumer_mimic"); data.spitout = true; data.none = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } - } else if (nextitem.category == "end" || process.userevents[userID].costumermimic.costumeidx >= mimicCostumes[process.userevents[userID].costumermimic.outfit].length) { + } else if (nextitem.category == "end" || getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx >= mimicCostumes[getProcessVariable(serverID, userID, "userevents").costumermimic.outfit].length) { // Final Stage - Remove Mimic Heavy and spit them out, then apply Closing Heavy! // End of Outfit Marker Reached! // Remove Current Heavy (Mimic) - removeHeavy(userID, "costumer_mimic"); + removeHeavy(serverID, userID, "costumer_mimic"); data.spitout = true; // Apply New Heavy if (nextitem.itemtowear && nextitem.category == "end") { - assignHeavy(userID, nextitem.itemtowear, process.userevents[userID].costumermimic.origbinder); - data.textdata.c1 = getHeavy(userID, nextitem.itemtowear).displayname; // heavy name + assignHeavy(serverID, userID, nextitem.itemtowear, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder); + data.textdata.c1 = getHeavy(serverID, userID, nextitem.itemtowear).displayname; // heavy name data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { data.none = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Remove Event and exit (Does this automatically go to Garbage Collector?) - delete process.userevents[userID].costumermimic; + delete getProcessVariable(serverID, userID, "userevents").costumermimic; } } diff --git a/eventfunctions/heavy/costumer_mimic_chaos.js b/eventfunctions/heavy/costumer_mimic_chaos.js index fdca64b9..1ce1c66f 100644 --- a/eventfunctions/heavy/costumer_mimic_chaos.js +++ b/eventfunctions/heavy/costumer_mimic_chaos.js @@ -51,23 +51,22 @@ function shuffleWearables(inputArray) { // Then it will spit them out and apply a new heavy item at the end! let tick = async (serverID, userID, datain) => { - if (process.userevents == undefined) { process.userevents = {} } - if (process.userevents[userID] == undefined) { process.userevents[userID] = {} } - if (process.userevents[userID].costumermimic == undefined) { process.userevents[userID].costumermimic = { stage: 0 } } - if (process.userevents[userID].costumermimic.costumeidx == undefined) { process.userevents[userID].costumermimic.costumeidx = 0 } - if (process.userevents[userID].costumermimic.origbinder == undefined) { process.userevents[userID].costumermimic.origbinder = getHeavy(userID).origbinder } + if (getProcessVariable(serverID, userID, "userevents") == undefined) { getProcessVariable(serverID, userID, "userevents") = {} } + if (getProcessVariable(serverID, userID, "userevents").costumermimic == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic = { stage: 0 } } + if (getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx = 0 } + if (getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder = getHeavy(userID).origbinder } // Randomly generate an outfit - if (process.userevents[userID].costumermimic.outfit == undefined) { + if (getProcessVariable(serverID, userID, "userevents").costumermimic.outfit == undefined) { let outfitpieces = []; // Create a new array of all LOCKED wearables so we don't add them again! - let outfitpieceschosen = [...getWearable(userID).filter((f) => (getLockedWearable(userID).includes(f)))]; + let outfitpieceschosen = [...getWearable(serverID, userID).filter((f) => (getLockedWearable(serverID, userID).includes(f)))]; let outfitlength = Math.floor(6 + (Math.random() * 5)) // Equip between 6 and 10 items console.log(outfitlength); let heavyend; let blocks = []; - let tags = getUserTags(userID); - let goodtags = getUserTags(userID, true) + let tags = getUserTags(serverID, userID); + let goodtags = getUserTags(serverID, userID, true) for (let i = 0; i < outfitlength; i++) { let randomchoice = Math.floor(Math.random() * 9); // PLZ BE RANDOM let arr; @@ -279,26 +278,26 @@ let tick = async (serverID, userID, datain) => { } } if (heavyend) { outfitpieces.push(heavyend) } - process.userevents[userID].costumermimic.outfit = outfitpieces; + getProcessVariable(serverID, userID, "userevents").costumermimic.outfit = outfitpieces; } - let currclothes = getWearable(userID).filter((f) => (!getLockedWearable(userID).includes(f))); // Current clothes that can be removed + let currclothes = getWearable(serverID, userID).filter((f) => (!getLockedWearable(userID).includes(f))); // Current clothes that can be removed let shuffledclothes = shuffleWearables(currclothes); // I admittedly dont think a big shuffler's necessary but its fine // Capture length of initial Removable Wearables array - if (process.userevents[userID].costumermimic.removableclothes == undefined) { process.userevents[userID].costumermimic.removableclothes = shuffledclothes.length } - let consumeperpass = Math.round(process.userevents[userID].costumermimic.removableclothes / 4); + if (getProcessVariable(serverID, userID, "userevents").costumermimic.removableclothes == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.removableclothes = shuffledclothes.length } + let consumeperpass = Math.round(getProcessVariable(serverID, userID, "userevents").costumermimic.removableclothes / 4); // get the user object, if it doesn't exist, go away let userobject = await process.client.users.fetch(userID); // The person in the processing terminal! - let targetobject = await process.client.users.fetch(getHeavy(userID).origbinder ?? userID); // The cruel person who threw this person in the terminal! + let targetobject = await process.client.users.fetch(getHeavy(serverID, userID).origbinder ?? userID); // The cruel person who threw this person in the terminal! // Something's wrong. - if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[userID])) { + if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[serverID][userID])) { return; } // Only update a max of once every 20 seconds. - if ((process.userevents[userID].costumermimic.nextupdate ?? 0) < Date.now()) { - //process.userevents[userID].costumermimic.nextupdate = Date.now() + 3000; // Test Speed - process.userevents[userID].costumermimic.nextupdate = Date.now() + 20000; + if ((getProcessVariable(serverID, userID, "userevents").costumermimic.nextupdate ?? 0) < Date.now()) { + //getProcessVariable(serverID, userID, "userevents").costumermimic.nextupdate = Date.now() + 3000; // Test Speed + getProcessVariable(serverID, userID, "userevents").costumermimic.nextupdate = Date.now() + 20000; } else { return }; @@ -306,27 +305,28 @@ let tick = async (serverID, userID, datain) => { let data = { textarray: "texts_eventfunctions", textdata: { + serverID: serverID, interactionuser: userobject, targetuser: targetobject, } } - console.log(process.userevents[userID].costumermimic) + console.log(getProcessVariable(serverID, userID, "userevents").costumermimic) // Select Item from Chosen Outfit based in index - let nextitem = process.userevents[userID].costumermimic.outfit[process.userevents[userID].costumermimic.costumeidx]; + let nextitem = getProcessVariable(serverID, userID, "userevents").costumermimic.outfit[getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx]; let itemtoequipcolored = null; let nom_idx = 0; let itemsconsumed = ""; - logConsole(("costumer_mimic_chaos: " + "Consume: ", consumeperpass, ", Total: ", getWearable(userID).filter((f) => (!getLockedWearable(userID).includes(f))).length, ", Stage: ", process.userevents[userID].costumermimic.stage), 1); + logConsole(("costumer_mimic_chaos: " + "Consume: ", consumeperpass, ", Total: ", getWearable(serverID, userID).filter((f) => (!getLockedWearable(serverID, userID).includes(f))).length, ", Stage: ", getProcessVariable(serverID, userID, "userevents").costumermimic.stage), 1); // Initial Text Formatting data.heavy = true; data.costumer_mimic = true; // Stripping Clothes - if (process.userevents[userID].costumermimic.stage < 3) { + if (getProcessVariable(serverID, userID, "userevents").costumermimic.stage < 3) { if (shuffledclothes.length > consumeperpass && consumeperpass >= 2) { while (nom_idx < consumeperpass && shuffledclothes[nom_idx] != null) { // Fetch Wearable name and concatenate onto string @@ -336,7 +336,7 @@ let tick = async (serverID, userID, datain) => { itemsconsumed += "and " + getWearableName(undefined, shuffledclothes[nom_idx]); } // remove it - deleteWearable(userID, shuffledclothes[nom_idx]); + deleteWearable(serverID, userID, shuffledclothes[nom_idx]); nom_idx++; } data.textdata.c1 = itemsconsumed; @@ -344,31 +344,31 @@ let tick = async (serverID, userID, datain) => { data.removeclothing = true; // Send a message saying it stripped things off the wearer <3 - messageSendChannel(getText(data), process.recentmessages[userID]) - process.userevents[userID].costumermimic.stage++ + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) + getProcessVariable(serverID, userID, "userevents").costumermimic.stage++ return; } else if (shuffledclothes.length <= consumeperpass && shuffledclothes.length > 0) { console.log("Not enough Clothes remaining for a full cycle! Skipping to stage 3!") // Skip to Stage 4 and consume all remaining items - process.userevents[userID].costumermimic.stage = 3 + getProcessVariable(serverID, userID, "userevents").costumermimic.stage = 3 } else { // Victim Stripped of all unprotected clothing unexpectedly, progress to next stage console.log("Unexpectedly Naked! Skipping to Dress Up!") - process.userevents[userID].costumermimic.stage = 4; + getProcessVariable(serverID, userID, "userevents").costumermimic.stage = 4; data.textdata.c1 = "Naked"; data.donestripping = true; data.noneremaining = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) return; } } - if (process.userevents[userID].costumermimic.stage == 3) { + if (getProcessVariable(serverID, userID, "userevents").costumermimic.stage == 3) { // Handle all remaining Wearables data.donestripping = true; - let remainingwearables = getWearable(userID).filter((f) => (!getLockedWearable(userID).includes(f))) + let remainingwearables = getWearable(serverID, userID).filter((f) => (!getLockedWearable(userID).includes(f))) let concat = [] remainingwearables.forEach((w) => { concat.push(getWearableName(undefined, w)); @@ -390,14 +390,14 @@ let tick = async (serverID, userID, datain) => { } // Send a message saying it has consumed all remaining wearables - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) - process.userevents[userID].costumermimic.stage++ + getProcessVariable(serverID, userID, "userevents").costumermimic.stage++ return; } // Apply Outfit Items once stripped until last index of array is reached or a heavy item is found - if (process.userevents[userID].costumermimic.stage >= 4 && process.userevents[userID].costumermimic.costumeidx < process.userevents[userID].costumermimic.outfit.length && nextitem.category != "heavy") { + if (getProcessVariable(serverID, userID, "userevents").costumermimic.stage >= 4 && getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx < getProcessVariable(serverID, userID, "userevents").costumermimic.outfit.length && nextitem.category != "heavy") { data.applyingOutfit = true; switch (nextitem.category) { @@ -406,192 +406,193 @@ let tick = async (serverID, userID, datain) => { itemtoequipcolored = colourItem(nextitem.itemtowear, nextitem.color); if (itemtoequipcolored != null) { data.textdata.c1 = getWearableName(undefined, itemtoequipcolored) - assignWearable(userID, itemtoequipcolored); + assignWearable(serverID, userID, itemtoequipcolored); data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } else { data.textdata.c1 = getWearableName(undefined, nextitem.itemtowear) assignWearable(userID, itemtoequipcolored); data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "headwear": - if (!getHeadwear(userID) || (getHeadwear(userID) && (getHeadwear(userID).getHeadwearName != nextitem.itemtowear))) { + if (!getHeadwear(serverID, userID) || (getHeadwear(serverID, userID) && (getHeadwear(serverID, userID).getHeadwearName != nextitem.itemtowear))) { data.headwear = true; data.textdata.c1 = getHeadwearName(undefined, nextitem.itemtowear), // headwear name // Apply the headwear - assignHeadwear(userID, nextitem.itemtowear, targetobject.id) + assignHeadwear(serverID, userID, nextitem.itemtowear, targetobject.id) data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "gag": - if (!getGag(serverID, userID) || (getGag(serverID, userID) && (getGag(userID).getGagName != nextitem.itemtowear))) { + if (!getGag(serverID, userID) || (getGag(serverID, userID) && (getGag(serverID, userID).getGagName != nextitem.itemtowear))) { data.gag = true; data.textdata.c1 = convertGagText(nextitem.itemtowear), // gag name // Apply the gag - assignGag(userID, nextitem.itemtowear, Math.floor(Math.random() * 10) + 1, process.userevents[userID].costumermimic.origbinder) + assignGag(userID, nextitem.itemtowear, Math.floor(Math.random() * 10) + 1, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder) data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "mittens": - if (!getMitten(userID) || (getMitten(userID) && (getMitten(userID).getMittenName != nextitem.itemtowear))) { + if (!getMitten(serverID, userID) || (getMitten(serverID, userID) && (getMitten(serverID, userID).getMittenName != nextitem.itemtowear))) { data.mitten = true; - if (getMitten(userID)) { - data.textdata.c1 = getMittenName(undefined, getMitten(userID).mittenname) ?? "mittens", // mitten name - data.textdata.c2 = getMittenName(undefined, nextitem.itemtowear), // new mitten name - assignMitten(userID, nextitem.itemtowear, getMitten(userID).origbinder) + if (getMitten(serverID, userID)) { + data.textdata.c1 = getMittenName(undefined, getMitten(serverID, userID).mittenname) ?? "mittens", // mitten name + data.textdata.c2 = getMittenName(serverID, undefined, nextitem.itemtowear), // new mitten name + assignMitten(userID, nextitem.itemtowear, getMitten(serverID, userID).origbinder) data.replace = true; } else { data.textdata.c1 = getMittenName(undefined, nextitem.itemtowear), // mitten name - assignMitten(userID, nextitem.itemtowear, process.userevents[userID].costumermimic.origbinder) + assignMitten(userID, nextitem.itemtowear, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder) data.add = true; } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, serverID, userID, "userevents").costumermimic.costumeidx++; break; case "chastitybelt": - if (!getChastity(userID) || (getChastity(userID) && (getChastity(userID).getChastityName != nextitem.itemtowear))) { + if (!getChastity(serverID, userID) || (getChastity(serverID, userID) && (getChastity(serverID, userID).getChastityName != nextitem.itemtowear))) { data.chastitybelt = true; - if (getChastity(userID)) { - data.textdata.c1 = getChastityName(undefined, getChastity(userID).getChastityName) ?? "chastity belt", // chastity name - data.textdata.c2 = getChastityName(undefined, nextitem.itemtowear), // new chastity name + if (getChastity(serverID, userID)) { + data.textdata.c1 = getChastityName(serverID, undefined, getChastity(serverID, userID).chastitytype) ?? "chastity belt", // chastity name + data.textdata.c2 = getChastityName(serverID, undefined, nextitem.itemtowear), // new chastity name // Update Chastity Belt Name with new type - process.chastity[userID].chastitytype = nextitem.itemtowear + getChastity(serverID, userID).chastitytype = nextitem.itemtowear data.replace = true; } else { - data.textdata.c2 = getChastityName(undefined, nextitem.itemtowear), // chastity name - assignChastity(userID, process.userevents[userID].costumermimic.origbinder, nextitem.itemtowear) + data.textdata.c2 = getChastityName(serverID, undefined, nextitem.itemtowear), // chastity name + assignChastity(serverID, userID, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder, nextitem.itemtowear) data.add = true; } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "chastitybra": - if (!getChastityBra(userID) || (getChastityBra(userID) && (getChastityBra(userID).getChastityBraName != nextitem.itemtowear))) { + if (!getChastityBra(serverID, userID) || (getChastityBra(serverID, userID) && (getChastityBra(serverID, userID).getChastityBraName != nextitem.itemtowear))) { data.chastitybra = true; - if (getChastityBra(userID)) { - data.textdata.c1 = getChastityBraName(undefined, getChastityBra(userID).getChastityBraName) ?? "chastity bra", // chastity bra name - data.textdata.c2 = getChastityBraName(undefined, nextitem.itemtowear), // new chastity bra name + if (getChastityBra(serverID, userID)) { + data.textdata.c1 = getChastityBraName(serverID, undefined, getChastityBra(serverID, userID).chastitytype) ?? "chastity bra", // chastity bra name + data.textdata.c2 = getChastityBraName(serverID, undefined, nextitem.itemtowear), // new chastity bra name // Update Chastity Bra Name with new type - process.chastitybra[userID].chastitytype = nextitem.itemtowear + getChastityBra(serverID, userID).chastitytype = nextitem.itemtowear data.replace = true; } else { data.textdata.c2 = getChastityBraName(undefined, nextitem.itemtowear), // chastity bra name - assignChastityBra(userID, process.userevents[userID].costumermimic.origbinder, nextitem.itemtowear) + assignChastityBra(userID, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder, nextitem.itemtowear) data.add = true; } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "collar": - if (!getCollar(userID) || (getCollar(userID) && (getCollar(userID).getCollarName != nextitem.itemtowear))) { + if (!getCollar(serverID, userID) || (getCollar(serverID, userID) && (getCollar(serverID, userID).getCollarName != nextitem.itemtowear))) { data.collar = true; - if (getCollar(userID)) { - data.textdata.c1 = getCollarName(undefined, getCollar(userID).getCollarName) ?? "collar", // collar name - data.textdata.c2 = getCollarName(undefined, nextitem.itemtowear), // new collar name + if (getCollar(serverID, userID)) { + data.textdata.c1 = getCollarName(serverID, undefined, getCollar(serverID, userID).collartype) ?? "collar", // collar name + data.textdata.c2 = getCollarName(serverID, undefined, nextitem.itemtowear), // new collar name // Update Collar Name with new type - process.collar[userID].collartype = nextitem.itemtowear + getCollar(serverID, userID).collartype = nextitem.itemtowear data.replace = true; } else { - data.textdata.c2 = getCollarName(undefined, nextitem.itemtowear), // collar name - assignCollar(userID, process.userevents[userID].costumermimic.origbinder, {}, false, nextitem.itemtowear) + data.textdata.c2 = getCollarName(serverID, undefined, nextitem.itemtowear), // collar name + assignCollar(userID, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder, {}, false, nextitem.itemtowear) data.add = true; } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; default: // Unknown Item Category in Outfit data.unknown = true; data.textdata.c1 = nextitem.itemtowear; // item name - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); // Increment Costume Index to bypass unknown item - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; } - if (process.userevents[userID].costumermimic.costumeidx >= process.userevents[userID].costumermimic.outfit.length) { + if (getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx >= getProcessVariable(serverID, userID, "userevents").costumermimic.outfit.length) { // Remove Current Heavy (Mimic) if end of Costume Array Reached Without Heavy let data = { textarray: "texts_eventfunctions", textdata: { + serverID: serverID, interactionuser: userobject, targetuser: targetobject, } } data.heavy = true; data.costumer_mimic = true; - removeHeavy(userID, "costumer_mimic_chaos"); + removeHeavy(serverID, userID, "costumer_mimic_chaos"); data.spitout = true; data.none = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } - } else if (nextitem.category == "heavy" || process.userevents[userID].costumermimic.costumeidx >= process.userevents[userID].costumermimic.outfit.length) { + } else if (nextitem.category == "heavy" || getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx >= getProcessVariable(serverID, userID, "userevents").costumermimic.outfit.length) { // Final Stage - Remove Mimic Heavy and spit them out, then apply Outfit Heavy! // heavy item reached or end of outfit reached // Remove Current Heavy (Mimic) - removeHeavy(userID, "costumer_mimic_chaos"); + removeHeavy(serverID, userID, "costumer_mimic_chaos"); data.spitout = true; // Apply New Heavy if (nextitem.itemtowear && nextitem.category == "heavy") { - assignHeavy(userID, nextitem.itemtowear, process.userevents[userID].costumermimic.origbinder); - data.textdata.c1 = getHeavy(userID).displayname; // heavy name + assignHeavy(serverID, userID, nextitem.itemtowear, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder); + data.textdata.c1 = getHeavy(serverID, userID).displayname; // heavy name data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { data.none = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Remove Event and exit (Does this automatically go to Garbage Collector?) - delete process.userevents[userID].costumermimic; + delete getProcessVariable(serverID, userID, "userevents").costumermimic; } } diff --git a/eventfunctions/heavy/costumer_mimic_latex.js b/eventfunctions/heavy/costumer_mimic_latex.js index 67f853f1..df553e28 100644 --- a/eventfunctions/heavy/costumer_mimic_latex.js +++ b/eventfunctions/heavy/costumer_mimic_latex.js @@ -4,6 +4,7 @@ const { getChastityBraName } = require("../../functions/getters/chastity/getChas const { getChastityName } = require("../../functions/getters/chastity/getChastityName.js"); const { getCollar } = require("../../functions/getters/collar/getCollar.js"); const { getCollarName } = require("../../functions/getters/collar/getCollarName.js"); +const { getProcessVariable } = require("../../functions/getters/config/getProcessVariable.js"); const { getGag } = require("../../functions/getters/gag/getGag.js"); const { convertGagText } = require("../../functions/getters/gag/getGagName.js"); const { getHeadwear } = require("../../functions/getters/headwear/getHeadwear.js"); @@ -18,6 +19,7 @@ const { messageSendChannel } = require("../../functions/messagefunctions.js"); const { assignChastity } = require("../../functions/setters/chastity/assignChastity.js"); const { assignChastityBra } = require("../../functions/setters/chastity/assignChastityBra.js"); const { assignCollar } = require("../../functions/setters/collar/assignCollar.js"); +const { setProcessVariable } = require("../../functions/setters/config/setProcessVariable.js"); const { assignGag } = require("../../functions/setters/gag/assignGag.js"); const { assignHeadwear } = require("../../functions/setters/headwear/assignHeadwear.js"); const { assignHeavy } = require("../../functions/setters/heavy/assignHeavy.js"); @@ -128,31 +130,31 @@ function shuffleWearables(inputArray) { let tick = async (serverID, userID, datain) => { if (process.userevents == undefined) { process.userevents = {} } - if (process.userevents[userID] == undefined) { process.userevents[userID] = {} } - if (process.userevents[userID].costumermimic == undefined) { process.userevents[userID].costumermimic = { stage: 0 } } - if (process.userevents[userID].costumermimic.costumeidx == undefined) { process.userevents[userID].costumermimic.costumeidx = 0 } - if (process.userevents[userID].costumermimic.origbinder == undefined) { process.userevents[userID].costumermimic.origbinder = getHeavy(userID).origbinder } + if (getProcessVariable(serverID, userID, "userevents") == undefined) { setProcessVariable(serverID, userID, "userevents", {}) } + if (getProcessVariable(serverID, userID, "userevents").costumermimic == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic = { stage: 0 } } + if (getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx = 0 } + if (getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder = getHeavy(userID).origbinder } // Randomly select an outfit from mimicCostumes.js - if (process.userevents[userID].costumermimic.outfit == undefined) { process.userevents[userID].costumermimic.outfit = Object.keys(mimicCostumes)[Math.floor(Math.random() * Object.keys(mimicCostumes).length)]; } - let currclothes = getWearable(userID).filter((f) => (!getLockedWearable(userID).includes(f))); // Current clothes that can be removed + if (getProcessVariable(serverID, userID, "userevents").costumermimic.outfit == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.outfit = Object.keys(mimicCostumes)[Math.floor(Math.random() * Object.keys(mimicCostumes).length)]; } + let currclothes = getWearable(userID).filter((f) => (!getLockedWearable(serverID, userID).includes(f))); // Current clothes that can be removed let shuffledclothes = shuffleWearables(currclothes); // I admittedly dont think a big shuffler's necessary but its fine // Capture length of initial Removable Wearables array - if (process.userevents[userID].costumermimic.removableclothes == undefined) { process.userevents[userID].costumermimic.removableclothes = shuffledclothes.length } - let consumeperpass = Math.round(process.userevents[userID].costumermimic.removableclothes / 4); + if (getProcessVariable(serverID, userID, "userevents").costumermimic.removableclothes == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.removableclothes = shuffledclothes.length } + let consumeperpass = Math.round(getProcessVariable(serverID, userID, "userevents").costumermimic.removableclothes / 4); // get the user object, if it doesn't exist, go away let userobject = await process.client.users.fetch(userID); // The person in the processing terminal! - let targetobject = await process.client.users.fetch(getHeavy(userID).origbinder ?? userID); // The cruel person who threw this person in the terminal! + let targetobject = await process.client.users.fetch(getHeavy(serverID, userID).origbinder ?? userID); // The cruel person who threw this person in the terminal! // Something's wrong. - if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[userID])) { + if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[serverID][userID])) { return; } // Only update a max of once every 20 seconds. - if ((process.userevents[userID].costumermimic.nextupdate ?? 0) < Date.now()) { - //process.userevents[userID].costumermimic.nextupdate = Date.now() + 3000; // Test Speed - process.userevents[userID].costumermimic.nextupdate = Date.now() + 20000; + if ((getProcessVariable(serverID, userID, "userevents").costumermimic.nextupdate ?? 0) < Date.now()) { + //getProcessVariable(serverID, userID, "userevents").costumermimic.nextupdate = Date.now() + 3000; // Test Speed + getProcessVariable(serverID, userID, "userevents").costumermimic.nextupdate = Date.now() + 20000; } else { return }; @@ -160,27 +162,28 @@ let tick = async (serverID, userID, datain) => { let data = { textarray: "texts_eventfunctions", textdata: { + serverID: serverID, interactionuser: userobject, targetuser: targetobject, } } - console.log(process.userevents[userID].costumermimic) + console.log(getProcessVariable(serverID, userID, "userevents").costumermimic) // Select Item from Chosen Outfit based in index - let nextitem = mimicCostumes[process.userevents[userID].costumermimic.outfit][process.userevents[userID].costumermimic.costumeidx]; + let nextitem = mimicCostumes[getProcessVariable(serverID, userID, "userevents").costumermimic.outfit][getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx]; let itemtoequipcolored = null; let nom_idx = 0; let itemsconsumed = ""; - console.log("Consume: ", consumeperpass, ", Total: ", getWearable(userID).filter((f) => (!getLockedWearable(userID).includes(f))).length, ", Stage: ", process.userevents[userID].costumermimic.stage); + console.log("Consume: ", consumeperpass, ", Total: ", getWearable(serverID, userID).filter((f) => (!getLockedWearable(serverID, userID).includes(f))).length, ", Stage: ", getProcessVariable(serverID, userID, "userevents").costumermimic.stage); // Initial Text Formatting data.heavy = true; data.costumer_mimic = true; // Stripping Clothes - if (process.userevents[userID].costumermimic.stage < 3) { + if (getProcessVariable(serverID, userID, "userevents").costumermimic.stage < 3) { if (shuffledclothes.length > consumeperpass && consumeperpass >= 2) { while (nom_idx < consumeperpass && shuffledclothes[nom_idx] != null) { // Fetch Wearable name and concatenate onto string @@ -190,7 +193,7 @@ let tick = async (serverID, userID, datain) => { itemsconsumed += "and " + getWearableName(undefined, shuffledclothes[nom_idx]); } // remove it - deleteWearable(userID, shuffledclothes[nom_idx]); + deleteWearable(serverID, userID, shuffledclothes[nom_idx]); nom_idx++; } data.textdata.c1 = itemsconsumed; @@ -198,31 +201,31 @@ let tick = async (serverID, userID, datain) => { data.removeclothing = true; // Send a message saying it stripped things off the wearer <3 - messageSendChannel(getText(data), process.recentmessages[userID]) - process.userevents[userID].costumermimic.stage++ + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) + getProcessVariable(serverID, userID, "userevents").costumermimic.stage++ return; } else if (shuffledclothes.length <= consumeperpass && shuffledclothes.length > 0) { console.log("Not enough Clothes remaining for a full cycle! Skipping to stage 3!") // Skip to Stage 4 and consume all remaining items - process.userevents[userID].costumermimic.stage = 3 + getProcessVariable(serverID, userID, "userevents").costumermimic.stage = 3 } else { // Victim Stripped of all unprotected clothing unexpectedly, progress to next stage console.log("Unexpectedly Naked! Skipping to Dress Up!") - process.userevents[userID].costumermimic.stage = 4; + getProcessVariable(serverID, userID, "userevents").costumermimic.stage = 4; data.textdata.c1 = "Naked"; data.donestripping = true; data.noneremaining = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) return; } } - if (process.userevents[userID].costumermimic.stage == 3) { + if (getProcessVariable(serverID, userID, "userevents").costumermimic.stage == 3) { // Handle all remaining Wearables data.donestripping = true; - let remainingwearables = getWearable(userID).filter((f) => (!getLockedWearable(userID).includes(f))) + let remainingwearables = getWearable(serverID, userID).filter((f) => (!getLockedWearable(serverID, userID).includes(f))) let concat = [] remainingwearables.forEach((w) => { concat.push(getWearableName(undefined, w)); @@ -244,14 +247,14 @@ let tick = async (serverID, userID, datain) => { } // Send a message saying it has consumed all remaining wearables - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) - process.userevents[userID].costumermimic.stage++ + getProcessVariable(serverID, userID, "userevents").costumermimic.stage++ return; } // Apply Outfit Items once stripped until last index of array is reached or a heavy item is found - if (process.userevents[userID].costumermimic.stage >= 4 && process.userevents[userID].costumermimic.costumeidx < mimicCostumes[process.userevents[userID].costumermimic.outfit].length && nextitem.category != "heavy") { + if (getProcessVariable(serverID, userID, "userevents").costumermimic.stage >= 4 && getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx < mimicCostumes[getProcessVariable(serverID, userID, "userevents").costumermimic.outfit].length && nextitem.category != "heavy") { data.applyingOutfit = true; switch (nextitem.category) { @@ -260,33 +263,33 @@ let tick = async (serverID, userID, datain) => { itemtoequipcolored = colourItem(nextitem.itemtowear, nextitem.color); if (itemtoequipcolored != null) { data.textdata.c1 = getWearableName(undefined, itemtoequipcolored) - assignWearable(userID, itemtoequipcolored); + assignWearable(serverID, userID, itemtoequipcolored); data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } else { data.textdata.c1 = getWearableName(undefined, nextitem.itemtowear) - assignWearable(userID, itemtoequipcolored); + assignWearable(serverID, userID, itemtoequipcolored); data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "headwear": - if (!getHeadwear(userID) || (getHeadwear(userID) && (getHeadwear(userID).getHeadwearName != nextitem.itemtowear))) { + if (!getHeadwear(serverID, userID) || (getHeadwear(serverID, userID) && (getHeadwear(serverID, userID).getHeadwearName != nextitem.itemtowear))) { data.headwear = true; - data.textdata.c1 = getHeadwearName(undefined, nextitem.itemtowear), // headwear name + data.textdata.c1 = getHeadwearName(serverID, undefined, nextitem.itemtowear), // headwear name // Apply the headwear - assignHeadwear(userID, nextitem.itemtowear, targetobject.id) + assignHeadwear(serverID, userID, nextitem.itemtowear, targetobject.id) data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "gag": @@ -294,120 +297,120 @@ let tick = async (serverID, userID, datain) => { data.gag = true; data.textdata.c1 = convertGagText(nextitem.itemtowear), // gag name // Apply the gag - assignGag(userID, nextitem.itemtowear, Math.floor(Math.random() * 10) + 1, process.userevents[userID].costumermimic.origbinder) + assignGag(userID, nextitem.itemtowear, Math.floor(Math.random() * 10) + 1, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder) data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "mittens": - if (!getMitten(userID) || (getMitten(userID) && (getMitten(userID).getMittenName != nextitem.itemtowear))) { + if (!getMitten(serverID, userID) || (getMitten(serverID, userID) && (getMitten(serverID, userID).getMittenName != nextitem.itemtowear))) { data.mitten = true; - if (getMitten(userID)) { - data.textdata.c1 = getMittenName(undefined, getMitten(userID).mittenname) ?? "mittens", // mitten name - data.textdata.c2 = getMittenName(undefined, nextitem.itemtowear), // new mitten name - assignMitten(userID, nextitem.itemtowear, getMitten(userID).origbinder) + if (getMitten(serverID, userID)) { + data.textdata.c1 = getMittenName(serverID, undefined, getMitten(userID).mittenname) ?? "mittens", // mitten name + data.textdata.c2 = getMittenName(serverID, undefined, nextitem.itemtowear), // new mitten name + assignMitten(serverID, userID, nextitem.itemtowear, getMitten(serverID, userID).origbinder) data.replace = true; } else { - data.textdata.c1 = getMittenName(undefined, nextitem.itemtowear), // mitten name - assignMitten(userID, nextitem.itemtowear, process.userevents[userID].costumermimic.origbinder) + data.textdata.c1 = getMittenName(serverID, undefined, nextitem.itemtowear), // mitten name + assignMitten(serverID, userID, nextitem.itemtowear, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder) data.add = true; } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "chastitybelt": - if (!getChastity(userID) || (getChastity(userID) && (getChastity(userID).getChastityName != nextitem.itemtowear))) { + if (!getChastity(serverID, userID) || (getChastity(serverID, userID) && (getChastity(serverID, userID).getChastityName != nextitem.itemtowear))) { data.chastitybelt = true; - if (getChastity(userID)) { - data.textdata.c1 = getChastityName(undefined, getChastity(userID).getChastityName) ?? "chastity belt", // chastity name - data.textdata.c2 = getChastityName(undefined, nextitem.itemtowear), // new chastity name + if (getChastity(serverID, userID)) { + data.textdata.c1 = getChastityName(serverID, undefined, getChastity(userID).getChastityName) ?? "chastity belt", // chastity name + data.textdata.c2 = getChastityName(serverID, undefined, nextitem.itemtowear), // new chastity name // Update Chastity Belt Name with new type - process.chastity[userID].chastitytype = nextitem.itemtowear + getChastity(serverID, userID).chastitytype = nextitem.itemtowear data.replace = true; } else { - data.textdata.c2 = getChastityName(undefined, nextitem.itemtowear), // chastity name - assignChastity(userID, process.userevents[userID].costumermimic.origbinder, nextitem.itemtowear) + data.textdata.c2 = getChastityName(serverID, undefined, nextitem.itemtowear), // chastity name + assignChastity(serverID, userID, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder, nextitem.itemtowear) data.add = true; } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "chastitybra": - if (!getChastityBra(userID) || (getChastityBra(userID) && (getChastityBra(userID).getChastityBraName != nextitem.itemtowear))) { + if (!getChastityBra(serverID, userID) || (getChastityBra(serverID, userID) && (getChastityBra(serverID, userID).getChastityBraName != nextitem.itemtowear))) { data.chastitybra = true; - if (getChastityBra(userID)) { - data.textdata.c1 = getChastityBraName(undefined, getChastityBra(userID).getChastityBraName) ?? "chastity bra", // chastity bra name - data.textdata.c2 = getChastityBraName(undefined, nextitem.itemtowear), // new chastity bra name + if (getChastityBra(serverID, userID)) { + data.textdata.c1 = getChastityBraName(serverID, undefined, getChastityBra(serverID, userID).getChastityBraName) ?? "chastity bra", // chastity bra name + data.textdata.c2 = getChastityBraName(serverID, undefined, nextitem.itemtowear), // new chastity bra name // Update Chastity Bra Name with new type - process.chastitybra[userID].chastitytype = nextitem.itemtowear + getChastityBra(serverID, userID).chastitytype = nextitem.itemtowear data.replace = true; } else { - data.textdata.c2 = getChastityBraName(undefined, nextitem.itemtowear), // chastity bra name - assignChastityBra(userID, process.userevents[userID].costumermimic.origbinder, nextitem.itemtowear) + data.textdata.c2 = getChastityBraName(serverID, undefined, nextitem.itemtowear), // chastity bra name + assignChastityBra(serverID, userID, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder, nextitem.itemtowear) data.add = true; } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; case "collar": - if (!getCollar(userID) || (getCollar(userID) && (getCollar(userID).getCollarName != nextitem.itemtowear))) { + if (!getCollar(serverID, userID) || (getCollar(serverID, userID) && (getCollar(serverID, userID).getCollarName != nextitem.itemtowear))) { data.collar = true; - if (getCollar(userID)) { - data.textdata.c1 = getCollarName(undefined, getCollar(userID).getCollarName) ?? "collar", // collar name - data.textdata.c2 = getCollarName(undefined, nextitem.itemtowear), // new collar name + if (getCollar(serverID, userID)) { + data.textdata.c1 = getCollarName(serverID, undefined, getCollar(serverID, userID).getCollarName) ?? "collar", // collar name + data.textdata.c2 = getCollarName(serverID, undefined, nextitem.itemtowear), // new collar name // Update Collar Name with new type - process.collar[userID].collartype = nextitem.itemtowear + getCollar(serverID, userID).collartype = nextitem.itemtowear data.replace = true; } else { data.textdata.c2 = getCollarName(undefined, nextitem.itemtowear), // collar name - assignCollar(userID, process.userevents[userID].costumermimic.origbinder, {}, false, nextitem.itemtowear) + assignCollar(userID, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder, {}, false, nextitem.itemtowear) data.add = true; } - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Increment Costume Index - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; default: // Unknown Item Category in Outfit data.unknown = true; data.textdata.c1 = nextitem.itemtowear; // item name - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); // Increment Costume Index to bypass unknown item - process.userevents[userID].costumermimic.costumeidx++; + getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx++; break; } - if (process.userevents[userID].costumermimic.costumeidx >= mimicCostumes[process.userevents[userID].costumermimic.outfit].length) { + if (getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx >= mimicCostumes[getProcessVariable(serverID, userID, "userevents").costumermimic.outfit].length) { // Remove Current Heavy (Mimic) if end of Costume Array Reached Without Heavy let data = { textarray: "texts_eventfunctions", @@ -418,34 +421,34 @@ let tick = async (serverID, userID, datain) => { } data.heavy = true; data.costumer_mimic = true; - removeHeavy(userID, "costumer_mimic_latex"); + removeHeavy(serverID, userID, "costumer_mimic_latex"); data.spitout = true; data.none = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } - } else if (nextitem.category == "heavy" || process.userevents[userID].costumermimic.costumeidx >= mimicCostumes[process.userevents[userID].costumermimic.outfit].length) { + } else if (nextitem.category == "heavy" || getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx >= mimicCostumes[getProcessVariable(serverID, userID, "userevents").costumermimic.outfit].length) { // Final Stage - Remove Mimic Heavy and spit them out, then apply Outfit Heavy! // heavy item reached or end of outfit reached // Remove Current Heavy (Mimic) - removeHeavy(userID, "costumer_mimic_latex"); + removeHeavy(serverID, userID, "costumer_mimic_latex"); data.spitout = true; // Apply New Heavy if (nextitem.itemtowear && nextitem.category == "heavy") { - assignHeavy(userID, nextitem.itemtowear, process.userevents[userID].costumermimic.origbinder); - data.textdata.c1 = getHeavy(userID).displayname; // heavy name + assignHeavy(serverID, userID, nextitem.itemtowear, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder); + data.textdata.c1 = getHeavy(serverID, userID).displayname; // heavy name data.add = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { data.none = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } // Remove Event and exit (Does this automatically go to Garbage Collector?) - delete process.userevents[userID].costumermimic; + delete getProcessVariable(serverID, userID, "userevents").costumermimic; } } diff --git a/eventfunctions/heavy/doll_processing.js b/eventfunctions/heavy/doll_processing.js index 60095f28..d687518b 100644 --- a/eventfunctions/heavy/doll_processing.js +++ b/eventfunctions/heavy/doll_processing.js @@ -5,6 +5,7 @@ const { getChastityName } = require("../../functions/getters/chastity/getChastit const { getCollar } = require("../../functions/getters/collar/getCollar.js"); const { getCollarName } = require("../../functions/getters/collar/getCollarName.js"); const { getOption } = require("../../functions/getters/config/getOption.js"); +const { getProcessVariable } = require("../../functions/getters/config/getProcessVariable.js"); const { getHeadwear } = require("../../functions/getters/headwear/getHeadwear.js"); const { getHeadwearName } = require("../../functions/getters/headwear/getHeadwearName.js"); const { getHeavy } = require("../../functions/getters/heavy/getHeavy.js"); @@ -18,6 +19,7 @@ const { messageSendChannel } = require("../../functions/messagefunctions.js"); const { assignChastity } = require("../../functions/setters/chastity/assignChastity.js"); const { assignChastityBra } = require("../../functions/setters/chastity/assignChastityBra.js"); const { assignCollar } = require("../../functions/setters/collar/assignCollar.js"); +const { setProcessVariable } = require("../../functions/setters/config/setProcessVariable.js"); const { assignHeadwear } = require("../../functions/setters/headwear/assignHeadwear.js"); const { removeHeavy } = require("../../functions/setters/heavy/removeHeavy.js"); const { assignMitten } = require("../../functions/setters/mitten/assignMitten.js"); @@ -30,34 +32,34 @@ const { wearablecolors } = require("../../functions/wearablefunctions.js"); // Then after they are naked, it will announce once that it is applying restraints // Then it will slowly apply the restraints! // Then it will spit them out and unwear the processing facility -let tick = async (userID, datain) => { +let tick = async (serverID, userID, datain) => { if (process.userevents == undefined) { process.userevents = {} } - if (process.userevents[userID] == undefined) { process.userevents[userID] = {} } - if (process.userevents[userID].dollprocessing == undefined) { process.userevents[userID].dollprocessing = { stage: 0 } } - if (process.userevents[userID].dollprocessing.doll_id == undefined) { process.userevents[userID].dollprocessing.doll_id = getOption(userID, "dollvisorname") } - if (process.userevents[userID].dollprocessing.existingbarcodelogged == undefined) { process.userevents[userID].dollprocessing.existingbarcodelogged = !getWearable(userID).includes("cyberdoll_barcode"); } + if (getProcessVariable(serverID, userID, "userevents") == undefined) { setProcessVariable(serverID, userID, "userevents", {}) } + if (getProcessVariable(serverID, userID, "userevents").dollprocessing == undefined) { getProcessVariable(serverID, userID, "userevents").dollprocessing = { stage: 0 } } + if (getProcessVariable(serverID, userID, "userevents").dollprocessing.doll_id == undefined) { getProcessVariable(serverID, userID, "userevents").dollprocessing.doll_id = getOption(serverID, userID, "dollvisorname") } + if (getProcessVariable(serverID, userID, "userevents").dollprocessing.existingbarcodelogged == undefined) { getProcessVariable(serverID, userID, "userevents").dollprocessing.existingbarcodelogged = !getWearable(serverID, userID).includes("cyberdoll_barcode"); } - let currclothes = getWearable(userID).filter((f) => (!getLockedWearable(userID).includes(f))); // These are the worn clothes + let currclothes = getWearable(serverID, userID).filter((f) => (!getLockedWearable(serverID, userID).includes(f))); // These are the worn clothes // Figure out the color of the wearer's current clothing. If none, choose black because black is sexy. wearablecolors.forEach((color) => { - if ((process.userevents[userID].dollprocessing.color == undefined) && getWearable(userID).some((clothing) => (clothing.search(color.toLowerCase()) > -1))) { - process.userevents[userID].dollprocessing.color = color.toLowerCase(); + if ((getProcessVariable(serverID, userID, "userevents").dollprocessing.color == undefined) && getWearable(serverID, userID).some((clothing) => (clothing.search(color.toLowerCase()) > -1))) { + getProcessVariable(serverID, userID, "userevents").dollprocessing.color = color.toLowerCase(); } }) - if (process.userevents[userID].dollprocessing.color == undefined) { process.userevents[userID].dollprocessing.color = "black" } - let droneclothes = [`catsuit_latex_${process.userevents[userID].dollprocessing.color}`, "cyberdoll_harness", "doll_heels", "cyberdoll_barcode"] - currclothes = getWearable(userID).filter((f) => (!getLockedWearable(userID).includes(f))).filter((f) => (!droneclothes.includes(f))); // These are the worn clothes, minus drone clothing + if (getProcessVariable(serverID, userID, "userevents").dollprocessing.color == undefined) { getProcessVariable(serverID, userID, "userevents").dollprocessing.color = "black" } + let droneclothes = [`catsuit_latex_${getProcessVariable(serverID, userID, "userevents").dollprocessing.color}`, "cyberdoll_harness", "doll_heels", "cyberdoll_barcode"] + currclothes = getWearable(serverID, userID).filter((f) => (!getLockedWearable(userID).includes(f))).filter((f) => (!droneclothes.includes(f))); // These are the worn clothes, minus drone clothing // get the user object, if it doesn't exist, go away let userobject = await process.client.users.fetch(userID); // The person in the processing terminal! - let targetobject = await process.client.users.fetch(getHeavy(userID).origbinder ?? userID); // The cruel person who threw this person in the terminal! + let targetobject = await process.client.users.fetch(getHeavy(serverID, userID).origbinder ?? userID); // The cruel person who threw this person in the terminal! // Something's wrong. - if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[userID])) { + if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[serverID][userID])) { return; } // Only update a max of once every 60 seconds. - if ((process.userevents[userID].dollprocessing.nextupdate ?? 0) < Date.now()) { - process.userevents[userID].dollprocessing.nextupdate = Date.now() + 60000; - //process.userevents[userID].dollprocessing.nextupdate = Date.now() + 3000; // TEST SPEED + if ((getProcessVariable(serverID, userID, "userevents").dollprocessing.nextupdate ?? 0) < Date.now()) { + getProcessVariable(serverID, userID, "userevents").dollprocessing.nextupdate = Date.now() + 60000; + //getProcessVariable(serverID, userID, "userevents").dollprocessing.nextupdate = Date.now() + 3000; // TEST SPEED } else { return }; @@ -65,6 +67,7 @@ let tick = async (userID, datain) => { let data = { textarray: "texts_eventfunctions", textdata: { + serverID: serverID, interactionuser: userobject, targetuser: targetobject, } @@ -76,17 +79,17 @@ let tick = async (userID, datain) => { if (currclothes.length > 0) { data.textdata.c1 = getWearableName(undefined, currclothes[0]), // wearable name data.removeclothing = true; - removeWearable(userID, currclothes[0]); + removeWearable(serverID, userID, currclothes[0]); // Taking off the clothes at the beginning! - if (process.userevents[userID].dollprocessing.stage == 0) { + if (getProcessVariable(serverID, userID, "userevents").dollprocessing.stage == 0) { data.stage1 = true; } // Singular step before applying restraints - else if (process.userevents[userID].dollprocessing.stage == 1) { + else if (getProcessVariable(serverID, userID, "userevents").dollprocessing.stage == 1) { data.stage2 = true; } // Applying restraints - else if (process.userevents[userID].dollprocessing.stage == 2) { + else if (getProcessVariable(serverID, userID, "userevents").dollprocessing.stage == 2) { data.stage3 = true; } // It is done - wow, such a non-compliant doll! @@ -94,21 +97,21 @@ let tick = async (userID, datain) => { data.stage4 = true; } // Send a message saying it stripped something off the wearer <3 - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } else { - let newclothes = getWearable(userID) // All Clothing, check for drone clothes + let newclothes = getWearable(serverID, userID) // All Clothing, check for drone clothes let equipped = false; droneclothes.forEach((d) => { - if (!process.userevents[userID].dollprocessing.existingbarcodelogged) { + if (!getProcessVariable(serverID, userID, "userevents").dollprocessing.existingbarcodelogged) { // Existing Barcode Detection And Messaging data.addclothing = true; data.existing_barcode = true; data.textdata.c1 = getWearableName(undefined, d); // wearable name - data.textdata.c2 = process.userevents[userID].dollprocessing.doll_id; - messageSendChannel(getText(data), process.recentmessages[userID]); + data.textdata.c2 = getProcessVariable(serverID, userID, "userevents").dollprocessing.doll_id; + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); equipped = true; - process.userevents[userID].dollprocessing.existingbarcodelogged = true; + getProcessVariable(serverID, userID, "userevents").dollprocessing.existingbarcodelogged = true; return; } else if (!newclothes.includes(d) && !equipped) { data.addclothing = true; @@ -119,8 +122,8 @@ let tick = async (userID, datain) => { data[d] = true; } data.textdata.c1 = getWearableName(undefined, d), // wearable name - assignWearable(userID, d); - messageSendChannel(getText(data), process.recentmessages[userID]) + assignWearable(serverID, userID, d); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) equipped = true; return; } @@ -128,112 +131,112 @@ let tick = async (userID, datain) => { if (equipped) { return } // Done applying clothes, advance to next stage. if (currclothes.length == 0) { - if (process.userevents[userID].dollprocessing.stage == 0) { - process.userevents[userID].dollprocessing.stage++; + if (getProcessVariable(serverID, userID, "userevents").dollprocessing.stage == 0) { + getProcessVariable(serverID, userID, "userevents").dollprocessing.stage++; data.donestripping = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) return; } - if (process.userevents[userID].dollprocessing.stage == 1) { - process.userevents[userID].dollprocessing.stage++; + if (getProcessVariable(serverID, userID, "userevents").dollprocessing.stage == 1) { + getProcessVariable(serverID, userID, "userevents").dollprocessing.stage++; } } // We are applying restraints if at a high enough stage! - if (process.userevents[userID].dollprocessing.stage == 2) { + if (getProcessVariable(serverID, userID, "userevents").dollprocessing.stage == 2) { data.applyingrestraints = true; let appliedrestraint = false; // Apply mittens if the doll is not wearing them. - if (!getMitten(userID) || (getMitten(userID) && (getMitten(userID).mittenname != "mittens_cyberdoll"))) { + if (!getMitten(serverID, userID) || (getMitten(serverID, userID) && (getMitten(serverID, userID).mittenname != "mittens_cyberdoll"))) { data.mitten = true; - if (getMitten(userID)) { - data.textdata.c1 = getMittenName(undefined, getMitten(userID).mittenname) ?? "mittens", // mitten name - assignMitten(userID, "mittens_cyberdoll", getMitten(userID).origbinder) + if (getMitten(serverID, userID)) { + data.textdata.c1 = getMittenName(undefined, getMitten(serverID, userID).mittenname) ?? "mittens", // mitten name + assignMitten(serverID, userID, "mittens_cyberdoll", getMitten(serverID, userID).origbinder) data.replace = true; appliedrestraint = true; } else { - assignMitten(userID, "mittens_cyberdoll", targetobject.id) + assignMitten(serverID, userID, "mittens_cyberdoll", targetobject.id) data.textdata.c1 = getMittenName(undefined, "mittens_cyberdoll") ?? "mittens", // mitten name data.add = true; appliedrestraint = true; } - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } // Apply chastity belt if doll is not wearing it - else if (!getChastity(userID) || (getChastity(userID) && (getChastity(userID).chastitytype != "belt_cyberdoll"))) { + else if (!getChastity(serverID, userID) || (getChastity(serverID, userID) && (getChastity(serverID, userID).chastitytype != "belt_cyberdoll"))) { data.chastitybelt = true; - if (getChastity(userID)) { - data.textdata.c1 = getChastityName(undefined, getChastity(userID).chastitytype) ?? "chastity belt", // mitten name - process.chastity[userID].chastitytype = "belt_cyberdoll" + if (getChastity(serverID, userID)) { + data.textdata.c1 = getChastityName(serverID, undefined, getChastity(serverID, userID).chastitytype) ?? "chastity belt", // mitten name + getChastity(serverID, userID).chastitytype = "belt_cyberdoll" data.replace = true; appliedrestraint = true; } else { - assignChastity(userID, targetobject.id, "belt_cyberdoll") - data.textdata.c1 = getChastityName(undefined, "belt_cyberdoll") ?? "chastity belt", // mitten name + assignChastity(serverID, userID, targetobject.id, "belt_cyberdoll") + data.textdata.c1 = getChastityName(serverID, undefined, "belt_cyberdoll") ?? "chastity belt", // mitten name data.add = true; appliedrestraint = true; } - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } // Apply chastity bra if doll is not wearing it - else if (!getChastityBra(userID) || (getChastityBra(userID) && (getChastityBra(userID).chastitytype != "bra_cyberdoll"))) { + else if (!getChastityBra(serverID, userID) || (getChastityBra(serverID, userID) && (getChastityBra(serverID, userID).chastitytype != "bra_cyberdoll"))) { data.chastitybra = true; - if (getChastityBra(userID)) { - data.textdata.c1 = getChastityBraName(undefined, getChastityBra(userID).chastitytype) ?? "chastity bra", // mitten name - process.chastitybra[userID].chastitytype = "bra_cyberdoll" + if (getChastityBra(serverID, userID)) { + data.textdata.c1 = getChastityBraName(serverID, undefined, getChastityBra(userID).chastitytype) ?? "chastity bra", // mitten name + getChastityBra(serverID, userID).chastitytype = "bra_cyberdoll" data.replace = true; appliedrestraint = true; } else { - assignChastityBra(userID, targetobject.id, "bra_cyberdoll") - data.textdata.c1 = getChastityBraName(undefined, "bra_cyberdoll") ?? "chastity bra", // mitten name + assignChastityBra(serverID, userID, targetobject.id, "bra_cyberdoll") + data.textdata.c1 = getChastityBraName(serverID, undefined, "bra_cyberdoll") ?? "chastity bra", // mitten name data.add = true; appliedrestraint = true; } - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } // Apply collar to the doll if it is not wearing it - else if (!getCollar(userID) || (getCollar(userID) && (getCollar(userID).collartype != "collar_cyberdoll"))) { + else if (!getCollar(serverID, userID) || (getCollar(serverID, userID) && (getCollar(serverID, userID).collartype != "collar_cyberdoll"))) { data.collar = true; - if (getCollar(userID)) { - data.textdata.c1 = getCollarName(undefined, getCollar(userID).collartype) ?? "collar", // mitten name - process.collar[userID].collartype = "collar_cyberdoll" + if (getCollar(serverID, userID)) { + data.textdata.c1 = getCollarName(serverID, undefined, getCollar(serverID, userID).collartype) ?? "collar", // mitten name + getCollar(serverID, userID).collartype = "collar_cyberdoll" data.replace = true; appliedrestraint = true; } else { - assignCollar(userID, targetobject.id, {}, false, "collar_cyberdoll") - data.textdata.c1 = getCollarName(undefined, "collar_cyberdoll") ?? "collar", // mitten name + assignCollar(serverID, userID, targetobject.id, {}, false, "collar_cyberdoll") + data.textdata.c1 = getCollarName(serverID, undefined, "collar_cyberdoll") ?? "collar", // mitten name data.add = true; appliedrestraint = true; } - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } // Apply doll visor to the doll if it is not wearing it - else if (!getHeadwear(userID).some((d) => DOLLVISORS.includes(d))) { + else if (!getHeadwear(serverID, userID).some((d) => DOLLVISORS.includes(d))) { data.headwear = true; - data.textdata.c1 = getHeadwearName(undefined, "doll_visor"), // mitten name - assignHeadwear(userID, "doll_visor", targetobject.id) + data.textdata.c1 = getHeadwearName(serverID, undefined, "doll_visor"), // mitten name + assignHeadwear(serverID, userID, "doll_visor", targetobject.id) data.add = true; appliedrestraint = true; - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } // We are FINALLY DONE! if (!appliedrestraint) { - process.userevents[userID].dollprocessing.stage++ + getProcessVariable(serverID, userID, "userevents").dollprocessing.stage++ data.done = true; - data.textdata.c2 = process.userevents[userID].dollprocessing.doll_id; - messageSendChannel(getText(data), process.recentmessages[userID]) + data.textdata.c2 = getProcessVariable(serverID, userID, "userevents").dollprocessing.doll_id; + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) return; } } // Yay we now have a new doll! It is such a good doll - if (process.userevents[userID].dollprocessing.stage == 3) { + if (getProcessVariable(serverID, userID, "userevents").dollprocessing.stage == 3) { data.processingcomplete = true; - delete process.userevents[userID].dollprocessing; - removeHeavy(userID, "doll_processing"); - messageSendChannel(getText(data), process.recentmessages[userID]) + delete getProcessVariable(serverID, userID, "userevents").dollprocessing; + removeHeavy(serverID, userID, "doll_processing"); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } } } diff --git a/eventfunctions/heavy/windupclockwork.js b/eventfunctions/heavy/windupclockwork.js index e6d4b100..48c04508 100644 --- a/eventfunctions/heavy/windupclockwork.js +++ b/eventfunctions/heavy/windupclockwork.js @@ -5,37 +5,37 @@ const { messageSendChannel } = require("../../functions/messagefunctions"); const { setUserVar } = require("../../functions/setters/config/setUserVar"); // Successful headpats will increase the windup on the wearer by 15 minutes, up to 3 hours. This is 1/12th of the charge, or 8.33%. -function headpatfunction(recipient, data) { - let newcharge = (getUserVar(recipient, "windupcharge") ?? 0.0) +function headpatfunction(serverID, recipient, data) { + let newcharge = (getUserVar(serverID, recipient, "windupcharge") ?? 0.0) if (data.returnedobject.hit) { if (newcharge == 0.0) { //messageSendChannel(`The headpat winds up a key...`, process.recentmessages[recipient]) } - newcharge = newcharge + ((15/180) * getOption(recipient, "headpatrestraintpotency")) + newcharge = newcharge + ((15/180) * getOption(serverID, recipient, "headpatrestraintpotency")) if (data.returnedobject.crit) { - newcharge = newcharge + ((15/180) * getOption(recipient, "headpatrestraintpotency")) // double charge for crits + newcharge = newcharge + ((15/180) * getOption(serverID, recipient, "headpatrestraintpotency")) // double charge for crits } } - setUserVar(recipient, "windupcharge", newcharge); + setUserVar(serverID, recipient, "windupcharge", newcharge); } // Update battery -async function tick(userid, datain) { +async function tick(serverID, userid, datain) { let newcharge = 0.0 - if (getUserVar(userid, "windupcharge")) { + if (getUserVar(serverID, userid, "windupcharge")) { newcharge = getUserVar(userid, "windupcharge") - (1/180) * (getBotOption("bot-timetickrate") / 60000) } - if (getUserVar(userid, "windupcharge") > 1.0) { + if (getUserVar(serverID, userid, "windupcharge") > 1.0) { newcharge = 1.0 } - if (getUserVar(userid, "windupcharge") < 0.0) { + if (getUserVar(serverID, userid, "windupcharge") < 0.0) { newcharge = 0.0 } - if (getUserVar(userid, "windupcharge") > 0.0 && (newcharge <= 0.0)) { + if (getUserVar(serverID, userid, "windupcharge") > 0.0 && (newcharge <= 0.0)) { // They JUST ran out of charge... - messageSendChannel(`<@${userid}> becomes dormant as the clockwork key stops ticking...`, process.recentmessages[userid]) + messageSendChannel(`<@${userid}> becomes dormant as the clockwork key stops ticking...`, process.recentmessages[serverID][userid]) } - setUserVar(userid, "windupcharge", newcharge); + setUserVar(serverID, userid, "windupcharge", newcharge); } exports.tick = tick; diff --git a/eventfunctions/toys/plug_motionsensitive.js b/eventfunctions/toys/plug_motionsensitive.js index 2616490a..596cf3d9 100644 --- a/eventfunctions/toys/plug_motionsensitive.js +++ b/eventfunctions/toys/plug_motionsensitive.js @@ -3,25 +3,25 @@ const { getUserVar } = require("../../functions/getters/config/getUserVar"); const { messageSendChannel } = require("../../functions/messagefunctions"); const { setUserVar } = require("../../functions/setters/config/setUserVar"); -function msgfunction(userid, data) { +function msgfunction(serverID, userid, data) { if (getUserVar(userid, "motionplugtime") == undefined) { - if (process.recentmessages[userid]) { + if (process.recentmessages[serverID] && process.recentmessages[serverID][userid]) { try { - messageSendChannel(`<@${userid}>'s movement turns on ${getPronouns(userid, "possessiveDeterminer")} Motion Sensitive Plug!`, process.recentmessages[userid]) + messageSendChannel(`<@${userid}>'s movement turns on ${getPronouns(serverID, userid, "possessiveDeterminer")} Motion Sensitive Plug!`, process.recentmessages[serverID][userid]) } catch (err) { console.log(err); } } } - setUserVar(userid, "motionplugtime", Date.now() + 180000) + setUserVar(serverID, userid, "motionplugtime", Date.now() + 180000) return; } -async function tick(userID) { - if (getUserVar(userID, "motionplugtime") < Date.now()) { +async function tick(serverID, userID) { + if (getUserVar(serverID, userID, "motionplugtime") < Date.now()) { console.log(`Ending Motion Sensitive plug for ${userID}`) - setUserVar(userID, "motionplugtime", undefined) + setUserVar(serverID, userID, "motionplugtime", undefined) } } diff --git a/eventfunctions/toys/vibe_headpatbattery.js b/eventfunctions/toys/vibe_headpatbattery.js index 0a68ef83..9fad9fac 100644 --- a/eventfunctions/toys/vibe_headpatbattery.js +++ b/eventfunctions/toys/vibe_headpatbattery.js @@ -6,35 +6,35 @@ const { setUserVar } = require("../../functions/setters/config/setUserVar"); const { getTextGeneric } = require("../../functions/textfunctions"); // Successful headpats will recharge the battery on the recipient's vibe by 5%. Each minute drains 2%. -function headpatfunction(recipient, data) { - let newcharge = (getUserVar(recipient, "headpatvibecharge") ?? 0.0) +function headpatfunction(serverID, recipient, data) { + let newcharge = (getUserVar(serverID, recipient, "headpatvibecharge") ?? 0.0) if (data.returnedobject.hit) { if (newcharge == 0.0) { setTimeout(() => { - messageSendChannel(`The headpat gives enough charge to start up a vibrator...`, process.recentmessages[recipient]) + messageSendChannel(`The headpat gives enough charge to start up a vibrator...`, process.recentmessages[serverID][recipient]) }, 3000) } - newcharge = newcharge + (0.05 * getOption(recipient, "headpatrestraintpotency")) + newcharge = newcharge + (0.05 * getOption(serverID, recipient, "headpatrestraintpotency")) if (data.returnedobject.crit) { - newcharge = newcharge + (0.05 * getOption(recipient, "headpatrestraintpotency")) // double charge for crits + newcharge = newcharge + (0.05 * getOption(serverID, recipient, "headpatrestraintpotency")) // double charge for crits } } - setUserVar(recipient, "headpatvibecharge", newcharge); + setUserVar(serverID, recipient, "headpatvibecharge", newcharge); } // Update battery -async function tick(userid) { +async function tick(serverID, userid) { let newcharge = 0.0 - if (getUserVar(userid, "headpatvibecharge")) { - newcharge = getUserVar(userid, "headpatvibecharge") - 0.02 * (getBotOption("bot-timetickrate") / 60000) + if (getUserVar(serverID, userid, "headpatvibecharge")) { + newcharge = getUserVar(serverID, userid, "headpatvibecharge") - 0.02 * (getBotOption("bot-timetickrate") / 60000) } - if (getUserVar(userid, "headpatvibecharge") > 1.0) { + if (getUserVar(serverID, userid, "headpatvibecharge") > 1.0) { newcharge = 1.0 } - if (getUserVar(userid, "headpatvibecharge") < 0.0) { + if (getUserVar(serverID, userid, "headpatvibecharge") < 0.0) { newcharge = 0.0 } - setUserVar(userid, "headpatvibecharge", newcharge); + setUserVar(serverID, userid, "headpatvibecharge", newcharge); } exports.tick = tick; diff --git a/eventfunctions/toys/vibe_polite.js b/eventfunctions/toys/vibe_polite.js index 94f7cbe3..3e77561e 100644 --- a/eventfunctions/toys/vibe_polite.js +++ b/eventfunctions/toys/vibe_polite.js @@ -2,7 +2,7 @@ const { getUserVar } = require("../../functions/getters/config/getUserVar"); const { messageSendChannel } = require("../../functions/messagefunctions"); const { setUserVar } = require("../../functions/setters/config/setUserVar"); -function msgfunction(userid, data) { +function msgfunction(serverID, userid, data) { const honorifictitles = [ // Oh god its hard to type these without caps "miss", @@ -54,25 +54,25 @@ function msgfunction(userid, data) { // They were polite, make them horny for 3 minutes. // This will be scaled HIGHLY over on the vibe side. // If they have a politesubvibe going and its undefined, then send a message - if (getUserVar(userid, "politeSubVibeTime") == undefined) { - if (process.recentmessages[userid]) { + if (getUserVar(serverID, userid, "politeSubVibeTime") == undefined) { + if (process.recentmessages[serverID] && process.recentmessages[serverID][userid]) { try { - messageSendChannel(`<@${userid}>'s Polite Vibe turns on as the honorific is spoken!`, process.recentmessages[userid]) + messageSendChannel(`<@${userid}>'s Polite Vibe turns on as the honorific is spoken!`, process.recentmessages[serverID][userid]) } catch (err) { console.log(err); } } } - setUserVar(userid, "politeSubVibeTime", Date.now() + 180000) + setUserVar(serverID, userid, "politeSubVibeTime", Date.now() + 180000) return; } } -async function tick(userID) { - if (getUserVar(userID, "politeSubVibeTime") < Date.now()) { +async function tick(serverID, userID) { + if (getUserVar(serverID, userID, "politeSubVibeTime") < Date.now()) { console.log(`Ending polite vibe for ${userID}`) - setUserVar(userID, "politeSubVibeTime", undefined) + setUserVar(serverID, userID, "politeSubVibeTime", undefined) } } diff --git a/eventfunctions/toys/vibe_reverb.js b/eventfunctions/toys/vibe_reverb.js index 8d582814..b1f863c8 100644 --- a/eventfunctions/toys/vibe_reverb.js +++ b/eventfunctions/toys/vibe_reverb.js @@ -11,7 +11,7 @@ const OOC = new RegExp(/^[*][^*].*[^*][*]$/) const LOUD = new RegExp(/(\b[A-Z]['A-Z]+|\b[A-Z]\b)/) const BOLD = new RegExp(/([\*][\*])/) -function msgfunction(userid, data) { +function msgfunction(serverID, userid, data) { // Catch Message, and Check for OOC, Whispers, or Shouting let intensity = volumetest(data.msgcontent) @@ -21,42 +21,42 @@ function msgfunction(userid, data) { if (intensity == 0) return; //Update End Time and Increment Vibe Intensity - if(getUserVar(userid, "reverbEndTime") == undefined) { + if(getUserVar(serverID, userid, "reverbEndTime") == undefined) { // Set initial 3 minute timer - setUserVar(userid, "reverbEndTime", Date.now() + initial_timespan); + setUserVar(serverID, userid, "reverbEndTime", Date.now() + initial_timespan); } else { // Increment reverbEndTime by 15s x intensity per Message - setUserVar(userid, "reverbEndTime", getUserVar(userid, "reverbEndTime") + (timespan_inc * intensity)); + setUserVar(serverID, userid, "reverbEndTime", getUserVar(serverID, userid, "reverbEndTime") + (timespan_inc * intensity)); } // Declare Initial reverbDecayTime - if(getUserVar(userid, "reverbDecayTime") == undefined) { - setUserVar(userid, "reverbDecayTime", Date.now() + (decay_period * intensity)); + if(getUserVar(serverID, userid, "reverbDecayTime") == undefined) { + setUserVar(serverID, userid, "reverbDecayTime", Date.now() + (decay_period * intensity)); } else { // Override Next Decay time with a new value based on the intensity if it is longer than the current delay - setUserVar(userid, "reverbDecayTime", Math.max(Date.now() + (decay_period * intensity), getUserVar(userid, "reverbDecayTime"))); + setUserVar(serverID, userid, "reverbDecayTime", Math.max(Date.now() + (decay_period * intensity), getUserVar(serverID, userid, "reverbDecayTime"))); } // Increment reverbVibeIntensity based on intensity of message text - setUserVar(userid, "reverbVibeIntensity", Math.min(getUserVar(userid, "reverbVibeIntensity") + (1 * intensity), 20)); + setUserVar(serverID, userid, "reverbVibeIntensity", Math.min(getUserVar(serverID, userid, "reverbVibeIntensity") + (1 * intensity), 20)); return; } -async function tick(userID) { +async function tick(serverID, userID) { // Decay Intensity every Decay Period until 0 - if (getUserVar(userID, "reverbDecayTime") < Date.now() && getUserVar(userID, "reverbDecayTime") != undefined) + if (getUserVar(serverID, userID, "reverbDecayTime") < Date.now() && getUserVar(serverID, userID, "reverbDecayTime") != undefined) { - setUserVar(userID, "reverbVibeIntensity", Math.max(getUserVar(userID, "reverbVibeIntensity") - 1, 0)); - setUserVar(userID, "reverbDecayTime", Date.now() + decay_period); + setUserVar(serverID, userID, "reverbVibeIntensity", Math.max(getUserVar(serverID, userID, "reverbVibeIntensity") - 1, 0)); + setUserVar(serverID, userID, "reverbDecayTime", Date.now() + decay_period); } // Clear Values When Vibe Stops - if (getUserVar(userID, "reverbEndTime") < Date.now() && getUserVar(userID, "reverbVibeIntensity") == 0) { + if (getUserVar(serverID, userID, "reverbEndTime") < Date.now() && getUserVar(serverID, userID, "reverbVibeIntensity") == 0) { console.log(`${userID}'s Reverb Vibe has stopped`) - setUserVar(userID, "reverbEndTime", undefined) - setUserVar(userID, "reverbDecayTime", undefined) + setUserVar(serverID, userID, "reverbEndTime", undefined) + setUserVar(serverID, userID, "reverbDecayTime", undefined) } } From 7aa626ca88546b457a98a20ec41558ea4a70562d Mon Sep 17 00:00:00 2001 From: Enraa Date: Sun, 21 Jun 2026 21:29:07 -0700 Subject: [PATCH 33/44] consent now guild ID specific It made no sense to make that global lol --- commands/chastity.js | 59 ++++++++++++----------- functions/getters/config/getConsent.js | 10 ++-- functions/interactivefunctions.js | 2 +- functions/setters/config/assignConsent.js | 8 ++- index.js | 2 +- 5 files changed, 43 insertions(+), 38 deletions(-) diff --git a/commands/chastity.js b/commands/chastity.js index 2969d9b4..3695b303 100644 --- a/commands/chastity.js +++ b/commands/chastity.js @@ -39,7 +39,7 @@ module.exports = { if (matches.length == 0) { matches = autocompletes; } - let tags = getUserTags(chosenuserid); + let tags = getUserTags(interaction.guildId, chosenuserid); let newsorted = []; matches.forEach((f) => { let tagged = false; @@ -66,11 +66,11 @@ module.exports = { let chastitykeyholder = interaction.user; let braorbelt = interaction.options.getString("braorbelt") ?? "chastitybelt"; // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(chastityuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, chastityuser.id)?.mainconsent) { await handleConsent(interaction, chastityuser.id); return; } - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } @@ -80,27 +80,28 @@ module.exports = { let data = { textarray: "texts_chastity", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: chastityuser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type - c2: (braorbelt == "chastitybelt" ? getChastityName(chastityuser.id, bondagetype) : getChastityBraName(chastityuser.id, bondagetype)) ?? (braorbelt == "chastitybelt" ? "chastity belt" : "chastity bra"), - c3: `<@${braorbelt == "chastitybelt" ? getChastity(chastityuser.id)?.keyholder : getChastityBra(chastityuser.id)?.keyholder}>` + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type + c2: (braorbelt == "chastitybelt" ? getChastityName(interaction.guildId, chastityuser.id, bondagetype) : getChastityBraName(interaction.guildId, chastityuser.id, bondagetype)) ?? (braorbelt == "chastitybelt" ? "chastity belt" : "chastity bra"), + c3: `<@${braorbelt == "chastitybelt" ? getChastity(interaction.guildId, chastityuser.id)?.keyholder : getChastityBra(chastityuser.id)?.keyholder}>` }, }; if (braorbelt == "chastitybelt") { - if (bondagetype && !getChastityName(interaction.user.id, bondagetype)) { + if (bondagetype && !getChastityName(interaction.guildId, interaction.user.id, bondagetype)) { bondagetype = undefined; // Just delete it, we got something invalid lol } } else { - if (bondagetype && !getChastityBraName(interaction.user.id, bondagetype)) { + if (bondagetype && !getChastityBraName(interaction.guildId, interaction.user.id, bondagetype)) { bondagetype = undefined; // Just delete it, we got something invalid lol } } let blocked = false; if (bondagetype) { - let tags = getUserTags(chastityuser.id); + let tags = getUserTags(interaction.guildId, chastityuser.id); let i = getBaseChastity(bondagetype) tags.forEach((t) => { if (i && i.tags && i.tags.includes(t) && (chastityuser != interaction.user)) { @@ -134,7 +135,7 @@ module.exports = { if (braorbelt == "chastitybelt") { // They are trying to put on a chastity belt. // Check if the wearer is in an armbinder - if they are, block them. - if (!getHeavyBound(interaction.user.id, chastityuser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, chastityuser.id)) { data.heavy = true; if (getChastity(chastityuser.id)) { // User is in some form of heavy bondage and already has a chastity belt @@ -145,10 +146,10 @@ module.exports = { data.nochastity = true; interaction.reply(getText(data)); } - } else if (getChastity(chastityuser.id)?.keyholder) { + } else if (getChastity(interaction.guildId, chastityuser.id)?.keyholder) { data.noheavy = true; data.chastity = true; - if (getChastity(chastityuser.id)?.keyholder == interaction.user.id) { + if (getChastity(interaction.guildId, chastityuser.id)?.keyholder == interaction.user.id) { // User tries to lock another belt on target and they have the key data.key_self = true; interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); @@ -162,8 +163,8 @@ module.exports = { data.nochastity = true; if (chastitykeyholder) { await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleMajorRestraint(interaction.user, chastityuser, "chastity", bondagetype ?? "belt_silver").then(async () => { - await handleExtremeRestraint(interaction.user, chastityuser, "chastity", bondagetype ?? "belt_silver").then( + await handleMajorRestraint(interaction.guildId, interaction.user, chastityuser, "chastity", bondagetype ?? "belt_silver").then(async () => { + await handleExtremeRestraint(interaction.guildId, interaction.user, chastityuser, "chastity", bondagetype ?? "belt_silver").then( async (success) => { await interaction.followUp({ content: `Equipping ${bondagetype ? getBaseChastity(bondagetype)?.name : "Standard Chastity Belt"}`, flags: MessageFlags.Ephemeral }) let followupmessage = await generateExtraConfig(interaction, chastityuser.id, bondagetype, true) @@ -171,7 +172,7 @@ module.exports = { await interaction.followUp(followupmessage) }; await interaction.followUp(getText(data)); - assignChastity(chastityuser.id, chastitykeyholder.id, bondagetype); + assignChastity(interaction.guildId, chastityuser.id, chastitykeyholder.id, bondagetype); }, async (reject) => { let nomessage = `${chastityuser} rejected the ${bondagetype ? getBaseChastity(bondagetype).name : "chastity belt"}.`; @@ -182,7 +183,7 @@ module.exports = { nomessage = `Something went wrong - Submit a bug report!`; } if (reject == "NoDM") { - nomessage = `Something went wrong sending a DM to ${chastityuser}, or ${getPronouns(chastityuser.id, "subject")} ${getPronouns(chastityuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; + nomessage = `Something went wrong sending a DM to ${chastityuser}, or ${getPronouns(interaction.guildId, chastityuser.id, "subject")} ${getPronouns(interaction.guildId, chastityuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; } await interaction.followUp({ content: nomessage }); }, @@ -197,7 +198,7 @@ module.exports = { nomessage = `Something went wrong - Submit a bug report!`; } if (reject == "NoDM") { - nomessage = `Something went wrong sending a DM to ${chastityuser}, or ${getPronouns(chastityuser.id, "subject")} ${getPronouns(chastityuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; + nomessage = `Something went wrong sending a DM to ${chastityuser}, or ${getPronouns(interaction.guildId, chastityuser.id, "subject")} ${getPronouns(interaction.guildId, chastityuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; } if (reject == "Cooldown") { nomessage = `${chastityuser} has blocked major bondage restraints for now. Please try again in the future.`; @@ -207,15 +208,15 @@ module.exports = { } else { // Left it unlocked ---- This is currently an unused data path as there will ALWAYS be a keyholder. interaction.reply(`${interaction.user} puts a chastity belt on and clicks a tiny lock on it before stashing the key for safekeeping!`); - assignChastity(interaction.user.id, interaction.user.id); + assignChastity(interaction.guildId, interaction.user.id, interaction.user.id); } } } else { // They are trying to put on a chastity bra. // Check if the wearer is in an armbinder - if they are, block them. - if (!getHeavyBound(interaction.user.id, chastityuser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, chastityuser.id)) { data.heavy = true; - if (getChastityBra(chastityuser.id)) { + if (getChastityBra(interaction.guildId, chastityuser.id)) { // User is in some form of heavy bondage and already has a chastity belt data.chastity = true; interaction.reply(getText(data)); @@ -224,10 +225,10 @@ module.exports = { data.nochastity = true; interaction.reply(getText(data)); } - } else if (getChastityBra(chastityuser.id)?.keyholder) { + } else if (getChastityBra(interaction.guildId, chastityuser.id)?.keyholder) { data.noheavy = true; data.chastity = true; - if (getChastityBra(chastityuser.id)?.keyholder == interaction.user.id) { + if (getChastityBra(interaction.guildId, chastityuser.id)?.keyholder == interaction.user.id) { // User tries to lock another belt on themselves and they have the key data.key_self = true; interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); @@ -241,8 +242,8 @@ module.exports = { data.nochastity = true; if (chastitykeyholder) { await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleMajorRestraint(interaction.user, chastityuser, "chastitybra", bondagetype ?? "bra_silver").then(async () => { - await handleExtremeRestraint(interaction.user, chastityuser, "chastitybra", bondagetype ?? "bra_silver").then( + await handleMajorRestraint(interaction.guildId, interaction.user, chastityuser, "chastitybra", bondagetype ?? "bra_silver").then(async () => { + await handleExtremeRestraint(interaction.guildId, interaction.user, chastityuser, "chastitybra", bondagetype ?? "bra_silver").then( async (success) => { await interaction.followUp({ content: `Equipping ${bondagetype ? getBaseChastity(bondagetype)?.name : "Standard Chastity Bra"}`, flags: MessageFlags.Ephemeral }) let followupmessage = await generateExtraConfig(interaction, chastityuser.id, bondagetype, true) @@ -250,7 +251,7 @@ module.exports = { await interaction.followUp(followupmessage) }; await interaction.followUp(getText(data)); - assignChastityBra(chastityuser.id, chastitykeyholder.id, bondagetype); + assignChastityBra(interaction.guildId, chastityuser.id, chastitykeyholder.id, bondagetype); }, async (reject) => { let nomessage = `${chastityuser} rejected the ${bondagetype ? getBaseChastity(bondagetype).name : "chastity bra"}.`; @@ -261,7 +262,7 @@ module.exports = { nomessage = `Something went wrong - Submit a bug report!`; } if (reject == "NoDM") { - nomessage = `Something went wrong sending a DM to ${chastityuser}, or ${getPronouns(chastityuser.id, "subject")} ${getPronouns(chastityuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; + nomessage = `Something went wrong sending a DM to ${chastityuser}, or ${getPronouns(interaction.guildId, chastityuser.id, "subject")} ${getPronouns(interaction.guildId, chastityuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; } await interaction.followUp({ content: nomessage }); }, @@ -276,7 +277,7 @@ module.exports = { nomessage = `Something went wrong - Submit a bug report!`; } if (reject == "NoDM") { - nomessage = `Something went wrong sending a DM to ${chastityuser}, or ${getPronouns(chastityuser.id, "subject")} ${getPronouns(chastityuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; + nomessage = `Something went wrong sending a DM to ${chastityuser}, or ${getPronouns(interaction.guildId, chastityuser.id, "subject")} ${getPronouns(interaction.guildId, chastityuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; } if (reject == "Cooldown") { nomessage = `${chastityuser} has blocked major bondage restraints for now. Please try again in the future.`; @@ -286,7 +287,7 @@ module.exports = { } else { // Left it unlocked ---- This is currently an unused data path as there will ALWAYS be a keyholder. interaction.reply(`${interaction.user} puts a chastity bra on and clicks a tiny lock on it before stashing the key for safekeeping!`); - assignChastityBra(interaction.user.id, interaction.user.id); + assignChastityBra(interaction.guildId, interaction.user.id, interaction.user.id); } } } @@ -295,7 +296,7 @@ module.exports = { } }, async help(userid, page) { - let restrictedtext = (getChastity(userid) || getChastityBra(userid)) ? `***You may be unable to use this command due to worn chastity***\n` : "" + let restrictedtext = (getChastity(interaction.guildId, userid) || getChastityBra(interaction.guildId, userid)) ? `***You may be unable to use this command due to worn chastity***\n` : "" let overviewtext = `## Chastity ### Usage: /chastity (keyholder) (braorbelt) (type) ### Remove: /unchastity (user) diff --git a/functions/getters/config/getConsent.js b/functions/getters/config/getConsent.js index 41ef29bc..fc9e0cd5 100644 --- a/functions/getters/config/getConsent.js +++ b/functions/getters/config/getConsent.js @@ -1,19 +1,19 @@ +const { getProcessVariable } = require("./getProcessVariable"); + /*********** * Get a user's consents * + * - (server id) serverID - The server this is running on! * - (user id) user - The user we need to check consent for * --- * ##### Returns an object with the following properties: * - mainconsent: True if they clicked the Accept button ***********/ -function getConsent(user) { - if (process.consented == undefined) { - process.consented = {}; - } +function getConsent(serverID, user) { if (user === process.client.user.id) { return { mainconsent: true }; // Lol, trying to gag us. } - return process.consented[user]; + return getProcessVariable(serverID, user, "consented"); }; exports.getConsent = getConsent; \ No newline at end of file diff --git a/functions/interactivefunctions.js b/functions/interactivefunctions.js index eac7597d..0b3a1acb 100644 --- a/functions/interactivefunctions.js +++ b/functions/interactivefunctions.js @@ -74,7 +74,7 @@ const handleConsent = async (interaction, user) => { try { const confirmation = await response.resource.message.awaitMessageComponent({ filter: collectorFilter, time: 300_000 }); console.log(confirmation); - assignConsent(testusertarget); + assignConsent(interaction.guildID, testusertarget); await interaction.editReply({ content: `Consent form agreed to by <@${testusertarget}>! Please re-run the command to tie!`, components: [] }); } catch (err) { console.log(err); diff --git a/functions/setters/config/assignConsent.js b/functions/setters/config/assignConsent.js index a5047b05..834294dd 100644 --- a/functions/setters/config/assignConsent.js +++ b/functions/setters/config/assignConsent.js @@ -4,15 +4,19 @@ const { markForSave } = require("../../other/markForSave"); * Assigns a main consent type to the user * ### This should ONLY be called ***after*** accepting it when prompted!!! * + * - (server id) serverID - The server this is running on. * - (user id) user - The person accepting consent * --- * ##### *No return value* *********/ -function assignConsent (user) { +function assignConsent (serverID, user) { if (process.consented == undefined) { process.consented = {}; } - process.consented[user] = { mainconsent: true }; + if (process.consented[serverID] == undefined) { + process.consented[serverID] = {}; + } + process.consented[serverID][user] = { mainconsent: true }; markForSave("consented"); }; diff --git a/index.js b/index.js index d714e0df..e26645d0 100644 --- a/index.js +++ b/index.js @@ -89,7 +89,7 @@ let processdatatoload = [ { textname: "heavyusers.txt", processvar: "heavy", default: {}, hasusers: true }, { textname: "pronounsusers.txt", processvar: "pronouns", default: {}, hasusers: true }, { textname: "usersdata.txt", processvar: "usercontext", default: {}, hasusers: true }, - { textname: "consentusers.txt", processvar: "consented", default: {} }, + { textname: "consentusers.txt", processvar: "consented", default: {}, hasusers: true }, { textname: "corsetusers.txt", processvar: "corset", default: {}, hasusers: true }, { textname: "arousal.txt", processvar: "arousal", default: {}, hasusers: true }, { textname: "headwearusers.txt", processvar: "headwear", default: {}, hasusers: true }, From b801e38b89acd8610e278e114db6ccca738db6cf Mon Sep 17 00:00:00 2001 From: Enraa Date: Sun, 21 Jun 2026 23:57:50 -0700 Subject: [PATCH 34/44] commands plz --- commands/collar.js | 63 +++++++++++------------------ commands/config.js | 42 ++++++++++--------- commands/corset.js | 99 +++++++++++++++++++++++---------------------- commands/drone.js | 7 ++-- commands/gag.js | 57 +++++++++++++------------- commands/headpat.js | 11 ++--- commands/heavy.js | 35 ++++++++-------- commands/inspect.js | 6 +-- commands/item.js | 28 ++++++------- 9 files changed, 169 insertions(+), 179 deletions(-) diff --git a/commands/collar.js b/commands/collar.js index a878ab32..6b0eaf29 100644 --- a/commands/collar.js +++ b/commands/collar.js @@ -31,7 +31,7 @@ module.exports = { if (matches.length == 0) { matches = autocompletes; } - let tags = getUserTags(interaction.user.id); + let tags = getUserTags(interaction.guildId, interaction.user.id); let newsorted = []; matches.forEach((f) => { let tagged = false; @@ -55,38 +55,27 @@ module.exports = { async execute(interaction) { try { // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } - //let collarkeyholder = interaction.options.getUser("keyholder") ?? interaction.user; let collarselected = interaction.options.getString("type"); - //let freeuse = interaction.options.getBoolean("freeuse"); - - // Check if they have free use enabled and it's allowed - // If not, tell them to strongly consider what they're doing and review /config - //if (freeuse && getOption(interaction.user.id, "publicaccess") != "enabled") { - // await interaction.reply({ - // content: `You have not enabled Free Use. **Please strongly consider what you are doing.**\n\nFree use access will allow ***anyone*** to utilize mittens, chastity, hoods and heavy bondage on you. **You will be unable to say no to specific restraints or specific people by design.**\n\nYou should assume that you *will* become helpless and stuck with this option, including becoming unable to take off the collar. Only enable it if you understand what you're doing. If you do, this can be adjusted in **/config**.`, - // flags: MessageFlags.Ephemeral, - // }); - // return; - //} // Build data tree: let data = { textarray: "texts_collar", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: interaction.options.getUser("keyholder") ? interaction.options.getUser("keyholder") : interaction.user, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type - c2: getCollarName(interaction.user.id, getCollar(interaction.user.id)?.collartype) ?? "collar" + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type + c2: getCollarName(interaction.guildId, interaction.user.id, getCollar(interaction.guildId, interaction.user.id)?.collartype) ?? "collar" }, }; - if (!getHeavyBound(interaction.user.id, interaction.user.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, interaction.user.id)) { data.heavy = true; - if (getCollar(interaction.user.id)) { + if (getCollar(interaction.guildId, interaction.user.id)) { data.collar = true; await interaction.reply(getText(data)); return; @@ -96,7 +85,7 @@ module.exports = { return; } } - if (getCollar(interaction.user.id)) { + if (getCollar(interaction.guildId, interaction.user.id)) { data.noheavy = true; data.alreadycollared = true; await interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); @@ -107,13 +96,6 @@ module.exports = { process.recentinteractions[interaction.user.id] = interaction; await interaction.showModal(collarPermModal(interaction, interaction.user, false, collarselected)); - /*if (collarkeyholder && collarkeyholder.id != undefined) { - //interaction.deferReply(); - await interaction.showModal(collarPermModal(interaction, interaction.user, false, collarselected)); - } else { - //interaction.deferReply(); - await interaction.showModal(collarPermModal(interaction, interaction.user, false, collarselected)); - }*/ } catch (err) { console.log(err); } @@ -137,23 +119,24 @@ module.exports = { let data = { textarray: "texts_collar", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: await interaction.client.users.fetch(collarkeyholder), // To fetch the target user object - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type - c2: getCollarName(interaction.user.id, choice_collartype) ?? "collar", + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type + c2: getCollarName(interaction.guildId, interaction.user.id, choice_collartype) ?? "collar", }, }; - if (!getHeavyBound(interaction.user.id, interaction.user.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, interaction.user.id)) { data.heavy = true; - if (getCollar(interaction.user.id)) { + if (getCollar(interaction.guildId, interaction.user.id)) { data.collar = true; interaction.reply(getText(data)); } else { data.nocollar = true; interaction.reply(getText(data)); } - } else if (getCollar(interaction.user.id)) { + } else if (getCollar(interaction.guildId, interaction.user.id)) { // This should never happen, because we find out they have a collar on before the modal. data.noheavy = true; data.alreadycollared = true; @@ -175,11 +158,11 @@ module.exports = { else {*/ interaction.reply(getText(data)); //} - assignCollar(interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, true, choice_collartype); + assignCollar(interaction.guildId, interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, true, choice_collartype); } else { data.nonamedcollar = true; interaction.reply(getText(data)); - assignCollar(interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, true); + assignCollar(interaction.guildId, interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, true); } } else { data.freeuse = true; @@ -187,11 +170,11 @@ module.exports = { // Custom named collar declared data.namedcollar = true; interaction.reply(getText(data)); - assignCollar(interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, false, choice_collartype); + assignCollar(interaction.guildId, interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, false, choice_collartype); } else { data.nonamedcollar = true; interaction.reply(getText(data)); - assignCollar(interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, false); + assignCollar(interaction.guildId, interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, false); } } } else if (collarkeyholder != interaction.user.id) { @@ -202,11 +185,11 @@ module.exports = { // Custom named collar declared data.namedcollar = true; interaction.reply(getText(data)); - assignCollar(interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, true, choice_collartype); + assignCollar(interaction.guildId, interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, true, choice_collartype); } else { data.nonamedcollar = true; interaction.reply(getText(data)); - assignCollar(interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, true); + assignCollar(interaction.guildId, interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, true); } } else { data.freeuse = true; @@ -214,11 +197,11 @@ module.exports = { // Custom named collar declared data.namedcollar = true; interaction.reply(getText(data)); - assignCollar(interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, false, choice_collartype); + assignCollar(interaction.guildId, interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, false, choice_collartype); } else { data.nonamedcollar = true; interaction.reply(getText(data)); - assignCollar(interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, false); + assignCollar(interaction.guildId, interaction.user.id, collarkeyholder, { mitten: choice_mitten, chastity: choice_chastity, heavy: choice_heavy, mask: choice_mask }, false); } } } @@ -228,7 +211,7 @@ module.exports = { } }, async help(userid, page) { - let restrictedtext = (getCollar(userid) && !canAccessCollar(userid, userid, true).access) ? `***You cannot unlock your collar currently***\n` : "" + let restrictedtext = (getCollar(interaction.guildId, userid) && !canAccessCollar(interaction.guildId, userid, userid, true).access) ? `***You cannot unlock your collar currently***\n` : "" let overviewtext = `## Collar ### Usage: /collar (keyholder) (freeuse) (type) ### Remove: /uncollar (user) diff --git a/commands/config.js b/commands/config.js index df242e30..35c823cd 100644 --- a/commands/config.js +++ b/commands/config.js @@ -12,9 +12,11 @@ const { createWebhook } = require("../functions/setters/config/createWebhook.js" const { deleteWebhook } = require("../functions/setters/config/deleteWebhook.js"); const { leaveServerOptions } = require("../functions/setters/config/leaveServerOptions.js"); const { setOption } = require("../functions/setters/config/setOption.js"); +const { setBotOption } = require("../functions/setters/config/setBotOption.js"); const { configoptions } = require("../lists/configoptions.js"); const { initializeServerOptions } = require("../functions/other/initializeServerOptions.js"); const { markForSave } = require("../functions/other/markForSave.js"); +const { getProcessVariable } = require("../functions/getters/config/getProcessVariable.js"); module.exports = { data: new SlashCommandBuilder().setName("config").setDescription(`Configure settings...`), @@ -44,15 +46,15 @@ module.exports = { // We then find the current value and then increment it, resetting to 0 when out of range. // Then we assign it to setOption. This means that choices are chosen from top to bottom in a circle. let optionschoice = configoptions[optionparts[2]][optionparts[4]].choices.map((c) => c.value); - let newindex = optionschoice.indexOf(getOption(interaction.user.id, optionparts[4])) + 1; + let newindex = optionschoice.indexOf(getOption(interaction.guildId, interaction.user.id, optionparts[4])) + 1; if (newindex >= optionschoice.length) { newindex = 0; } - setOption(interaction.user.id, optionparts[4], optionschoice[newindex]); + setOption(interaction.guildId, interaction.user.id, optionparts[4], optionschoice[newindex]); // After doing so, run the NEW option's select_function. if (typeof configoptions[optionparts[2]][optionparts[4]].choices[newindex].select_function == "function") { - await configoptions[optionparts[2]][optionparts[4]].choices[newindex]["select_function"](interaction.user.id); + await configoptions[optionparts[2]][optionparts[4]].choices[newindex]["select_function"](interaction.guildId, interaction.user.id); } // Finally, reprompt the user, now with the new choice set. @@ -128,7 +130,7 @@ module.exports = { data.desctext = data.desctext.replace("CUSTOMTEXT", buttonpressed.customtext(interaction.guildId, interaction.user.id)); } if (typeof buttonpressed.placeholder == "function") { - data.placeholder = buttonpressed.placeholder(interaction.user.id); + data.placeholder = buttonpressed.placeholder(interaction.guildId, interaction.user.id); } if (!data.pagenum) { data.pagenum = 1 }; @@ -216,8 +218,8 @@ module.exports = { interaction.update(await generateConfigModal(interaction, optionparts[2], 1)); } else if (optionparts[1] == "pageoptrevoke") { // Revoke that CONSENT - if (process.consented[interaction.user.id]) { - delete process.consented[interaction.user.id]; + if (getProcessVariable(interaction.guildId, interaction.user.id)) { + delete process.consented[interaction.guildId][interaction.user.id]; markForSave("consented"); } // Finally, reprompt the user, now with the new choice set. @@ -252,7 +254,7 @@ module.exports = { let optionparts = interaction.customId.split("_"); if (optionparts[3] == "dollvisorname") { choiceinput = interaction.fields.getTextInputValue("choiceinput"); - setOption(interaction.user.id, optionparts[3], choiceinput.slice(0, 30)); + setOption(interaction.guildId, interaction.user.id, optionparts[3], choiceinput.slice(0, 30)); await interaction.reply({ content: `Updated your Doll Visor designation to ${choiceinput.slice(0, 30)}`, flags: MessageFlags.Ephemeral }); if (process.recentinteraction) { if (process.recentinteraction[interaction.user.id]?.timestamp + 895000 > performance.now()) { @@ -263,7 +265,7 @@ module.exports = { } if (optionparts[3] == "dronevisorname") { choiceinput = interaction.fields.getTextInputValue("choiceinput"); - setOption(interaction.user.id, optionparts[3], choiceinput.slice(0, 30)); + setOption(interaction.guildId, interaction.user.id, optionparts[3], choiceinput.slice(0, 30)); await interaction.reply({ content: `Updated your ⬔-Drone Visor designation to ${choiceinput.slice(0, 30)}`, flags: MessageFlags.Ephemeral }); if (process.recentinteraction) { if (process.recentinteraction[interaction.user.id]?.timestamp + 895000 > performance.now()) { @@ -279,7 +281,7 @@ module.exports = { punishwordsseparated.forEach((w) => { punishmentarr.push(w) }) - setOption(interaction.user.id, optionparts[3], punishmentarr); + setOption(interaction.guildId, interaction.user.id, optionparts[3], punishmentarr); await interaction.reply({ content: `Updated your punishment words to the following:\n- ${punishwordsseparated.join("\n- ")}`, flags: MessageFlags.Ephemeral }); if (process.recentinteraction) { if (process.recentinteraction[interaction.user.id]?.timestamp + 895000 > performance.now()) { @@ -290,7 +292,7 @@ module.exports = { } if (optionparts[3] == "engravedcollarname") { choiceinput = interaction.fields.getTextInputValue("choiceinput"); - setOption(interaction.user.id, optionparts[3], choiceinput.slice(0, 30)); + setOption(interaction.guildId, interaction.user.id, optionparts[3], choiceinput.slice(0, 30)); await interaction.reply({ content: `Updated your Engraved Collar tag to ${choiceinput.slice(0, 30)}`, flags: MessageFlags.Ephemeral }); if (process.recentinteraction) { if (process.recentinteraction[interaction.user.id]?.timestamp + 895000 > performance.now()) { @@ -301,7 +303,7 @@ module.exports = { } if (optionparts[3] == "deferentialgagsubject") { choiceinput = interaction.fields.getTextInputValue("choiceinput"); - setOption(interaction.user.id, optionparts[3], choiceinput.slice(0, 30)); + setOption(interaction.guildId, interaction.user.id, optionparts[3], choiceinput.slice(0, 30)); await interaction.reply({ content: `Updated your Deferential Gag subject to ${choiceinput.slice(0, 30)}`, flags: MessageFlags.Ephemeral }); if (process.recentinteraction) { if (process.recentinteraction[interaction.user.id]?.timestamp + 895000 > performance.now()) { @@ -317,7 +319,7 @@ module.exports = { punishwordsseparated.forEach((w) => { punishmentarr.push(w) }) - setOption(interaction.user.id, optionparts[3], punishmentarr); + setOption(interaction.guildId, interaction.user.id, optionparts[3], punishmentarr); await interaction.reply({ content: `Updated your Forbidden Gag words to the following:\n- ${punishwordsseparated.join("\n- ")}`, flags: MessageFlags.Ephemeral }); if (process.recentinteraction) { if (process.recentinteraction[interaction.user.id]?.timestamp + 895000 > performance.now()) { @@ -329,11 +331,11 @@ module.exports = { if (optionparts[3] == "profilelink") { choiceinput = interaction.fields.getTextInputValue("choiceinput"); if (choiceinput && choiceinput.length > 0) { - setOption(interaction.user.id, optionparts[3], choiceinput); + setOption(interaction.guildId, interaction.user.id, optionparts[3], choiceinput); await interaction.reply({ content: `Updated your profile link to ${choiceinput}`, flags: MessageFlags.Ephemeral }); } else { - setOption(interaction.user.id, optionparts[3], ``); + setOption(interaction.guildId, interaction.user.id, optionparts[3], ``); await interaction.reply({ content: `Cleared profile link`, flags: MessageFlags.Ephemeral }); } if (process.recentinteraction) { @@ -346,11 +348,11 @@ module.exports = { if (optionparts[3] == "kinklistlink") { choiceinput = interaction.fields.getTextInputValue("choiceinput"); if (choiceinput && choiceinput.length > 0) { - setOption(interaction.user.id, optionparts[3], choiceinput); + setOption(interaction.guildId, interaction.user.id, optionparts[3], choiceinput); await interaction.reply({ content: `Updated your kink list link to ${choiceinput}`, flags: MessageFlags.Ephemeral }); } else { - setOption(interaction.user.id, optionparts[3], ``); + setOption(interaction.guildId, interaction.user.id, optionparts[3], ``); await interaction.reply({ content: `Cleared profile link`, flags: MessageFlags.Ephemeral }); } if (process.recentinteraction) { @@ -363,11 +365,11 @@ module.exports = { if (optionparts[3] == "preferredtitle") { choiceinput = interaction.fields.getTextInputValue("choiceinput"); if (choiceinput && choiceinput.length > 0) { - setOption(interaction.user.id, optionparts[3], choiceinput); + setOption(interaction.guildId, interaction.user.id, optionparts[3], choiceinput); await interaction.reply({ content: `Updated your preferred title to ${choiceinput}`, flags: MessageFlags.Ephemeral }); } else { - setOption(interaction.user.id, optionparts[3], ``); + setOption(interaction.guildId, interaction.user.id, optionparts[3], ``); await interaction.reply({ content: `Cleared Preferred Titles`, flags: MessageFlags.Ephemeral }); } if (process.recentinteraction) { @@ -383,7 +385,7 @@ module.exports = { if (choiceusers.length > 0) { choiceusers = choiceusers.map((a) => a[0]).sort() } - setOption(interaction.user.id, optionparts[3], choiceusers); + setOption(interaction.guildId, interaction.user.id, optionparts[3], choiceusers); await interaction.reply({ content: `Updated allowed users to headpat you to ${choiceusers.map((a) => { return `<@${a}>`}).join(", ")}`, flags: MessageFlags.Ephemeral }); if (process.recentinteraction) { if (process.recentinteraction[interaction.user.id]?.timestamp + 895000 > performance.now()) { @@ -398,7 +400,7 @@ module.exports = { if (choiceusers.length > 0) { choiceusers = choiceusers.map((a) => a[0]).sort() } - setOption(interaction.user.id, optionparts[3], choiceusers); + setOption(interaction.guildId, interaction.user.id, optionparts[3], choiceusers); await interaction.reply({ content: `Updated allowed users to shock you to ${choiceusers.map((a) => { return `<@${a}>`}).join(", ")}`, flags: MessageFlags.Ephemeral }); if (process.recentinteraction) { if (process.recentinteraction[interaction.user.id]?.timestamp + 895000 > performance.now()) { diff --git a/commands/corset.js b/commands/corset.js index 7ff1966d..d45daf96 100644 --- a/commands/corset.js +++ b/commands/corset.js @@ -36,7 +36,7 @@ module.exports = { if (matches.length == 0) { matches = autocompletes; } - let tags = getUserTags(interaction.user.id); + let tags = getUserTags(interaction.guildId, interaction.user.id); let newsorted = []; matches.forEach((f) => { let tagged = false; @@ -63,25 +63,26 @@ module.exports = { try { let corsetuser = interaction.options.getUser("user") ? interaction.options.getUser("user") : interaction.user; // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(corsetuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, corsetuser.id)?.mainconsent) { await handleConsent(interaction, corsetuser.id); return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)) { + if (!getConsent(interaction.guildId, interaction.user.id)) { await handleConsent(interaction, interaction.user.id); return; } - const current = getCorset(corsetuser.id); + const current = getCorset(interaction.guildId, corsetuser.id); const tightness = interaction.options.getNumber("intensity") ?? current?.tightness ?? 5; const type = interaction.options.getString("type") ?? current?.type ?? "corset_leather"; // Build data tree: let data = { textarray: "texts_corset", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: corsetuser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type c2: tightness, // corset tightness c3: getBaseCorset(current?.type)?.name ?? "Leather Corset", // current corset c4: getBaseCorset(type)?.name, // new corset @@ -101,7 +102,7 @@ module.exports = { } let blocked = false; if (type) { - let tags = getUserTags(corsetuser.id); + let tags = getUserTags(interaction.guildId, corsetuser.id); let i = getBaseCorset(type); tags.forEach((t) => { if (i && i.tags && i.tags.includes(t) && corsetuser != interaction.user) { @@ -114,13 +115,13 @@ module.exports = { if (blocked) { return; } - if (!getHeavyBound(interaction.user.id, corsetuser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, corsetuser.id)) { // In heavy bondage, fail data.heavy = true; if (corsetuser == interaction.user) { // Doing this to self data.self = true; - if (getChastity(corsetuser.id)) { + if (getChastity(interaction.guildId, corsetuser.id)) { data.chastity = true; interaction.reply(getText(data)); } else { @@ -130,7 +131,7 @@ module.exports = { } else { // To others data.other = true; - if (getChastity(corsetuser.id)) { + if (getChastity(interaction.guildId, corsetuser.id)) { data.chastity = true; interaction.reply(getText(data)); } else { @@ -138,18 +139,18 @@ module.exports = { interaction.reply(getText(data)); } } - } else if (getChastity(corsetuser.id)) { + } else if (getChastity(interaction.guildId, corsetuser.id)) { data.noheavy = true; data.chastity = true; // The target is in a chastity belt - if (getBaseChastity(getChastity(corsetuser.id).chastitytype ?? "belt_silver").canAccessCorset({ userID: corsetuser.id, keyholderID: interaction.user.id })) { + if (getBaseChastity(getChastity(interaction.guildId, corsetuser.id).chastitytype ?? "belt_silver").canAccessCorset({ serverID: interaction.guildId, userID: corsetuser.id, keyholderID: interaction.user.id })) { // User tries to modify the corset settings for someone in chastity that they do have the key for data.key = true; - const fumbleResult = getBaseChastity(getChastity(corsetuser.id).chastitytype ?? "belt_silver").fumble({ userID: corsetuser.id, keyholderID: interaction.user.id }); + const fumbleResult = getBaseChastity(getChastity(interaction.guildId, corsetuser.id).chastitytype ?? "belt_silver").fumble({ serverID: interaction.guildId, userID: corsetuser.id, keyholderID: interaction.user.id }); if (fumbleResult > 0) { // User fumbles with the key due to their arousal and frustration data.fumble = true; - if (config.getKeyLoss(corsetuser.id) && fumbleResult > 1) { + if ((getOption(interaction.guildId, corsetuser.id, "keyloss") == "enabled") && (fumbleResult > 1)) { data.discard = true; // if they fumble again they can lose the key if (corsetuser == interaction.user) { @@ -158,13 +159,13 @@ module.exports = { if (current) { // User already has a corset on data.corset = true; - let discardresult = getBaseChastity(getChastity(corsetuser.id).chastitytype ?? "belt_silver").discard({ userID: corsetuser.id, keyholderID: interaction.user.id }); + let discardresult = getBaseChastity(getChastity(interaction.guildId, corsetuser.id).chastitytype ?? "belt_silver").discard({ serverID: interaction.guildId, userID: corsetuser.id, keyholderID: interaction.user.id }); data[discardresult] = true; interaction.reply(getText(data)); } else { // Putting ON a corset! data.nocorset = true; - let discardresult = getBaseChastity(getChastity(corsetuser.id).chastitytype ?? "belt_silver").discard({ userID: corsetuser.id, keyholderID: interaction.user.id }); + let discardresult = getBaseChastity(getChastity(interaction.guildId, corsetuser.id).chastitytype ?? "belt_silver").discard({ serverID: interaction.guildId, userID: corsetuser.id, keyholderID: interaction.user.id }); data[discardresult] = true; interaction.reply(getText(data)); } @@ -173,13 +174,13 @@ module.exports = { if (current) { // User already has a corset on data.corset = true; - let discardresult = getBaseChastity(getChastity(corsetuser.id).chastitytype ?? "belt_silver").discard({ userID: corsetuser.id, keyholderID: interaction.user.id }); + let discardresult = getBaseChastity(getChastity(interaction.guildId, corsetuser.id).chastitytype ?? "belt_silver").discard({ serverID: interaction.guildId, userID: corsetuser.id, keyholderID: interaction.user.id }); data[discardresult] = true; interaction.reply(getText(data)); } else { // Putting ON a corset! data.nocorset = true; - let discardresult = getBaseChastity(getChastity(corsetuser.id).chastitytype ?? "belt_silver").discard({ userID: corsetuser.id, keyholderID: interaction.user.id }); + let discardresult = getBaseChastity(getChastity(interaction.guildId, corsetuser.id).chastitytype ?? "belt_silver").discard({ serverID: interaction.guildId, userID: corsetuser.id, keyholderID: interaction.user.id }); data[discardresult] = true; interaction.reply(getText(data)); } @@ -222,26 +223,26 @@ module.exports = { if (type != current.type) { data.newcorset = true; interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness); + assignCorset(interaction.guildId, corsetuser.id, type, tightness); } else { data.corset = true; if (current.tightness < tightness) { // Tightening the corset! data.tighter = true; interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness); + assignCorset(interaction.guildId, corsetuser.id, type, tightness); } else { // Loosening the corset! data.looser = true; interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness); + assignCorset(interaction.guildId, corsetuser.id, type, tightness); } } } else { // Putting ON a corset! data.nocorset = true; interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness); + assignCorset(interaction.guildId, corsetuser.id, type, tightness); } } else { // User tries to modify another user's vibe settings @@ -251,20 +252,20 @@ module.exports = { if (type != current.type) { data.newcorset = true; // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interaction.user.id, corsetuser.id, "corset") == true) { + if (checkBondageRemoval(interaction.guildId, interaction.user.id, corsetuser.id, "corset") == true) { // Allowed immediately, lets go interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness, interaction.user.id); + assignCorset(interaction.guildId, corsetuser.id, type, tightness, interaction.user.id); } else { // We need to ask first. let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "corset"; interaction.reply({ content: getTextGeneric("changebind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interaction.user, corsetuser, "corset", true).then( + let canRemove = await handleBondageRemoval(interaction.guildId, interaction.user, corsetuser, "corset", true).then( async (res) => { await interaction.editReply(getTextGeneric("changebind_accept", datatogeneric)); await interaction.followUp(getText(data)); - assignCorset(corsetuser.id, type, tightness, interaction.user.id); + assignCorset(interaction.guildId, corsetuser.id, type, tightness, interaction.user.id); }, async (rej) => { await interaction.editReply(getTextGeneric("changebind_decline", datatogeneric)); @@ -272,14 +273,14 @@ module.exports = { ); } interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness); + assignCorset(interaction.guildId, corsetuser.id, type, tightness); } else { data.corset = true; if (current.tightness < tightness) { // Tightening the corset! data.tighter = true; // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interaction.user.id, corsetuser.id, "corset") == true) { + if (checkBondageRemoval(interaction.guildId, interaction.user.id, corsetuser.id, "corset") == true) { // Allowed immediately, lets go interaction.reply(getText(data)); assignCorset(corsetuser.id, type, tightness, interaction.user.id); @@ -288,11 +289,11 @@ module.exports = { let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "corset"; interaction.reply({ content: getTextGeneric("changebind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interaction.user, corsetuser, "corset", true).then( + let canRemove = await handleBondageRemoval(interaction.guildId, interaction.user, corsetuser, "corset", true).then( async (res) => { await interaction.editReply(getTextGeneric("changebind_accept", datatogeneric)); await interaction.followUp(getText(data)); - assignCorset(corsetuser.id, type, tightness, interaction.user.id); + assignCorset(interaction.guildId, corsetuser.id, type, tightness, interaction.user.id); }, async (rej) => { await interaction.editReply(getTextGeneric("changebind_decline", datatogeneric)); @@ -303,14 +304,14 @@ module.exports = { // Loosening the corset! data.looser = true; interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness); + assignCorset(interaction.guildId, corsetuser.id, type, tightness); } } } else { // Putting ON a corset! data.nocorset = true; interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness); + assignCorset(interaction.guildId, corsetuser.id, type, tightness); } } } @@ -348,25 +349,25 @@ module.exports = { if (type != current.type) { data.newcorset = true; interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness); + assignCorset(interaction.guildId, corsetuser.id, type, tightness); } else { data.corset = true; if (current.tightness < tightness) { // User is tightening the corset data.tighten = true; interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness); + assignCorset(interaction.guildId, corsetuser.id, type, tightness); } else { // Loosening the corset data.loosen = true; interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness); + assignCorset(interaction.guildId, corsetuser.id, type, tightness); } } } else { data.nocorset = true; interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness); + assignCorset(interaction.guildId, corsetuser.id, type, tightness); } } else { data.other = true; @@ -376,20 +377,20 @@ module.exports = { if (type != current.type) { data.newcorset = true; // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interaction.user.id, corsetuser.id, "corset") == true) { + if (checkBondageRemoval(interaction.guildId, interaction.user.id, corsetuser.id, "corset") == true) { // Allowed immediately, lets go interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness, interaction.user.id); + assignCorset(interaction.guildId, corsetuser.id, type, tightness, interaction.user.id); } else { // We need to ask first. let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "corset"; interaction.reply({ content: getTextGeneric("changebind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interaction.user, corsetuser, "corset").then( + let canRemove = await handleBondageRemoval(interaction.guildId, interaction.user, corsetuser, "corset").then( async (res) => { await interaction.editReply(getTextGeneric("changebind_accept", datatogeneric)); await interaction.followUp(getText(data)); - assignCorset(corsetuser.id, type, tightness, interaction.user.id); + assignCorset(interaction.guildId, corsetuser.id, type, tightness, interaction.user.id); }, async (rej) => { await interaction.editReply(getTextGeneric("changebind_decline", datatogeneric)); @@ -402,20 +403,20 @@ module.exports = { // Tightening data.tighten = true; // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interaction.user.id, corsetuser.id, "corset") == true) { + if (checkBondageRemoval(interaction.guildId, interaction.user.id, corsetuser.id, "corset") == true) { // Allowed immediately, lets go interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness, interaction.user.id); + assignCorset(interaction.guildId, corsetuser.id, type, tightness, interaction.user.id); } else { // We need to ask first. let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "corset"; interaction.reply({ content: getTextGeneric("changebind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interaction.user, corsetuser, "corset").then( + let canRemove = await handleBondageRemoval(interaction.guildId, interaction.user, corsetuser, "corset").then( async (res) => { await interaction.editReply(getTextGeneric("changebind_accept", datatogeneric)); await interaction.followUp(getText(data)); - assignCorset(corsetuser.id, type, tightness, interaction.user.id); + assignCorset(interaction.guildId, corsetuser.id, type, tightness, interaction.user.id); }, async (rej) => { await interaction.editReply(getTextGeneric("changebind_decline", datatogeneric)); @@ -426,20 +427,20 @@ module.exports = { // Loosening data.loosen = true; // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interaction.user.id, corsetuser.id, "corset") == true) { + if (checkBondageRemoval(interaction.guildId, interaction.user.id, corsetuser.id, "corset") == true) { // Allowed immediately, lets go interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness, interaction.user.id); + assignCorset(interaction.guildId, corsetuser.id, type, tightness, interaction.user.id); } else { // We need to ask first. let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "corset"; interaction.reply({ content: getTextGeneric("changebind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interaction.user, corsetuser, "corset").then( + let canRemove = await handleBondageRemoval(interaction.guildId, interaction.user, corsetuser, "corset").then( async (res) => { await interaction.editReply(getTextGeneric("changebind_accept", datatogeneric)); await interaction.followUp(getText(data)); - assignCorset(corsetuser.id, type, tightness, interaction.user.id); + assignCorset(interaction.guildId, corsetuser.id, type, tightness, interaction.user.id); }, async (rej) => { await interaction.editReply(getTextGeneric("changebind_decline", datatogeneric)); @@ -451,7 +452,7 @@ module.exports = { } else { data.nocorset = true; interaction.reply(getText(data)); - assignCorset(corsetuser.id, type, tightness); + assignCorset(interaction.guildId, corsetuser.id, type, tightness); } } } @@ -460,7 +461,7 @@ module.exports = { } }, async help(userid, page) { - let restrictedtext = getCorset(userid) && getChastity(userid) && !canAccessChastity(userid, userid).access ? `***You cannot change or remove your corset currently***\n` : ""; + let restrictedtext = getCorset(interaction.guildId, userid) && getChastity(interaction.guildId, userid) && !canAccessChastity(interaction.guildId, userid, userid).access ? `***You cannot change or remove your corset currently***\n` : ""; let overviewtext = `## Corset ### Usage: /corset (user) (tightness) ### Remove: /uncorset (user) diff --git a/commands/drone.js b/commands/drone.js index 94071abf..9fbabe88 100644 --- a/commands/drone.js +++ b/commands/drone.js @@ -63,12 +63,13 @@ module.exports = { async execute(interaction) { try { // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } // Build data tree: let data = { + serverID: interaction.guildId, interactionuser: { id: interaction.user.id }, targetuser: { id: interaction.user.id }, } @@ -78,7 +79,7 @@ module.exports = { if (additional == null) { additional = ``}; await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - let dronetext = `${getOption(interaction.user.id, "dronevisorname")} :: Code ${dronecodes[chosencode].code} :: ${dronecodes[chosencode].message}` + let dronetext = `${getOption(interaction.guildId, interaction.user.id, "dronevisorname")} :: Code ${dronecodes[chosencode].code} :: ${dronecodes[chosencode].message}` if (additional.length > 0) { if (dronetext.endsWith(".")) { dronetext = `${dronetext} ${additional}` @@ -87,7 +88,7 @@ module.exports = { dronetext = `${dronetext}, ${additional}` } } - messageSend({ channel: interaction.channel }, ("`" + dronetext + "`"), await getPFP(interaction.member), await getAlternateName(interaction.member), interaction.channel.parentId ? undefined : interaction.channel.id, true) + messageSend({ channel: interaction.channel }, ("`" + dronetext + "`"), await getPFP(interaction.guildId, interaction.member), await getAlternateName(interaction.guildId, interaction.member), interaction.channel.parentId ? undefined : interaction.channel.id, true) await interaction.editReply({ content: `Status code ${chosencode} sent!`}) } catch (err) { console.log(err); diff --git a/commands/gag.js b/commands/gag.js index 4a8f7430..03908fdf 100644 --- a/commands/gag.js +++ b/commands/gag.js @@ -62,12 +62,12 @@ module.exports = { try { let gaggeduser = interaction.options.getUser("user") ? interaction.options.getUser("user") : interaction.user; // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(gaggeduser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, gaggeduser.id)?.mainconsent) { await handleConsent(interaction, gaggeduser.id); return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } @@ -77,7 +77,7 @@ module.exports = { let currentgag = getGag(interaction.guildId, gaggeduser.id, gagtype); let gagname = process.gagtypes[gagtype]?.choicename; - let tags = getUserTags(gaggeduser.id); + let tags = getUserTags(interaction.guildId, gaggeduser.id); let i = process.gagtypes[gagtype] let blocked = false; tags.forEach((t) => { @@ -89,7 +89,7 @@ module.exports = { }) if (blocked) { return } // GO AWAY - let oldgagname = process.gagtypes[getGagLast(gaggeduser.id)]?.choicename; + let oldgagname = process.gagtypes[getGagLast(interaction.guildId, gaggeduser.id)]?.choicename; let intensitytext = "loosely"; if (intensitytext == "loosely") { if (gagintensity > 2) { @@ -120,9 +120,10 @@ module.exports = { let data = { textarray: "texts_gag", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: gaggeduser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type c2: intensitytext, // gag tightness c3: gagname, // New gag being put on the wearer c4: oldgagname, // Old gag the wearer has on @@ -144,13 +145,13 @@ module.exports = { gaggeduser = interaction.user; } - if (!getHeavyBound(interaction.user.id, gaggeduser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, gaggeduser.id)) { // in heavy bondage, cant equip data.heavy = true; if (interactionuser == gaggeduser) { // gagging self data.self = true; - if (getGag(interaction.guildId, interactionuser.id)) { + if (getGag(interaction.guildId, interaction.guildId, interactionuser.id)) { // has a gag already data.gag = true; interaction.reply(getText(data)); @@ -162,7 +163,7 @@ module.exports = { } else { // gagging another data.other = true; - if (getGag(interaction.guildId, gaggeduser.id)) { + if (getGag(interaction.guildId, interaction.guildId, gaggeduser.id)) { // has a gag already data.gag = true; interaction.reply(getText(data)); @@ -172,13 +173,13 @@ module.exports = { interaction.reply(getText(data)); } } - } else if (getMitten(interactionuser.id)) { + } else if (getMitten(interaction.guildId, interactionuser.id)) { // We are wearing mittens, we can't hold onto the straps! data.noheavy = true; data.mitten = true; if (interactionuser.id != gaggeduser.id) { data.other = true; // yes, this is backwards, sorry. - if (getGag(interaction.guildId, gaggeduser.id)) { + if (getGag(interaction.guildId, interaction.guildId, gaggeduser.id)) { data.gag = true; interaction.reply(getText(data)); } else { @@ -196,23 +197,23 @@ module.exports = { if (interactionuser.id == gaggeduser.id) { // Gagging ourself data.self = true; - if (getGag(interaction.guildId, gaggeduser.id)) { + if (getGag(interaction.guildId, interaction.guildId, gaggeduser.id)) { // We are already gagged! data.gag = true; if (currentgag) { // We are already gagged with that kind. Remove and put it at the end of the list! data.changetightness = true; interaction.reply(getText(data)); - assignGag(gaggeduser.id, gagtype, gagintensity, interactionuser.id); + assignGag(interaction.guildId, gaggeduser.id, gagtype, gagintensity, interactionuser.id); } else { // We are NOT gagged with this kind. data.newgag = true; await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleExtremeRestraint(interactionuser, gaggeduser, "gag", gagtype).then( + await handleExtremeRestraint(interaction.guildId, interactionuser, gaggeduser, "gag", gagtype).then( async (success) => { await interaction.followUp({ content: `Equipping ${gagname}`, withResponse: true }); await interaction.followUp(getText(data)); - assignGag(gaggeduser.id, gagtype, gagintensity, interactionuser.id); + assignGag(interaction.guildId, gaggeduser.id, gagtype, gagintensity, interactionuser.id); }, async (reject) => { let nomessage = `You rejected the ${gagname}.`; @@ -233,11 +234,11 @@ module.exports = { // Not already gagged, lets put one on data.nogag = true; await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleExtremeRestraint(interactionuser, gaggeduser, "gag", gagtype).then( + await handleExtremeRestraint(interaction.guildId, interactionuser, gaggeduser, "gag", gagtype).then( async (success) => { await interaction.followUp({ content: `Equipping ${gagname}`, withResponse: true }); await interaction.followUp(getText(data)); - assignGag(gaggeduser.id, gagtype, gagintensity, interactionuser.id); + assignGag(interaction.guildId, gaggeduser.id, gagtype, gagintensity, interactionuser.id); }, async (reject) => { let nomessage = `You rejected the ${gagname}.`; @@ -265,16 +266,16 @@ module.exports = { // We are already gagged with that kind. Remove and put it at the end of the list! data.changetightness = true; // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interactionuser.id, gaggeduser.id, "gag") == true) { + if (checkBondageRemoval(interaction.guildId, interactionuser.id, gaggeduser.id, "gag") == true) { // Allowed immediately, lets go interaction.reply(getText(data)); - assignGag(gaggeduser.id, gagtype, gagintensity, interactionuser.id); + assignGag(interaction.guildId, gaggeduser.id, gagtype, gagintensity, interactionuser.id); } else { // We need to ask first. let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "gag"; interaction.reply({ content: getTextGeneric("changebind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interactionuser, gaggeduser, "gag", true).then( + let canRemove = await handleBondageRemoval(interaction.guildId, interactionuser, gaggeduser, "gag", true).then( async (res) => { await interaction.editReply(getTextGeneric("changebind_accept", datatogeneric)); await interaction.followUp(getText(data)); @@ -289,14 +290,14 @@ module.exports = { // We are NOT gagged with this kind. data.newgag = true; // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interactionuser.id, gaggeduser.id, "gag") == true) { + if (checkBondageRemoval(interaction.guildId, interactionuser.id, gaggeduser.id, "gag") == true) { // Allowed immediately, lets go await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleExtremeRestraint(interactionuser, gaggeduser, "gag", gagtype).then( + await handleExtremeRestraint(interaction.guildId, interactionuser, gaggeduser, "gag", gagtype).then( async (success) => { await interaction.followUp({ content: `Equipping ${gagname}`, withResponse: true }); await interaction.followUp(getText(data)); - assignGag(gaggeduser.id, gagtype, gagintensity, interactionuser.id); + assignGag(interaction.guildId, gaggeduser.id, gagtype, gagintensity, interactionuser.id); }, async (reject) => { let nomessage = `${gaggeduser} rejected the ${gagname}.`; @@ -317,14 +318,14 @@ module.exports = { let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "gag"; interaction.reply({ content: getTextGeneric("changebind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interactionuser, gaggeduser, "gag", true).then( + let canRemove = await handleBondageRemoval(interaction.guildId, interactionuser, gaggeduser, "gag", true).then( async (res) => { await interaction.editReply(getTextGeneric("changebind_accept", datatogeneric)); - await handleExtremeRestraint(interactionuser, gaggeduser, "gag", gagtype).then( + await handleExtremeRestraint(interaction.guildId, interactionuser, gaggeduser, "gag", gagtype).then( async (success) => { await interaction.followUp({ content: `Equipping ${gagname}`, withResponse: true }); await interaction.followUp(getText(data)); - assignGag(gaggeduser.id, gagtype, gagintensity, interactionuser.id); + assignGag(interaction.guildId, gaggeduser.id, gagtype, gagintensity, interactionuser.id); }, async (reject) => { let nomessage = `${gaggeduser} rejected the ${gagname}.`; @@ -353,11 +354,11 @@ module.exports = { data.nogag = true; data[tone] = true; await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleExtremeRestraint(interactionuser, gaggeduser, "gag", gagtype).then( + await handleExtremeRestraint(interaction.guildId, interactionuser, gaggeduser, "gag", gagtype).then( async (success) => { await interaction.followUp({ content: `Equipping ${gagname}`, withResponse: true }); await interaction.followUp(getText(data)); - assignGag(gaggeduser.id, gagtype, gagintensity, interactionuser.id); + assignGag(interaction.guildId, gaggeduser.id, gagtype, gagintensity, interactionuser.id); }, async (reject) => { let nomessage = `${gaggeduser} rejected the ${gagname}.`; @@ -381,7 +382,7 @@ module.exports = { } }, async help(userid, page) { - let restrictedtext = (getMitten(userid)) ? `***You cannot gag anyone because of your mittens***\n` : "" + let restrictedtext = (getMitten(interaction.guildId, userid)) ? `***You cannot gag anyone because of your mittens***\n` : "" let overviewtext = `## Gag ### Usage: /gag (user) (intensity) (tone) ### Remove: /ungag (user) (gag) diff --git a/commands/headpat.js b/commands/headpat.js index 91706eee..7679d018 100644 --- a/commands/headpat.js +++ b/commands/headpat.js @@ -14,12 +14,12 @@ module.exports = { try { let targetuser = interaction.options.getUser("user") ?? interaction.user; // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(targetuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, targetuser.id)?.mainconsent) { await handleConsent(interaction, targetuser.id); return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } @@ -27,6 +27,7 @@ module.exports = { let data = { textarray: "texts_touch", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: targetuser, //c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type @@ -35,10 +36,10 @@ module.exports = { }; await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleTouchEvent(interaction.user, targetuser, "headpat").then( + await handleTouchEvent(interaction.guildId, interaction.user, targetuser, "headpat").then( async (success) => { await interaction.followUp({ content: `Headpatting ${targetuser}`, flags: MessageFlags.Ephemeral }) - let headpatattempt = rollPatChance(interaction.user.id, targetuser.id, interaction.guildId) + let headpatattempt = rollPatChance(interaction.guildId, interaction.user.id, targetuser.id, interaction.guildId) data.headpat = true; if (interaction.user.id == targetuser.id) { @@ -87,7 +88,7 @@ module.exports = { nomessage = `Something went wrong - Submit a bug report!`; } if (reject == "NoDM") { - nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(targetuser.id, "subject")} ${getPronouns(targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent to touch.`; + nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(interaction.guildId, targetuser.id, "subject")} ${getPronouns(interaction.guildId, targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent to touch.`; } await interaction.followUp({ content: nomessage }); }, diff --git a/commands/heavy.js b/commands/heavy.js index c69f436e..b3ff7808 100644 --- a/commands/heavy.js +++ b/commands/heavy.js @@ -39,7 +39,7 @@ module.exports = { if (matches.length == 0) { matches = autocompletes; } - let tags = getUserTags(chosenuserid); + let tags = getUserTags(interaction.guildId, chosenuserid); let newsorted = []; matches.forEach((f) => { let tagged = false; @@ -75,12 +75,12 @@ module.exports = { return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(targetuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, targetuser.id)?.mainconsent) { await handleConsent(interaction, targetuser.id); return; } - let tags = getUserTags(targetuser.id); + let tags = getUserTags(interaction.guildId, targetuser.id); let i = getBaseHeavy(heavychoice) let blocked = false; tags.forEach((t) => { @@ -95,9 +95,10 @@ module.exports = { let data = { textarray: "texts_heavy", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: targetuser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type c2: i.name, // New heavy bondage c3: i.name // Compatibility with original collarequiptexts }, @@ -114,7 +115,7 @@ module.exports = { return; } - if (!getHeavyBound(interaction.user.id, targetuser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, targetuser.id)) { data.heavy = true; interaction.reply(getText(data)); } else { @@ -130,15 +131,14 @@ module.exports = { } data.reflect = true; } - + // This disaster of a function lol let canwear = true; let blocker; let blockertype; - console.log(getHeavyList(targetuser.id).map((h) => getBaseHeavy(h.type))) - getHeavyList(targetuser.id).map((h) => getBaseHeavy(h.type)).forEach((h) => { + getHeavyList(interaction.guildId, targetuser.id).map((h) => getBaseHeavy(h.type)).forEach((h) => { h.heavytags.forEach((t) => { - if (getBaseHeavy(heavychoice).heavytags.includes(t)) { + if (getBaseHeavy(interaction.guildId, heavychoice).heavytags.includes(t)) { canwear = false blocker = h blockertype = t @@ -146,6 +146,7 @@ module.exports = { }) }) canwear = true; // I'll regret this I'm sure + // Update on 06/21/26 - I DID regret my design decisions regarding server IDs, but not this one at least. await interaction.deferReply({ flags: MessageFlags.Ephemeral }); if ((interaction.user.id != targetuser.id) || (data.textdata.interactionuser == process.client.user)) { // Someone else! @@ -155,12 +156,12 @@ module.exports = { if (getBaseHeavy(heavychoice).heavytags) { data[getBaseHeavy(heavychoice).heavytags[0]] = true; // Categorize this by the FIRST tag. } - await handleMajorRestraint(interaction.user, targetuser, "heavy", heavychoice).then(async () => { - await handleExtremeRestraint(interaction.user, targetuser, "heavy", heavychoice).then( + await handleMajorRestraint(interaction.guildId, interaction.user, targetuser, "heavy", heavychoice).then(async () => { + await handleExtremeRestraint(interaction.guildId, interaction.user, targetuser, "heavy", heavychoice).then( async (success) => { await interaction.followUp({ content: `Equipping ${convertheavy(heavychoice)}`, withResponse: true, flags: MessageFlags.Ephemeral }); await interaction.followUp(getText(data)); - assignHeavy(targetuser.id, heavychoice, interaction.user.id, data.textdata.c3); + assignHeavy(interaction.guildId, targetuser.id, heavychoice, interaction.user.id, data.textdata.c3); }, async (reject) => { let nomessage = `${targetuser} rejected the ${convertheavy(heavychoice)}.`; @@ -171,7 +172,7 @@ module.exports = { nomessage = `Something went wrong - Submit a bug report!`; } if (reject == "NoDM") { - nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(targetuser.id, "subject")} ${getPronouns(targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; + nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(interaction.guildId, targetuser.id, "subject")} ${getPronouns(interaction.guildId, targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; } await interaction.followUp({ content: nomessage }); }, @@ -186,7 +187,7 @@ module.exports = { nomessage = `Something went wrong - Submit a bug report!`; } if (reject == "NoDM") { - nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(targetuser.id, "subject")} ${getPronouns(targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; + nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(interaction.guildId, targetuser.id, "subject")} ${getPronouns(interaction.guildId, targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; } if (reject == "Cooldown") { nomessage = `${targetuser} has blocked major bondage restraints for now. Please try again in the future.`; @@ -209,11 +210,11 @@ module.exports = { if (getBaseHeavy(heavychoice).heavytags) { data[getBaseHeavy(heavychoice).heavytags[0]] = true; // Categorize this by the FIRST tag. } - await handleExtremeRestraint(interaction.user, targetuser, "heavy", heavychoice).then( + await handleExtremeRestraint(interaction.guildId, interaction.user, targetuser, "heavy", heavychoice).then( async (success) => { await interaction.followUp({ content: `Equipping ${convertheavy(heavychoice)}`, withResponse: true }); await interaction.followUp(getText(data)); - assignHeavy(interaction.user.id, heavychoice, interaction.user.id, data.textdata.c3); + assignHeavy(interaction.guildId, interaction.user.id, heavychoice, interaction.user.id, data.textdata.c3); }, async (reject) => { let nomessage = `You rejected the ${convertheavy(heavychoice)}.`; @@ -244,7 +245,7 @@ module.exports = { } }, async help(userid, page) { - let restrictedtext = (getHeavy(userid)) ? `***You are in heavy bondage***\n` : "" + let restrictedtext = (getHeavy(interaction.guildId, userid)) ? `***You are in heavy bondage***\n` : "" let overviewtext = `## Heavy ### Usage: /heavy (type) ### Remove: /unheavy (user) diff --git a/commands/inspect.js b/commands/inspect.js index b1e5dfbc..5a59d00f 100644 --- a/commands/inspect.js +++ b/commands/inspect.js @@ -10,7 +10,7 @@ module.exports = { async execute(interaction) { try { let inspectuser = interaction.options.getUser("user") ? interaction.options.getUser("user") : interaction.user; - interaction.reply(await inspectModal(interaction.user.id, inspectuser.id, "overview", 1)) + interaction.reply(await inspectModal(interaction.guildId, interaction.user.id, inspectuser.id, "overview", 1)) } catch (err) { console.log(err) @@ -25,10 +25,10 @@ module.exports = { if ((interaction.customId == `inspect_overview_newuser_1`) && interaction.values) { choiceinput = interaction.values[0] } - interaction.update(await inspectModal(interaction.user.id, choiceinput, menu, page)) + interaction.update(await inspectModal(interaction.guildId, interaction.user.id, choiceinput, menu, page)) }, async help(userid, page) { - let restrictedtext = (!getHeadwearRestrictions(userid).canInspect) ? `***You cannot see others currently***\n` : "" + let restrictedtext = (!getHeadwearRestrictions(interaction.guildId, userid).canInspect) ? `***You cannot see others currently***\n` : "" let overviewtext = `## Inspect ### Usage: /inspect (user) ### Additionally, right click a message or user, Apps -> Inspect User diff --git a/commands/item.js b/commands/item.js index 2171fe51..666bdb88 100644 --- a/commands/item.js +++ b/commands/item.js @@ -33,22 +33,22 @@ module.exports = { try { if (subcommand == "protect") { // Headwear - let itemswornhead = getHeadwear(interaction.user.id); - let itemslockedhead = getLockedHeadgear(interaction.user.id); + let itemswornhead = getHeadwear(interaction.guildId, interaction.user.id); + let itemslockedhead = getLockedHeadgear(interaction.guildId, interaction.user.id); let sorted = itemswornhead.filter((f) => !itemslockedhead.includes(f)); // Clothing - let itemswornwearable = getWearable(interaction.user.id); - let itemslockedwearable = getLockedWearable(interaction.user.id); + let itemswornwearable = getWearable(interaction.guildId, interaction.user.id); + let itemslockedwearable = getLockedWearable(interaction.guildId, interaction.user.id); let sortedwearable = itemswornwearable.filter((f) => !itemslockedwearable.includes(f)); sorted = sorted.map((f) => { - return { name: getHeadwearName(undefined, f), value: `${f}+head` }; + return { name: getHeadwearName(interaction.guildId, undefined, f), value: `${f}+head` }; }); sortedwearable = sortedwearable.map((f) => { - return { name: getWearableName(undefined, f), value: `${f}+wearable` }; + return { name: getWearableName(interaction.guildId, undefined, f), value: `${f}+wearable` }; }); // Merge the lists. @@ -66,8 +66,8 @@ module.exports = { await interaction.respond(sorted.filter((f) => f.name.toLowerCase().includes(focusedValue.toLowerCase())).slice(0, 10)); } } else { - let itemslockedhead = getLockedHeadgear(interaction.user.id); - let itemslockedwearable = getLockedWearable(interaction.user.id); + let itemslockedhead = getLockedHeadgear(interaction.guildId, interaction.user.id); + let itemslockedwearable = getLockedWearable(interaction.guildId, interaction.user.id); let sorted = itemslockedhead.map((f) => { return { name: getHeadwearName(undefined, f), value: `${f}+head` }; @@ -98,16 +98,16 @@ module.exports = { let chosenitemparts = chosenitem.split("+"); let replytextname; if (chosenitemparts[1] == "head") { - if (getHeadwearName(undefined, chosenitemparts[0])) { - addLockedHeadgear(interaction.user.id, chosenitemparts[0]); + if (getHeadwearName(interaction.guildId, undefined, chosenitemparts[0])) { + addLockedHeadgear(interaction.guildId, interaction.user.id, chosenitemparts[0]); replytextname = getHeadwearName(undefined, chosenitemparts[0]); } else { interaction.reply({ content: `Item ${replytextname} is an invalid item! Try again.`, flags: MessageFlags.Ephemeral }); return; } } else { - if (getWearableName(undefined, chosenitemparts[0])) { - addLockedWearable(interaction.user.id, chosenitemparts[0]); + if (getWearableName(interaction.guildId, undefined, chosenitemparts[0])) { + addLockedWearable(interaction.guildId, interaction.user.id, chosenitemparts[0]); replytextname = getWearableName(undefined, chosenitemparts[0]); } else { interaction.reply({ content: `Item ${replytextname} is an invalid item! Try again.`, flags: MessageFlags.Ephemeral }); @@ -125,10 +125,10 @@ module.exports = { let chosenitemparts = chosenitem.split("+"); let replytextname; if (chosenitemparts[1] == "head") { - removeLockedHeadgear(interaction.user.id, chosenitemparts[0]); + removeLockedHeadgear(interaction.guildId, interaction.user.id, chosenitemparts[0]); replytextname = getHeadwearName(undefined, chosenitemparts[0]); } else { - removeLockedWearable(interaction.user.id, chosenitemparts[0]); + removeLockedWearable(interaction.guildId, interaction.user.id, chosenitemparts[0]); replytextname = getWearableName(undefined, chosenitemparts[0]); } interaction.reply({ content: `Item ${replytextname} removed from protection!`, flags: MessageFlags.Ephemeral }); From 033b580c7f5d8861c84fd3c4ef4a53e4fb3f748e Mon Sep 17 00:00:00 2001 From: Enraa Date: Mon, 22 Jun 2026 01:17:47 -0700 Subject: [PATCH 35/44] more. commands. --- commands/key.js | 283 +++++++++++++++++++++++----------------------- commands/letgo.js | 13 ++- commands/mask.js | 61 +++++----- commands/meme.js | 8 -- 4 files changed, 181 insertions(+), 184 deletions(-) diff --git a/commands/key.js b/commands/key.js index cdc648ec..e9129f8d 100644 --- a/commands/key.js +++ b/commands/key.js @@ -112,9 +112,9 @@ module.exports = { // We want to return ONLY options that the user COULD clone a key for // So if they own a collar key, it only gives "Collar" let chosenuserid = interaction.options.get("wearer")?.value ?? interaction.user.id; // Note we can only retrieve the user ID here! - let collarkeyholder = getCollar(chosenuserid) && canAccessCollar(chosenuserid, interaction.user.id, undefined, true).access; - let chastitykeyholder = getChastity(chosenuserid) && canAccessChastity(chosenuserid, interaction.user.id, undefined, true).access; - let chastitybrakeyholder = getChastityBra(chosenuserid) && canAccessChastityBra(chosenuserid, interaction.user.id, undefined, true).access; + let collarkeyholder = getCollar(interaction.guildId, chosenuserid) && canAccessCollar(interaction.guildId, chosenuserid, interaction.user.id, undefined, true).access; + let chastitykeyholder = getChastity(interaction.guildId, chosenuserid) && canAccessChastity(interaction.guildId, chosenuserid, interaction.user.id, undefined, true).access; + let chastitybrakeyholder = getChastityBra(interaction.guildId, chosenuserid) && canAccessChastityBra(interaction.guildId, chosenuserid, interaction.user.id, undefined, true).access; let choices = []; if (!collarkeyholder && !chastitykeyholder && !chastitybrakeyholder) { @@ -132,13 +132,13 @@ module.exports = { await interaction.respond(choices); } else if (subcommand == "revoke") { - let ownedclonedchastitykeys = getClonedChastityKeysOwned(interaction.user.id); - let ownedclonedchastitybrakeys = getClonedChastityBraKeysOwned(interaction.user.id); - let ownedclonedcollarkeys = getClonedCollarKeysOwned(interaction.user.id); + let ownedclonedchastitykeys = getClonedChastityKeysOwned(interaction.guildId, interaction.user.id); + let ownedclonedchastitybrakeys = getClonedChastityBraKeysOwned(interaction.guildId, interaction.user.id); + let ownedclonedcollarkeys = getClonedCollarKeysOwned(interaction.guildId, interaction.user.id); - let clonedchastitykeys = getOtherKeysChastity(interaction.user.id); - let clonedchastitybrakeys = getOtherKeysChastityBra(interaction.user.id); - let clonedcollarkeys = getOtherKeysCollar(interaction.user.id); + let clonedchastitykeys = getOtherKeysChastity(interaction.guildId, interaction.user.id); + let clonedchastitybrakeys = getOtherKeysChastityBra(interaction.guildId, interaction.user.id); + let clonedcollarkeys = getOtherKeysCollar(interaction.guildId, interaction.user.id); // Iterate over every member, ensuring that they are cached using the await command. // I hate this code. It feels sloppy. @@ -252,9 +252,9 @@ module.exports = { // Note, we only need to know if we can ***unlock*** a restraint to swap it. if (interaction.options.get("restraint")?.focused) { let chosenuserid = interaction.options.get("wearer")?.value ?? interaction.user.id; // Note we can only retrieve the user ID here! - let collarkeyholder = getCollar(chosenuserid) && canAccessCollar(chosenuserid, interaction.user.id, true).access; - let chastitykeyholder = getChastity(chosenuserid) && canAccessChastity(chosenuserid, interaction.user.id, true).access; - let chastitybrakeyholder = getChastityBra(chosenuserid) && canAccessChastityBra(chosenuserid, interaction.user.id, true).access; + let collarkeyholder = getCollar(interaction.guildId, chosenuserid) && canAccessCollar(interaction.guildId, chosenuserid, interaction.user.id, true).access; + let chastitykeyholder = getChastity(interaction.guildId, chosenuserid) && canAccessChastity(interaction.guildId, chosenuserid, interaction.user.id, true).access; + let chastitybrakeyholder = getChastityBra(interaction.guildId, chosenuserid) && canAccessChastityBra(interaction.guildId, chosenuserid, interaction.user.id, true).access; let choices = []; if (!collarkeyholder && !chastitykeyholder && !chastitybrakeyholder) { @@ -301,7 +301,7 @@ module.exports = { if (matches.length == 0) { matches = choices.slice(0,25); } - let tags = getUserTags(chosenuserid); + let tags = getUserTags(interaction.guildId, chosenuserid); let newsorted = []; matches.forEach((f) => { let tagged = false; @@ -319,9 +319,9 @@ module.exports = { } else if (subcommand == "discardkey") { // We need to know if we're holding the primary keys to throw them away. let chosenuserid = interaction.options.get("wearer")?.value ?? interaction.user.id; // Note we can only retrieve the user ID here! - let collarkeyholder = getCollar(chosenuserid) && (getCollar(chosenuserid).keyholder == interaction.user.id) && !getCollar(chosenuserid)?.fumbled && !canAccessCollar(chosenuserid, interaction.user.id, true).public - let chastitykeyholder = getChastity(chosenuserid) && (getChastity(chosenuserid).keyholder == interaction.user.id) && !getChastity(chosenuserid)?.fumbled && !canAccessChastity(chosenuserid, interaction.user.id, true).public - let chastitybrakeyholder = getChastityBra(chosenuserid) && (getChastityBra(chosenuserid).keyholder == interaction.user.id) && !getChastityBra(chosenuserid)?.fumbled && !canAccessChastityBra(chosenuserid, interaction.user.id, true).public + let collarkeyholder = getCollar(interaction.guildId, chosenuserid) && (getCollar(interaction.guildId, chosenuserid).keyholder == interaction.user.id) && !getCollar(interaction.guildId, chosenuserid)?.fumbled && !canAccessCollar(interaction.guildId, chosenuserid, interaction.user.id, true).public + let chastitykeyholder = getChastity(interaction.guildId, chosenuserid) && (getChastity(interaction.guildId, chosenuserid).keyholder == interaction.user.id) && !getChastity(interaction.guildId, chosenuserid)?.fumbled && !canAccessChastity(interaction.guildId, chosenuserid, interaction.user.id, true).public + let chastitybrakeyholder = getChastityBra(interaction.guildId, chosenuserid) && (getChastityBra(interaction.guildId, chosenuserid).keyholder == interaction.user.id) && !getChastityBra(interaction.guildId, chosenuserid)?.fumbled && !canAccessChastityBra(interaction.guildId, chosenuserid, interaction.user.id, true).public let choices = []; if (!collarkeyholder && !chastitykeyholder && !chastitybrakeyholder) { @@ -340,7 +340,7 @@ module.exports = { await interaction.respond(choices); } else if (subcommand == "additionalcollar") { let chosenuserid = interaction.options.get("wearer")?.value ?? interaction.user.id; // Note we can only retrieve the user ID here! - let collarkeyholder = canAccessCollar(chosenuserid, interaction.user.id, true).access + let collarkeyholder = canAccessCollar(interaction.guildId, chosenuserid, interaction.user.id, true).access let chosentype = interaction.options.get("type")?.value; let choices = []; console.log(chosentype) @@ -358,7 +358,7 @@ module.exports = { if (matches.length == 0) { matches = autocompletes; } - let tags = getUserTags(chosenuserid); + let tags = getUserTags(interaction.guildId, chosenuserid); let newsorted = []; matches.forEach((f) => { let tagged = false; @@ -367,7 +367,7 @@ module.exports = { if (i.tags && i.tags.includes(t)) { tagged = true } }) // Only attempt to add it to the list if it is not the worn collar type or the additional collar effect - if ((getCollar(chosenuserid)?.collartype != f.value) && !(getCollar(chosenuserid)?.additionalcollars && getCollar(chosenuserid)?.additionalcollars.includes(f.value))) { + if ((getCollar(interaction.guildId, chosenuserid)?.collartype != f.value) && !(getCollar(interaction.guildId, chosenuserid)?.additionalcollars && getCollar(interaction.guildId, chosenuserid)?.additionalcollars.includes(f.value))) { if (!tagged) { newsorted.push(f); } @@ -389,8 +389,8 @@ module.exports = { choices = [ { name: "No Additional Effects", value: "noeffect" } ] - if (getCollar(chosenuserid)?.additionalcollars && getCollar(chosenuserid)?.additionalcollars.length > 0) { - choices = getCollar(chosenuserid).additionalcollars.map((ac) => { return { name: getCollarName(undefined, ac), value: ac }}) + if (getCollar(interaction.guildId, chosenuserid)?.additionalcollars && getCollar(interaction.guildId, chosenuserid)?.additionalcollars.length > 0) { + choices = getCollar(interaction.guildId, chosenuserid).additionalcollars.map((ac) => { return { name: getCollarName(interaction.guildId, undefined, ac), value: ac }}) } } } @@ -419,17 +419,17 @@ module.exports = { // Check if the interaction user has access to clone the target restraint. let canclone = false; let chosenrestraintreadable; - if (chosenrestrainttoclone == "collar" && getCollar(wearertoclone.id) && canAccessCollar(wearertoclone.id, interaction.user.id, undefined, true).access) { + if (chosenrestrainttoclone == "collar" && getCollar(interaction.guildId, wearertoclone.id) && canAccessCollar(interaction.guildId, wearertoclone.id, interaction.user.id, undefined, true).access) { canclone = true; chosenrestraintreadable = "collar"; choiceemoji = `${process.emojis.collar}`; } - if (chosenrestrainttoclone == "chastitybelt" && getChastity(wearertoclone.id) && canAccessChastity(wearertoclone.id, interaction.user.id, undefined, true).access) { + if (chosenrestrainttoclone == "chastitybelt" && getChastity(interaction.guildId, wearertoclone.id) && canAccessChastity(interaction.guildId, wearertoclone.id, interaction.user.id, undefined, true).access) { canclone = true; chosenrestraintreadable = "chastity belt"; choiceemoji = `${process.emojis.chastity}`; } - if (chosenrestrainttoclone == "chastitybra" && getChastityBra(wearertoclone.id) && canAccessChastityBra(wearertoclone.id, interaction.user.id, undefined, true).access) { + if (chosenrestrainttoclone == "chastitybra" && getChastityBra(interaction.guildId, wearertoclone.id) && canAccessChastityBra(interaction.guildId, wearertoclone.id, interaction.user.id, undefined, true).access) { canclone = true; chosenrestraintreadable = "chastity bra"; choiceemoji = `${process.emojis.chastitybra}`; @@ -446,7 +446,7 @@ module.exports = { } // If the wearer has disabled key cloning, tell them to leave. - if (getOption(wearertoclone.id, "keycloning") == "disabled") { + if (getOption(interaction.guildId, wearertoclone.id, "keycloning") == "disabled") { interaction.reply({ content: `${wearertoclone} has disabled key cloning.`, flags: MessageFlags.Ephemeral }); return; } @@ -477,8 +477,8 @@ module.exports = { if (confirmation.customId === "agreetoclonebutton") { // Skip the DM if it's the wearer giving a clone of their key. - if (wearertoclone == interaction.user || wearertoclone == clonedkeyholder || getOption(wearertoclone.id, "keycloning") == "auto") { - let data = { textarray: "texts_key", textdata: { interactionuser: interaction.user, targetuser: wearertoclone, c1: chosenrestraintreadable, c2: clonedkeyholder } }; + if (wearertoclone == interaction.user || wearertoclone == clonedkeyholder || getOption(interaction.guildId, wearertoclone.id, "keycloning") == "auto") { + let data = { textarray: "texts_key", textdata: { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearertoclone, c1: chosenrestraintreadable, c2: clonedkeyholder } }; let cloneaccept; console.log(cloneaccept); data.clone = true; @@ -493,29 +493,29 @@ module.exports = { if (chosenrestrainttoclone == "collar") { await confirmation.update({ content: getTextGeneric(cloneaccept, data.textdata), components: [] }); await confirmation.followUp(getText(data)); - cloneCollarKey(wearertoclone.id, clonedkeyholder.id); + cloneCollarKey(interaction.guildId, wearertoclone.id, clonedkeyholder.id); } else if (chosenrestrainttoclone == "chastitybelt") { await confirmation.update({ content: getTextGeneric(cloneaccept, data.textdata), components: [] }); await confirmation.followUp(getText(data)); - cloneChastityKey(wearertoclone.id, clonedkeyholder.id); + cloneChastityKey(interaction.guildId, wearertoclone.id, clonedkeyholder.id); } else if (chosenrestrainttoclone == "chastitybra") { await confirmation.update({ content: getTextGeneric(cloneaccept, data.textdata), components: [] }); await confirmation.followUp(getText(data)); - cloneChastityBraKey(wearertoclone.id, clonedkeyholder.id); + cloneChastityBraKey(interaction.guildId, wearertoclone.id, clonedkeyholder.id); } } else { await confirmation.update({ content: `Prompting the user for permission.`, components: [] }); if (chosenrestrainttoclone == "collar") { - let canRemove = await promptCloneCollarKey(interaction.user, wearertoclone, clonedkeyholder).then( + let canRemove = await promptCloneCollarKey(interaction.guildId, interaction.user, wearertoclone, clonedkeyholder).then( async (res) => { // User said yes - let data = { textarray: "texts_key", textdata: { interactionuser: interaction.user, targetuser: wearertoclone, c1: chosenrestraintreadable, c2: clonedkeyholder } }; + let data = { textarray: "texts_key", textdata: { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearertoclone, c1: chosenrestraintreadable, c2: clonedkeyholder } }; data.clone = true; data.other = true; data[chosenrestrainttoclone] = true; await confirmation.editReply(getTextGeneric("clone_accept", data.textdata)); await confirmation.followUp(getText(data)); - cloneCollarKey(wearertoclone.id, clonedkeyholder.id); + cloneCollarKey(interaction.guildId, wearertoclone.id, clonedkeyholder.id); }, async (rej) => { // User said no. @@ -523,16 +523,16 @@ module.exports = { }, ); } else if (chosenrestrainttoclone == "chastitybelt") { - let canRemove = await promptCloneChastityKey(interaction.user, wearertoclone, clonedkeyholder).then( + let canRemove = await promptCloneChastityKey(interaction.guildId, interaction.user, wearertoclone, clonedkeyholder).then( async (res) => { // User said yes - let data = { textarray: "texts_key", textdata: { interactionuser: interaction.user, targetuser: wearertoclone, c1: chosenrestraintreadable, c2: clonedkeyholder } }; + let data = { textarray: "texts_key", textdata: { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearertoclone, c1: chosenrestraintreadable, c2: clonedkeyholder } }; data.clone = true; data.other = true; data[chosenrestrainttoclone] = true; await confirmation.editReply(getTextGeneric("clone_accept", data.textdata)); await confirmation.followUp(getText(data)); - cloneChastityKey(wearertoclone.id, clonedkeyholder.id); + cloneChastityKey(interaction.guildId, wearertoclone.id, clonedkeyholder.id); }, async (rej) => { // User said no. @@ -540,16 +540,16 @@ module.exports = { }, ); } else if (chosenrestrainttoclone == "chastitybra") { - let canRemove = await promptCloneChastityBraKey(interaction.user, wearertoclone, clonedkeyholder).then( + let canRemove = await promptCloneChastityBraKey(interaction.guildId, interaction.user, wearertoclone, clonedkeyholder).then( async (res) => { // User said yes - let data = { textarray: "texts_key", textdata: { interactionuser: interaction.user, targetuser: wearertoclone, c1: chosenrestraintreadable, c2: clonedkeyholder } }; + let data = { textarray: "texts_key", textdata: { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearertoclone, c1: chosenrestraintreadable, c2: clonedkeyholder } }; data.clone = true; data.other = true; data[chosenrestrainttoclone] = true; await confirmation.editReply(getTextGeneric("clone_accept", data.textdata)); await confirmation.followUp(getText(data)); - cloneChastityBraKey(wearertoclone.id, clonedkeyholder.id); + cloneChastityBraKey(interaction.guildId, wearertoclone.id, clonedkeyholder.id); }, async (rej) => { // User said no. @@ -590,33 +590,33 @@ module.exports = { let isclone = false; let typeofrestraintreadable; // Has primary keys to the collar! - if (typeofrestraint == "collar" && getCollar(wearer.id) && canAccessCollar(wearer.id, interaction.user.id, undefined, true).access) { + if (typeofrestraint == "collar" && getCollar(interaction.guildId, wearer.id) && canAccessCollar(interaction.guildId, wearer.id, interaction.user.id, undefined, true).access) { canrevoke = true; typeofrestraintreadable = "collar"; choiceemoji = `${process.emojis.collar}`; } - if (typeofrestraint == "chastitybelt" && getChastity(wearer.id) && canAccessChastity(wearer.id, interaction.user.id, undefined, true).access) { + if (typeofrestraint == "chastitybelt" && getChastity(interaction.guildId, wearer.id) && canAccessChastity(interaction.guildId, wearer.id, interaction.user.id, undefined, true).access) { canrevoke = true; typeofrestraintreadable = "chastity belt"; choiceemoji = `${process.emojis.chastity}`; } - if (typeofrestraint == "chastitybra" && getChastityBra(wearer.id) && canAccessChastityBra(wearer.id, interaction.user.id, undefined, true).access) { + if (typeofrestraint == "chastitybra" && getChastityBra(interaction.guildId, wearer.id) && canAccessChastityBra(interaction.guildId, wearer.id, interaction.user.id, undefined, true).access) { canrevoke = true; typeofrestraintreadable = "chastity bra"; choiceemoji = `${process.emojis.chastitybra}`; } // Allow cloned key to be revoked if the cloned keyholder is the interaction user. - if (typeofrestraint == "collar" && getCollar(wearer.id) && canAccessCollar(wearer.id, interaction.user.id).access && clonedkeyholder.id == interaction.user.id) { + if (typeofrestraint == "collar" && getCollar(interaction.guildId, wearer.id) && canAccessCollar(interaction.guildId, wearer.id, interaction.user.id).access && clonedkeyholder.id == interaction.user.id) { canrevoke = true; typeofrestraintreadable = "collar"; choiceemoji = `${process.emojis.collar}`; } - if (typeofrestraint == "chastitybelt" && getChastity(wearer.id) && canAccessChastity(wearer.id, interaction.user.id).access && clonedkeyholder.id == interaction.user.id) { + if (typeofrestraint == "chastitybelt" && getChastity(interaction.guildId, wearer.id) && canAccessChastity(interaction.guildId, wearer.id, interaction.user.id).access && clonedkeyholder.id == interaction.user.id) { canrevoke = true; typeofrestraintreadable = "chastity belt"; choiceemoji = `${process.emojis.chastity}`; } - if (typeofrestraint == "chastitybra" && getChastityBra(wearer.id) && canAccessChastityBra(wearer.id, interaction.user.id).access && clonedkeyholder.id == interaction.user.id) { + if (typeofrestraint == "chastitybra" && getChastityBra(interaction.guildId, wearer.id) && canAccessChastityBra(interaction.guildId, wearer.id, interaction.user.id).access && clonedkeyholder.id == interaction.user.id) { canrevoke = true; typeofrestraintreadable = "chastity bra"; choiceemoji = `${process.emojis.chastitybra}`; @@ -649,7 +649,7 @@ module.exports = { let verifyresponse = `Revoking the cloned keys for ${choiceemoji}${wearer} from šŸ”‘${clonedkeyholder}. ${clonedkeyholder} will no longer have access to ${wearer}'s ${typeofrestraintreadable}.\n\nPlease confirm by pressing the button below:`; if (wearer.id == clonedkeyholder.id) { // they hold their own cloned key. - verifyresponse = `Revoking the cloned keys for ${choiceemoji}${wearer} from šŸ”‘${clonedkeyholder}. ${getPronouns(clonedkeyholder.id, "subject", true)} will no longer have access to ${getPronouns(clonedkeyholder.id, "possessiveDeterminer")} ${typeofrestraintreadable}.\n\nPlease confirm by pressing the button below:`; + verifyresponse = `Revoking the cloned keys for ${choiceemoji}${wearer} from šŸ”‘${clonedkeyholder}. ${getPronouns(interaction.guildId, clonedkeyholder.id, "subject", true)} will no longer have access to ${getPronouns(interaction.guildId, clonedkeyholder.id, "possessiveDeterminer")} ${typeofrestraintreadable}.\n\nPlease confirm by pressing the button below:`; } if (isclone) { verifyresponse = `Revoking your cloned keys for ${choiceemoji}${wearer}. You will no longer have access to ${wearer}'s ${typeofrestraintreadable}.\n\nPlease confirm by pressing the button below:`; @@ -663,7 +663,7 @@ module.exports = { confirmation = await response.resource.message.awaitMessageComponent({ filter: collectorFilter, time: 300_000 }); if (confirmation.customId === "agreetorevokebutton") { - let data = { textarray: "texts_key", textdata: { interactionuser: interaction.user, targetuser: wearer, c1: typeofrestraintreadable, c2: clonedkeyholder } }; + let data = { textarray: "texts_key", textdata: { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearer, c1: typeofrestraintreadable, c2: clonedkeyholder } }; data.revoke = true; if (isclone) { data.isclone = true; @@ -674,15 +674,15 @@ module.exports = { if (typeofrestraint == "collar") { await confirmation.update({ content: getTextGeneric("revoke_accept", data.textdata), components: [] }); await confirmation.followUp(getText(data)); - revokeCollarKey(wearer.id, clonedkeyholder.id); + revokeCollarKey(interaction.guildId, wearer.id, clonedkeyholder.id); } else if (typeofrestraint == "chastitybelt") { await confirmation.update({ content: getTextGeneric("revoke_accept", data.textdata), components: [] }); await confirmation.followUp(getText(data)); - revokeChastityKey(wearer.id, clonedkeyholder.id); + revokeChastityKey(interaction.guildId, wearer.id, clonedkeyholder.id); } else if (typeofrestraint == "chastitybra") { await confirmation.update({ content: getTextGeneric("revoke_accept", data.textdata), components: [] }); await confirmation.followUp(getText(data)); - revokeChastityBraKey(wearer.id, clonedkeyholder.id); + revokeChastityBraKey(interaction.guildId, wearer.id, clonedkeyholder.id); } } else if (confirmation.customId === "cancel") { await confirmation.update({ content: "Action cancelled", components: [] }); @@ -713,17 +713,17 @@ module.exports = { // Check if the interaction user has access to give the key for the target restraint. let cangive = false; let chosenrestraintreadable; - if (restraint == "collar" && getCollar(wearer.id) && canAccessCollar(wearer.id, interaction.user.id, undefined, true).access) { + if (restraint == "collar" && getCollar(interaction.guildId, wearer.id) && canAccessCollar(interaction.guildId, wearer.id, interaction.user.id, undefined, true).access) { cangive = true; chosenrestraintreadable = "collar"; choiceemoji = `${process.emojis.collar}`; } - if (restraint == "chastitybelt" && getChastity(wearer.id) && canAccessChastity(wearer.id, interaction.user.id, undefined, true).access) { + if (restraint == "chastitybelt" && getChastity(interaction.guildId, wearer.id) && canAccessChastity(interaction.guildId, wearer.id, interaction.user.id, undefined, true).access) { cangive = true; chosenrestraintreadable = "chastity belt"; choiceemoji = `${process.emojis.chastity}`; } - if (restraint == "chastitybra" && getChastityBra(wearer.id) && canAccessChastityBra(wearer.id, interaction.user.id, undefined, true).access) { + if (restraint == "chastitybra" && getChastityBra(interaction.guildId, wearer.id) && canAccessChastityBra(interaction.guildId, wearer.id, interaction.user.id, undefined, true).access) { cangive = true; chosenrestraintreadable = "chastity bra"; choiceemoji = `${process.emojis.chastitybra}`; @@ -759,8 +759,8 @@ module.exports = { if (confirmation.customId === "agreetogivebutton") { // Skip the DM if the wearer is the giver or receiver, or if they have auto accepting enabled - if (wearer == interaction.user || wearer == newKeyholder || (getOption(wearer, "keygiving") == "auto")) { - let data = { textarray: "texts_key", textdata: { interactionuser: interaction.user, targetuser: wearer, c1: chosenrestraintreadable, c2: newKeyholder } }; + if (wearer == interaction.user || wearer == newKeyholder || (getOption(interaction.guildId, wearer, "keygiving") == "auto")) { + let data = { textarray: "texts_key", textdata: { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearer, c1: chosenrestraintreadable, c2: newKeyholder } }; data.give = true; if (wearer == interaction.user) { data.self = true; @@ -771,69 +771,69 @@ module.exports = { if (restraint == "collar") { await confirmation.update({ content: getTextGeneric("give_accept_self", data.textdata), components: [] }); await confirmation.followUp(getText(data)); - transferCollarKey(wearer.id, newKeyholder.id); + transferCollarKey(interaction.guildId, wearer.id, newKeyholder.id); } else if (restraint == "chastitybelt") { await confirmation.update({ content: getTextGeneric("give_accept_self", data.textdata), components: [] }); await confirmation.followUp(getText(data)); - transferChastityKey(wearer.id, newKeyholder.id); + transferChastityKey(interaction.guildId, wearer.id, newKeyholder.id); } else if (restraint == "chastitybra") { await confirmation.update({ content: getTextGeneric("give_accept_self", data.textdata), components: [] }); await confirmation.followUp(getText(data)); - transferChastityBraKey(wearer.id, newKeyholder.id); + transferChastityBraKey(interaction.guildId, wearer.id, newKeyholder.id); } } else { await confirmation.update({ content: `Prompting the user for permission.`, components: [] }); if (restraint == "collar") { - let canRemove = await promptTransferCollarKey(interaction.user, wearer, newKeyholder).then( + let canRemove = await promptTransferCollarKey(interaction.guildId, interaction.user, wearer, newKeyholder).then( async (res) => { // User said yes - let data = { textarray: "texts_key", textdata: { interactionuser: interaction.user, targetuser: wearer, c1: chosenrestraintreadable, c2: newKeyholder } }; + let data = { textarray: "texts_key", textdata: { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearer, c1: chosenrestraintreadable, c2: newKeyholder } }; data.give = true; data.other = true; data[restraint] = true; await confirmation.editReply(getTextGeneric("give_accept", data.textdata)); await confirmation.followUp(getText(data)); - transferCollarKey(wearer.id, newKeyholder.id); + transferCollarKey(interaction.guildId, wearer.id, newKeyholder.id); }, async (rej) => { // User said no. - let data = { textarray: "texts_key", textdata: { interactionuser: interaction.user, targetuser: wearer, c1: chosenrestraintreadable, c2: newKeyholder } }; + let data = { textarray: "texts_key", textdata: { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearer, c1: chosenrestraintreadable, c2: newKeyholder } }; await interaction.editReply(getTextGeneric("give_decline", data.textdata)); }, ); } else if (restraint == "chastitybelt") { - let canRemove = await promptTransferChastityKey(interaction.user, wearer, newKeyholder).then( + let canRemove = await promptTransferChastityKey(interaction.guildId, interaction.user, wearer, newKeyholder).then( async (res) => { // User said yes - let data = { textarray: "texts_key", textdata: { interactionuser: interaction.user, targetuser: wearer, c1: chosenrestraintreadable, c2: newKeyholder } }; + let data = { textarray: "texts_key", textdata: { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearer, c1: chosenrestraintreadable, c2: newKeyholder } }; data.give = true; data.other = true; data[restraint] = true; await confirmation.editReply(getTextGeneric("give_accept", data.textdata)); await confirmation.followUp(getText(data)); - transferChastityKey(wearer.id, newKeyholder.id); + transferChastityKey(interaction.guildId, wearer.id, newKeyholder.id); }, async (rej) => { // User said no. - let data = { textarray: "texts_key", textdata: { interactionuser: interaction.user, targetuser: wearer, c1: chosenrestraintreadable, c2: newKeyholder } }; + let data = { textarray: "texts_key", textdata: { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearer, c1: chosenrestraintreadable, c2: newKeyholder } }; await interaction.editReply(getTextGeneric("give_decline", data.textdata)); }, ); } else if (restraint == "chastitybra") { - let canRemove = await promptTransferChastityBraKey(interaction.user, wearer, newKeyholder).then( + let canRemove = await promptTransferChastityBraKey(interaction.guildId, interaction.user, wearer, newKeyholder).then( async (res) => { // User said yes - let data = { textarray: "texts_key", textdata: { interactionuser: interaction.user, targetuser: wearer, c1: chosenrestraintreadable, c2: newKeyholder } }; + let data = { textarray: "texts_key", textdata: { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearer, c1: chosenrestraintreadable, c2: newKeyholder } }; data.give = true; data.other = true; data[restraint] = true; await confirmation.editReply(getTextGeneric("give_accept", data.textdata)); await confirmation.followUp(getText(data)); - transferChastityBraKey(wearer.id, newKeyholder.id); + transferChastityBraKey(interaction.guildId, wearer.id, newKeyholder.id); }, async (rej) => { // User said no. - let data = { textarray: "texts_key", textdata: { interactionuser: interaction.user, targetuser: wearer, c1: chosenrestraintreadable, c2: newKeyholder } }; + let data = { textarray: "texts_key", textdata: { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearer, c1: chosenrestraintreadable, c2: newKeyholder } }; await interaction.editReply(getTextGeneric("give_decline", data.textdata)); }, ); @@ -861,18 +861,18 @@ module.exports = { let newrestraintname; let permitted = false; if (restrainttype == "collar") { - newrestraintname = getCollarName(undefined, newrestraint); - if (getCollar(wearer.id) && canAccessCollar(wearer.id, interaction.user.id, true).access) { + newrestraintname = getCollarName(interaction.guildId, undefined, newrestraint); + if (getCollar(wearer.id) && canAccessCollar(interaction.guildId, wearer.id, interaction.user.id, true).access) { permitted = true; } } else if (restrainttype == "chastitybelt") { - newrestraintname = getChastityName(undefined, newrestraint); - if (getChastity(wearer.id) && canAccessChastity(wearer.id, interaction.user.id, true).access) { + newrestraintname = getChastityName(interaction.guildId, undefined, newrestraint); + if (getChastity(wearer.id) && canAccessChastity(interaction.guildId, wearer.id, interaction.user.id, true).access) { permitted = true; } } else if (restrainttype == "chastitybra") { - newrestraintname = getChastityBraName(undefined, newrestraint); - if (getChastityBra(wearer.id) && canAccessChastityBra(wearer.id, interaction.user.id, true).access) { + newrestraintname = getChastityBraName(interaction.guildId, undefined, newrestraint); + if (getChastityBra(wearer.id) && canAccessChastityBra(interaction.guildId, wearer.id, interaction.user.id, true).access) { permitted = true; } } @@ -887,21 +887,21 @@ module.exports = { } // Okay they're probably allowed lol - let data = { textarray: "texts_key", textdata: { interactionuser: interaction.user, targetuser: wearer } }; + let data = { textarray: "texts_key", textdata: { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearer } }; data.swapitem = true; if (interaction.user.id == wearer.id) { // swapping own keyed item data.self = true; data[restrainttype] = true; if (restrainttype == "collar") { - data.textdata.c1 = getCollarName(wearer.id, getCollar(wearer.id).collartype) ?? "collar"; // Old collar + data.textdata.c1 = getCollarName(interaction.guildId, wearer.id, getCollar(interaction.guildId, wearer.id).collartype) ?? "collar"; // Old collar data.textdata.c2 = newrestraintname; await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleExtremeRestraint(interaction.user, wearer, "collar", newrestraint).then( + await handleExtremeRestraint(interaction.guildId, interaction.user, wearer, "collar", newrestraint).then( async (success) => { await interaction.followUp({ content: `Swapping your collar to the ${data.textdata.c2}.`, flags: MessageFlags.Ephemeral }) await interaction.followUp({ content: getText(data) }) - getCollar(wearer.id).collartype = newrestraint; + getCollar(interaction.guildId, wearer.id).collartype = newrestraint; markForSave("collar"); }, async (reject) => { @@ -909,14 +909,14 @@ module.exports = { } ) } else if (restrainttype == "chastitybelt") { - data.textdata.c1 = getChastityName(wearer.id, getChastity(wearer.id).chastitytype) ?? "chastity belt"; // Old collar + data.textdata.c1 = getChastityName(interaction.guildId, wearer.id, getChastity(interaction.guildId, wearer.id).chastitytype) ?? "chastity belt"; // Old collar data.textdata.c2 = newrestraintname; - if(!swapChastity(wearer.id, interaction.user.id, newrestraint)){ interaction.reply({ content: `The chastity belt couldn't be unlocked.`, flags: MessageFlags.Ephemeral }); return; } + if(!swapChastity(interaction.guildId, wearer.id, interaction.user.id, newrestraint)){ interaction.reply({ content: `The chastity belt couldn't be unlocked.`, flags: MessageFlags.Ephemeral }); return; } interaction.reply(getText(data)); } else if (restrainttype == "chastitybra") { - data.textdata.c1 = getChastityBraName(wearer.id, getChastityBra(wearer.id).chastitytype) ?? "chastity bra"; // Old collar + data.textdata.c1 = getChastityBraName(interaction.guildId, wearer.id, getChastityBra(interaction.guildId, wearer.id).chastitytype) ?? "chastity bra"; // Old collar data.textdata.c2 = newrestraintname; - if(!swapChastityBra(wearer.id, interaction.user.id, newrestraint)){ interaction.reply({ content: `The chastity bra couldn't be unlocked.`, flags: MessageFlags.Ephemeral }); return; } + if(!swapChastityBra(interaction.guildId, wearer.id, interaction.user.id, newrestraint)){ interaction.reply({ content: `The chastity bra couldn't be unlocked.`, flags: MessageFlags.Ephemeral }); return; } interaction.reply(getText(data)); } } else { @@ -924,14 +924,14 @@ module.exports = { data.other = true; data[restrainttype] = true; if (restrainttype == "collar") { - data.textdata.c1 = getCollarName(wearer.id, getCollar(wearer.id).collartype) ?? "collar"; // Old collar + data.textdata.c1 = getCollarName(interaction.guildId, wearer.id, getCollar(interaction.guildId, wearer.id).collartype) ?? "collar"; // Old collar data.textdata.c2 = newrestraintname; await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleExtremeRestraint(interaction.user, wearer, "collar", newrestraint).then( + await handleExtremeRestraint(interaction.guildId, interaction.user, wearer, "collar", newrestraint).then( async (success) => { await interaction.followUp({ content: `Swapping ${wearer}'s collar to the ${data.textdata.c2}.`, flags: MessageFlags.Ephemeral }) await interaction.followUp({ content: getText(data) }) - getCollar(wearer.id).collartype = newrestraint; + getCollar(interaction.guildId, wearer.id).collartype = newrestraint; markForSave("collar"); }, async (reject) => { @@ -939,15 +939,15 @@ module.exports = { } ) } else if (restrainttype == "chastitybelt") { - data.textdata.c1 = getChastityName(wearer.id, getChastity(wearer.id).chastitytype) ?? "chastity belt"; // Old collar + data.textdata.c1 = getChastityName(interaction.guildId, wearer.id, getChastity(interaction.guildId, wearer.id).chastitytype) ?? "chastity belt"; // Old collar data.textdata.c2 = newrestraintname; - if(!swapChastity(wearer.id, interaction.user.id, newrestraint)){ interaction.reply({ content: `The chastity belt couldn't be unlocked.`, flags: MessageFlags.Ephemeral }); return; } // I'm gonna leave this like this for now. Maybe once we have belts that can fail to unlock we can improve this. + if(!swapChastity(interaction.guildId, wearer.id, interaction.user.id, newrestraint)){ interaction.reply({ content: `The chastity belt couldn't be unlocked.`, flags: MessageFlags.Ephemeral }); return; } // I'm gonna leave this like this for now. Maybe once we have belts that can fail to unlock we can improve this. markForSave("chastity"); interaction.reply(getText(data)); } else if (restrainttype == "chastitybra") { - data.textdata.c1 = getChastityBraName(wearer.id, getChastityBra(wearer.id).chastitytype) ?? "chastity bra"; // Old collar + data.textdata.c1 = getChastityBraName(interaction.guildId, wearer.id, getChastityBra(interaction.guildId, wearer.id).chastitytype) ?? "chastity bra"; // Old collar data.textdata.c2 = newrestraintname; - if(!swapChastityBra(wearer.id, interaction.user.id, newrestraint)){ interaction.reply({ content: `The chastity bra couldn't be unlocked.`, flags: MessageFlags.Ephemeral }); return; } + if(!swapChastityBra(interaction.guildId, wearer.id, interaction.user.id, newrestraint)){ interaction.reply({ content: `The chastity bra couldn't be unlocked.`, flags: MessageFlags.Ephemeral }); return; } markForSave("chastitybra"); interaction.reply(getText(data)); } @@ -964,16 +964,16 @@ module.exports = { let discardedhelp = "collar"; let permitted = false; if (restrainttype == "collar") { - if (getCollar(wearer.id) && getCollar(wearer.id).keyholder == interaction.user.id && !getCollar(wearer.id)?.fumbled) { + if (getCollar(interaction.guildId, wearer.id) && getCollar(interaction.guildId, wearer.id).keyholder == interaction.user.id && !getCollar(interaction.guildId, wearer.id)?.fumbled) { permitted = true; } } else if (restrainttype == "chastitybelt") { - if (getChastity(wearer.id) && getChastity(wearer.id).keyholder == interaction.user.id && !getChastity(wearer.id)?.fumbled) { + if (getChastity(interaction.guildId, wearer.id) && getChastity(interaction.guildId, wearer.id).keyholder == interaction.user.id && !getChastity(interaction.guildId, wearer.id)?.fumbled) { discardedhelp = "chastity belt" permitted = true; } } else if (restrainttype == "chastitybra") { - if (getChastityBra(wearer.id) && getChastityBra(wearer.id).keyholder == interaction.user.id && !getChastityBra(wearer.id)?.fumbled) { + if (getChastityBra(interaction.guildId, wearer.id) && getChastityBra(interaction.guildId, wearer.id).keyholder == interaction.user.id && !getChastityBra(interaction.guildId, wearer.id)?.fumbled) { discardedhelp = "chastity bra" permitted = true; } @@ -988,13 +988,14 @@ module.exports = { // Okay they're probably allowed lol let data = { textarray: "texts_key", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearer, c1: discardedhelp }, }; data.discardkey = true; - let discardedkey = discardKey(wearer.id, interaction.user.id, discardedhelp); + let discardedkey = discardKey(interaction.guildId, wearer.id, interaction.user.id, discardedhelp); if (wearer.id == interaction.user.id) { data.self = true } @@ -1005,14 +1006,14 @@ module.exports = { interaction.reply(getText(data)); } else if (subcommand == "menu") { - interaction.reply(await generateKeyGivingModal(interaction.user.id, undefined, undefined, "0000")) + interaction.reply(await generateKeyGivingModal(interaction.guildId, interaction.user.id, undefined, undefined, "0000")) } else if (subcommand == "additionalcollar") { // Handling additional collar effects! let wearer = interaction.options.getUser("wearer") ?? interaction.user; let additionaltype = interaction.options.getString("type"); // "additionalcollar_add", "additionalcollar_remove" let collareffect = interaction.options.getString("collareffect"); // eligible collar type! - let collarkeyholder = canAccessCollar(wearer.id, interaction.user.id, true).access + let collarkeyholder = canAccessCollar(interaction.guildId, wearer.id, interaction.user.id, true).access if ((!collarkeyholder) || (collareffect == "nokeys")) { // If we do not have the target's collar keys, go away. if (interaction.user.id == wearer.id) { @@ -1033,7 +1034,7 @@ module.exports = { else { // Check their tags and make sure they're okay with this. let blocked = false; - let tags = getUserTags(wearer.id); + let tags = getUserTags(interaction.guildId, wearer.id); let i = getBaseCollar(collareffect) tags.forEach((t) => { if (i && i.tags && i.tags[t] && (wearer != interaction.user)) { @@ -1049,10 +1050,11 @@ module.exports = { // Okay they're probably allowed lol let data = { textarray: "texts_key", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearer, c1: getBaseCollar(collareffect)?.name, - c2: getBaseCollar(getCollar(wearer.id)?.collartype)?.name ?? "collar" + c2: getBaseCollar(getCollar(interaction.guildId, wearer.id)?.collartype)?.name ?? "collar" }, }; data.additionalcollar = true; @@ -1064,11 +1066,11 @@ module.exports = { } data.add = true; await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleExtremeRestraint(interaction.user, wearer, "collar", collareffect).then( + await handleExtremeRestraint(interaction.guildId, interaction.user, wearer, "collar", collareffect).then( async (success) => { await interaction.followUp({ content: `Applying the ${data.textdata.c1} effect`, flags: MessageFlags.Ephemeral }) await interaction.followUp({ content: getText(data) }) - addAdditionalCollarEffect(wearer.id, collareffect); + addAdditionalCollarEffect(interaction.guildId, wearer.id, collareffect); }, async (reject) => { await interaction.followUp({ content: `The ${data.textdata.c1} effect was rejected.`, flags: MessageFlags.Ephemeral }) @@ -1088,7 +1090,7 @@ module.exports = { interactionuser: interaction.user, targetuser: wearer, c1: getBaseCollar(collareffect)?.name, - c2: getBaseCollar(getCollar(wearer.id)?.collartype)?.name ?? "collar" + c2: getBaseCollar(getCollar(interaction.guildId, wearer.id)?.collartype)?.name ?? "collar" }, }; data.additionalcollar = true; @@ -1100,7 +1102,7 @@ module.exports = { } data.remove = true; interaction.reply({ content: getText(data) }) - removeAdditionalCollarEffect(wearer.id, collareffect); + removeAdditionalCollarEffect(interaction.guildId, wearer.id, collareffect); } } } @@ -1117,13 +1119,13 @@ module.exports = { // Check if the interaction user has access to discard the key for target restraint. let candiscard = false; - if (chosenrestrainttoclone == "collar" && getCollar(wearertodiscard.id) && canAccessCollar(wearertodiscard.id, interaction.user.id, undefined, true).access) { + if (chosenrestrainttoclone == "collar" && getCollar(interaction.guildId, wearertodiscard.id) && canAccessCollar(interaction.guildId, wearertodiscard.id, interaction.user.id, undefined, true).access) { candiscard = true } - if (chosenrestrainttoclone == "chastitybelt" && getChastity(wearertodiscard.id) && canAccessChastity(wearertodiscard.id, interaction.user.id, undefined, true).access) { + if (chosenrestrainttoclone == "chastitybelt" && getChastity(interaction.guildId, wearertodiscard.id) && canAccessChastity(interaction.guildId, wearertodiscard.id, interaction.user.id, undefined, true).access) { candiscard = true } - if (chosenrestrainttoclone == "chastitybra" && getChastityBra(wearertodiscard.id) && canAccessChastityBra(wearertodiscard.id, interaction.user.id, undefined, true).access) { + if (chosenrestrainttoclone == "chastitybra" && getChastityBra(interaction.guildId, wearertodiscard.id) && canAccessChastityBra(interaction.guildId, wearertodiscard.id, interaction.user.id, undefined, true).access) { candiscard = true } if (!candiscard) { @@ -1151,6 +1153,7 @@ module.exports = { let data = { textarray: "texts_key", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearertodiscard, }, @@ -1166,16 +1169,16 @@ module.exports = { data.keyholder = true; if ((chosenrestrainttoclone == "chastitybelt")) { - data.textdata.c1 = getBaseChastity(getChastity(wearertodiscard.id)?.chastitytype ?? `belt_silver`).name - discardKey(wearertodiscard.id, interaction.user.id, "chastity belt"); + data.textdata.c1 = getBaseChastity(getChastity(interaction.guildId, wearertodiscard.id)?.chastitytype ?? `belt_silver`).name + discardKey(interaction.guildId, wearertodiscard.id, interaction.user.id, "chastity belt"); } else if ((chosenrestrainttoclone == "chastitybra")) { - data.textdata.c1 = getBaseChastity(getChastityBra(wearertodiscard.id)?.chastitytype ?? `bra_silver`).name - discardKey(wearertodiscard.id, interaction.user.id, "chastity bra"); + data.textdata.c1 = getBaseChastity(getChastityBra(interaction.guildId, wearertodiscard.id)?.chastitytype ?? `bra_silver`).name + discardKey(interaction.guildId, wearertodiscard.id, interaction.user.id, "chastity bra"); } else if (chosenrestrainttoclone == "collar") { // Why the fuck is .collartype ever storing a string value named "null"!? - let collartype = getCollar(wearertodiscard.id).collartype + let collartype = getCollar(interaction.guildId, wearertodiscard.id).collartype if (collartype == "null") { collartype = `collar_leather` data.textdata.c1 = `collar` @@ -1205,7 +1208,7 @@ module.exports = { else { newkeybit = `0${newkeybit.slice(1)}` } - await interaction.update(await generateKeyGivingModal(interaction.user.id, optionparts[3], optionparts[4], newkeybit)); + await interaction.update(await generateKeyGivingModal(interaction.guildId, interaction.user.id, optionparts[3], optionparts[4], newkeybit)); } else if (optionparts[1] == "key") { let newkeybit = optionparts[5] @@ -1233,7 +1236,7 @@ module.exports = { newkeybit = `${newkeybit.slice(0,3)}0}` } } - await interaction.update(await generateKeyGivingModal(interaction.user.id, optionparts[3], optionparts[4], newkeybit)); + await interaction.update(await generateKeyGivingModal(interaction.guildId, interaction.user.id, optionparts[3], optionparts[4], newkeybit)); } else if (optionparts[1] == "select") { let newkeybit = optionparts[5] @@ -1242,14 +1245,14 @@ module.exports = { if (interaction.values) { newwearer = interaction.values[0] } - await interaction.update(await generateKeyGivingModal(interaction.user.id, newwearer, optionparts[4], optionparts[5])); + await interaction.update(await generateKeyGivingModal(interaction.guildId, interaction.user.id, newwearer, optionparts[4], optionparts[5])); } if (optionparts[2] == "targetid") { let newtarget = optionparts[4] if (interaction.values) { newtarget = interaction.values[0] } - await interaction.update(await generateKeyGivingModal(interaction.user.id, optionparts[3], newtarget, optionparts[5])); + await interaction.update(await generateKeyGivingModal(interaction.guildId, interaction.user.id, optionparts[3], newtarget, optionparts[5])); } } else if (optionparts[1] == "confirm") { @@ -1262,9 +1265,9 @@ module.exports = { // Check each restraint individually. We need to verify we have primary key on it, and if a cloning, we need to ensure the target does not already have a clone // Chastity - if ((keybit.charAt(1) == "1") && (getChastity(wearerid)?.keyholder == interaction.user.id) && (!getChastity(wearerid)?.fumbled)) { + if ((keybit.charAt(1) == "1") && (getChastity(interaction.guildId, wearerid)?.keyholder == interaction.user.id) && (!getChastity(interaction.guildId, wearerid)?.fumbled)) { if (keybit.charAt(0) == "1") { - if (!(getChastity(wearerid)?.clonedKeyholders && getChastity(wearerid)?.clonedKeyholders.includes(targetid))) { + if (!(getChastity(interaction.guildId, wearerid)?.clonedKeyholders && getChastity(interaction.guildId, wearerid)?.clonedKeyholders.includes(targetid))) { validrestraints.push("chastity"); } } @@ -1273,9 +1276,9 @@ module.exports = { } } // Chastity Bra - if ((keybit.charAt(2) == "1") && (getChastityBra(wearerid)?.keyholder == interaction.user.id) && (!getChastityBra(wearerid)?.fumbled)) { + if ((keybit.charAt(2) == "1") && (getChastityBra(interaction.guildId, wearerid)?.keyholder == interaction.user.id) && (!getChastityBra(interaction.guildId, wearerid)?.fumbled)) { if (keybit.charAt(0) == "1") { - if (!(getChastityBra(wearerid)?.clonedKeyholders && getChastityBra(wearerid)?.clonedKeyholders.includes(targetid))) { + if (!(getChastityBra(interaction.guildId, wearerid)?.clonedKeyholders && getChastityBra(interaction.guildId, wearerid)?.clonedKeyholders.includes(targetid))) { validrestraints.push("chastitybra"); } } @@ -1284,9 +1287,9 @@ module.exports = { } } // Collar - if ((keybit.charAt(3) == "1") && (getCollar(wearerid)?.keyholder == interaction.user.id) && (!getCollar(wearerid)?.fumbled)) { + if ((keybit.charAt(3) == "1") && (getCollar(interaction.guildId, wearerid)?.keyholder == interaction.user.id) && (!getCollar(interaction.guildId, wearerid)?.fumbled)) { if (keybit.charAt(0) == "1") { - if (!(getCollar(wearerid)?.clonedKeyholders && getCollar(wearerid)?.clonedKeyholders.includes(targetid))) { + if (!(getCollar(interaction.guildId, wearerid)?.clonedKeyholders && getCollar(interaction.guildId, wearerid)?.clonedKeyholders.includes(targetid))) { validrestraints.push("collar"); } } @@ -1303,8 +1306,8 @@ module.exports = { // Determine if we can shortcut the requesting process. let giveauto = false; - if (((getOption(wearerid, "keygiving") == "auto") && (keybit.charAt(0) == "0")) || - ((getOption(wearerid, "keycloning") == "auto") && (keybit.charAt(0) == "1"))) { + if (((getOption(interaction.guildId, wearerid, "keygiving") == "auto") && (keybit.charAt(0) == "0")) || + ((getOption(interaction.guildId, wearerid, "keycloning") == "auto") && (keybit.charAt(0) == "1"))) { giveauto = true; } if ((interaction.user.id == wearerid) || (wearerid == targetid)) { @@ -1337,7 +1340,7 @@ module.exports = { if (keybit.charAt(0) == "0") { // Give outtext = `<@${interaction.user.id}> would like to give the keys for your ` - outend = ` to <@${targetid}>. \n*${getPronouns(interaction.user.id, "subject", true)} will no longer have access to your restraint*\n\n**Accept** or **Deny** this request below:` + outend = ` to <@${targetid}>. \n*${getPronouns(interaction.guildId, interaction.user.id, "subject", true)} will no longer have access to your restraint*\n\n**Accept** or **Deny** this request below:` } else { // Clone @@ -1368,35 +1371,35 @@ module.exports = { i.reply(`Confirmed - <@${targetid}> will receive keys to your restraints!`); }); let wearertext = (wearerid == interaction.user.id) ? `your` : `<@${wearerid}>'s` - let desttext = (targetid == wearerid) ? `${getPronouns(wearerid, "object")}` : `<@${targetid}>` + let desttext = (targetid == wearerid) ? `${getPronouns(interaction.guildId, wearerid, "object")}` : `<@${targetid}>` // Do stuff! // Chastity if ((keybit.charAt(1) == "1") && validrestraints.includes("chastity")) { if (keybit.charAt(0) == "0") { // Give - transferChastityKey(wearerid, targetid); + transferChastityKey(interaction.guildId, wearerid, targetid); } else { - cloneChastityKey(wearerid, targetid); + cloneChastityKey(interaction.guildId, wearerid, targetid); } } if ((keybit.charAt(2) == "1") && validrestraints.includes("chastitybra")) { if (keybit.charAt(0) == "0") { // Give - transferChastityBraKey(wearerid, targetid); + transferChastityBraKey(interaction.guildId, wearerid, targetid); } else { - cloneChastityBraKey(wearerid, targetid); + cloneChastityBraKey(interaction.guildId, wearerid, targetid); } } if ((keybit.charAt(3) == "1") && validrestraints.includes("collar")) { if (keybit.charAt(0) == "0") { // Give - transferCollarKey(wearerid, targetid); + transferCollarKey(interaction.guildId, wearerid, targetid); } else { - cloneCollarKey(wearerid, targetid); + cloneCollarKey(interaction.guildId, wearerid, targetid); } } interaction.editReply(`${(keybit.charAt(0) == "0") ? `Transferred ` : `Cloned `}keys for ${wearertext} ${restraintstext} to ${desttext}.`) - interaction.followUp(`${interaction.user} ${(keybit.charAt(0) == "0") ? `transfers ` : `clones `}keys for ${(wearerid == interaction.user.id) ? getPronouns(interaction.user.id, "possessiveDeterminer") : wearertext} ${restraintstext} and gives them to ${desttext}.`) + interaction.followUp(`${interaction.user} ${(keybit.charAt(0) == "0") ? `transfers ` : `clones `}keys for ${(wearerid == interaction.user.id) ? getPronouns(interaction.guildId, interaction.user.id, "possessiveDeterminer") : wearertext} ${restraintstext} and gives them to ${desttext}.`) return; } else { await mess.delete().then(() => { @@ -1424,35 +1427,35 @@ module.exports = { } else { let wearertext = (wearerid == interaction.user.id) ? `your` : `<@${wearerid}>'s` - let desttext = (targetid == wearerid) ? `${getPronouns(wearerid, "object")}` : `<@${targetid}>` + let desttext = (targetid == wearerid) ? `${getPronouns(interaction.guildId, wearerid, "object")}` : `<@${targetid}>` // Do stuff! // Chastity if ((keybit.charAt(1) == "1") && validrestraints.includes("chastity")) { if (keybit.charAt(0) == "0") { // Give - transferChastityKey(wearerid, targetid); + transferChastityKey(interaction.guildId, wearerid, targetid); } else { - cloneChastityKey(wearerid, targetid); + cloneChastityKey(interaction.guildId, wearerid, targetid); } } if ((keybit.charAt(2) == "1") && validrestraints.includes("chastitybra")) { if (keybit.charAt(0) == "0") { // Give - transferChastityBraKey(wearerid, targetid); + transferChastityBraKey(interaction.guildId, wearerid, targetid); } else { - cloneChastityBraKey(wearerid, targetid); + cloneChastityBraKey(interaction.guildId, wearerid, targetid); } } if ((keybit.charAt(3) == "1") && validrestraints.includes("collar")) { if (keybit.charAt(0) == "0") { // Give - transferCollarKey(wearerid, targetid); + transferCollarKey(interaction.guildId, wearerid, targetid); } else { - cloneCollarKey(wearerid, targetid); + cloneCollarKey(interaction.guildId, wearerid, targetid); } } interaction.editReply(`${(keybit.charAt(0) == "0") ? `Transferred ` : `Cloned `}keys for ${wearertext} ${restraintstext} to ${desttext}.`) - interaction.followUp(`${interaction.user} ${(keybit.charAt(0) == "0") ? `transfers ` : `clones `}keys for ${(wearerid == interaction.user.id) ? getPronouns(interaction.user.id, "possessiveDeterminer") : wearertext} ${restraintstext} and gives them to ${desttext}.`) + interaction.followUp(`${interaction.user} ${(keybit.charAt(0) == "0") ? `transfers ` : `clones `}keys for ${(wearerid == interaction.user.id) ? getPronouns(interaction.guildId, interaction.user.id, "possessiveDeterminer") : wearertext} ${restraintstext} and gives them to ${desttext}.`) return; } } diff --git a/commands/letgo.js b/commands/letgo.js index e54b6000..21eeceed 100644 --- a/commands/letgo.js +++ b/commands/letgo.js @@ -15,7 +15,7 @@ module.exports = { async execute(interaction) { try { // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } @@ -24,24 +24,25 @@ module.exports = { let data = { textarray: "texts_letgo", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: interaction.user, // Not needed, but required for function parsing anyway. - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type }, }; - if (tryOrgasm(interaction.user.id)) { + if (tryOrgasm(interaction.guildId, interaction.user.id)) { // User was able to orgasm! data.orgasm = true; interaction.reply(getText(data)); } else { - if (getChastity(interaction.user.id)) { + if (getChastity(interaction.guildId, interaction.user.id)) { data.chastity = true; interaction.reply(getText(data)); return; } - const heavy = !getHeavyBound(interaction.user.id, interaction.user.id); + const heavy = !getHeavyBound(interaction.guildId, interaction.user.id, interaction.user.id); if (heavy) { data.heavy = true; interaction.reply(getText(data)); @@ -51,7 +52,7 @@ module.exports = { // cool off response, replace with something good data.free = true; interaction.reply(getText(data)); - setArousalCooldown(interaction.user.id); + setArousalCooldown(interaction.guildId, interaction.user.id); } } catch (err) { console.log(err); diff --git a/commands/mask.js b/commands/mask.js index 53a253eb..0d970091 100644 --- a/commands/mask.js +++ b/commands/mask.js @@ -23,7 +23,7 @@ module.exports = { try { const focusedValue = interaction.options.getFocused(); let chosenuserid = interaction.options.get("user")?.value ?? interaction.user.id; // Note we can only retrieve the user ID here! - let itemsworn = getHeadwear(chosenuserid); + let itemsworn = getHeadwear(interaction.guildId, chosenuserid); let autocompletes = process.autocompletes.headtypes.filter((f) => !itemsworn.includes(f.value)); let matches = didYouMean(focusedValue, autocompletes, { matchPath: ['name'], @@ -34,7 +34,7 @@ module.exports = { if (matches.length == 0) { matches = autocompletes; } - let tags = getUserTags(chosenuserid); + let tags = getUserTags(interaction.guildId, chosenuserid); let newsorted = []; matches.forEach((f) => { let tagged = false; @@ -70,22 +70,23 @@ module.exports = { let targetuser = headwearuser; // I dont feel like changing all the headwearusers right now. let headwearchoice = interaction.options.getString("type") ? interaction.options.getString("type") : "hood_latexfull"; // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(headwearuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, headwearuser.id)?.mainconsent) { await handleConsent(interaction, headwearuser.id); return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } let data = { textarray: "texts_headwear", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: headwearuser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type - c2: getHeadwearName(headwearuser.id, headwearchoice), + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type + c2: getHeadwearName(interaction.guildId, headwearuser.id, headwearchoice), }, }; @@ -97,7 +98,7 @@ module.exports = { let blocked = false; if (headwearchoice) { - let tags = getUserTags(headwearuser.id); + let tags = getUserTags(interaction.guildId, headwearuser.id); let i = getBaseHeadwear(headwearchoice) tags.forEach((t) => { if (i && i.tags && i.tags[t] && (headwearuser != interaction.user)) { @@ -111,13 +112,13 @@ module.exports = { return; } - if (!getHeavyBound(interaction.user.id, targetuser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, targetuser.id)) { // target is in heavy bondage data.heavy = true; if (headwearuser.id == interaction.user.id) { // ourselves data.self = true; - if (getHeadwear(headwearuser.id).includes(headwearchoice)) { + if (getHeadwear(interaction.guildId, headwearuser.id).includes(headwearchoice)) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); @@ -129,7 +130,7 @@ module.exports = { } else { // Them data.other = true; - if (getHeadwear(headwearuser.id).includes(headwearchoice)) { + if (getHeadwear(interaction.guildId, headwearuser.id).includes(headwearchoice)) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); @@ -142,13 +143,13 @@ module.exports = { } else { // Not in heavy bondage data.noheavy = true; - if (getMitten(interaction.user.id)) { + if (getMitten(interaction.guildId, interaction.user.id)) { // Wearing mittens! data.mitten = true; if (headwearuser.id == interaction.user.id) { // ourselves data.self = true; - if (getHeadwear(headwearuser.id).includes(headwearchoice)) { + if (getHeadwear(interaction.guildId, headwearuser.id).includes(headwearchoice)) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); @@ -160,7 +161,7 @@ module.exports = { } else { // Them data.other = true; - if (getHeadwear(headwearuser.id).includes(headwearchoice)) { + if (getHeadwear(interaction.guildId, headwearuser.id).includes(headwearchoice)) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); @@ -176,7 +177,7 @@ module.exports = { if (headwearuser.id == interaction.user.id) { // ourselves data.self = true; - if (getHeadwear(headwearuser.id).includes(headwearchoice)) { + if (getHeadwear(interaction.guildId, headwearuser.id).includes(headwearchoice)) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); @@ -184,20 +185,20 @@ module.exports = { // Not wearing it! data.noworn = true; await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleExtremeRestraint(interaction.user, targetuser, "mask", headwearchoice).then( + await handleExtremeRestraint(interaction.guildId, interaction.user, targetuser, "mask", headwearchoice).then( async (success) => { - await interaction.followUp({ content: `Equipping ${getHeadwearName(headwearuser.id, headwearchoice)}`, flags: MessageFlags.Ephemeral }) + await interaction.followUp({ content: `Equipping ${getHeadwearName(interaction.guildId, headwearuser.id, headwearchoice)}`, flags: MessageFlags.Ephemeral }) let followupmessage = await generateExtraConfig(interaction, targetuser.id, headwearchoice, true) if (followupmessage) { await interaction.followUp(followupmessage) }; await interaction.followUp(getText(data)); - assignHeadwear(headwearuser.id, headwearchoice, interaction.user.id); + assignHeadwear(interaction.guildId, headwearuser.id, headwearchoice, interaction.user.id); }, async (reject) => { - let nomessage = `You have rejected the ${getHeadwearName(headwearuser.id, headwearchoice)}.`; + let nomessage = `You have rejected the ${getHeadwearName(interaction.guildId, headwearuser.id, headwearchoice)}.`; if (reject == "Disabled") { - nomessage = `${getHeadwearName(headwearuser.id, headwearchoice)} is currently disabled in your extreme options.`; + nomessage = `${getHeadwearName(interaction.guildId, headwearuser.id, headwearchoice)} is currently disabled in your extreme options.`; } if (reject == "Error") { nomessage = `Something went wrong - Submit a bug report!`; @@ -212,7 +213,7 @@ module.exports = { } else { // Them data.other = true; - if (getHeadwear(headwearuser.id).includes(headwearchoice)) { + if (getHeadwear(interaction.guildId, headwearuser.id).includes(headwearchoice)) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); @@ -220,34 +221,34 @@ module.exports = { else { data.noworn = true; await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleMajorRestraint(interaction.user, targetuser, "mask", headwearchoice).then(async () => { - await handleExtremeRestraint(interaction.user, targetuser, "mask", headwearchoice).then( + await handleMajorRestraint(interaction.guildId, interaction.user, targetuser, "mask", headwearchoice).then(async () => { + await handleExtremeRestraint(interaction.guildId, interaction.user, targetuser, "mask", headwearchoice).then( async (success) => { - await interaction.followUp({ content: `Equipping ${getHeadwearName(headwearuser.id, headwearchoice)}`, flags: MessageFlags.Ephemeral }) + await interaction.followUp({ content: `Equipping ${getHeadwearName(interaction.guildId, headwearuser.id, headwearchoice)}`, flags: MessageFlags.Ephemeral }) let followupmessage = await generateExtraConfig(interaction, targetuser.id, headwearchoice, true) if (followupmessage) { await interaction.followUp(followupmessage) }; await interaction.followUp(getText(data)); - assignHeadwear(headwearuser.id, headwearchoice, interaction.user.id); + assignHeadwear(interaction.guildId, headwearuser.id, headwearchoice, interaction.user.id); }, async (reject) => { - let nomessage = `${targetuser} rejected the ${getHeadwearName(headwearuser.id, headwearchoice)}.`; + let nomessage = `${targetuser} rejected the ${getHeadwearName(interaction.guildId, headwearuser.id, headwearchoice)}.`; if (reject == "Disabled") { - nomessage = `${getHeadwearName(headwearuser.id, headwearchoice)} is currently disabled in ${targetuser}'s Extreme options.`; + nomessage = `${getHeadwearName(interaction.guildId, headwearuser.id, headwearchoice)} is currently disabled in ${targetuser}'s Extreme options.`; } if (reject == "Error") { nomessage = `Something went wrong - Submit a bug report!`; } if (reject == "NoDM") { - nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(targetuser.id, "subject")} ${getPronouns(targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; + nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(interaction.guildId, targetuser.id, "subject")} ${getPronouns(interaction.guildId, targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; } await interaction.followUp({ content: nomessage }); }, ); }, async (reject) => { - let nomessage = `${targetuser} rejected the ${getHeadwearName(headwearuser.id, headwearchoice)}.`; + let nomessage = `${targetuser} rejected the ${getHeadwearName(interaction.guildId, headwearuser.id, headwearchoice)}.`; if (reject == "Disabled") { nomessage = `${targetuser} has disabled being bound in major restraints without a collar.`; } @@ -255,7 +256,7 @@ module.exports = { nomessage = `Something went wrong - Submit a bug report!`; } if (reject == "NoDM") { - nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(targetuser.id, "subject")} ${getPronouns(targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; + nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(interaction.guildId, targetuser.id, "subject")} ${getPronouns(interaction.guildId, targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; } if (reject == "Cooldown") { nomessage = `${targetuser} has blocked major bondage restraints for now. Please try again in the future.`; @@ -271,7 +272,7 @@ module.exports = { } }, async help(userid, page) { - let restrictedtext = (getMitten(userid)) ? `***You are wearing mittens***\n` : "" + let restrictedtext = (getMitten(interaction.guildId, userid)) ? `***You are wearing mittens***\n` : "" let overviewtext = `## Mask ### Usage: /mask (user) (type) ### Remove: /unmask (user) (type) diff --git a/commands/meme.js b/commands/meme.js index 68032f9a..451924ce 100644 --- a/commands/meme.js +++ b/commands/meme.js @@ -35,12 +35,4 @@ module.exports = { console.log(err); } }, - /*async help(userid, page) { - let overviewtext = `## Meme -### Usage: /meme (type) - -Posts a meme!` - overviewtextdisplay = new TextDisplayBuilder().setContent(overviewtext) - return overviewtextdisplay; - }*/ }; From 9e32673f2922b4d70b00b05121cd9f4873b4e803 Mon Sep 17 00:00:00 2001 From: Enraa Date: Mon, 22 Jun 2026 19:04:43 -0700 Subject: [PATCH 36/44] slash commands done --- commands/mitten.js | 29 ++++++++-------- commands/outfit.js | 24 +++++++------- commands/pronouns.js | 6 ++-- commands/reset.js | 51 ++++++++++++++-------------- commands/scoreboard.js | 2 +- commands/shock.js | 35 ++++++++++---------- commands/struggle.js | 53 ++++++++++++++--------------- commands/timelock.js | 36 ++++++++++---------- commands/toy.js | 61 +++++++++++++++++----------------- commands/unchastity.js | 64 +++++++++++++++++------------------ commands/uncollar.js | 25 +++++++------- commands/uncorset.js | 69 +++++++++++++++++++------------------- commands/ungag.js | 35 ++++++++++---------- commands/unheavy.js | 23 ++++++------- commands/unmask.js | 75 +++++++++++++++++++++--------------------- commands/unmitten.js | 27 +++++++-------- commands/untoy.js | 48 ++++++++++++++------------- commands/unwear.js | 41 ++++++++++++----------- commands/wear.js | 27 +++++++-------- gags/politeSub.js | 2 ++ 20 files changed, 373 insertions(+), 360 deletions(-) diff --git a/commands/mitten.js b/commands/mitten.js index d7d77870..75e3de79 100644 --- a/commands/mitten.js +++ b/commands/mitten.js @@ -35,7 +35,7 @@ module.exports = { if (matches.length == 0) { matches = autocompletes; } - let tags = getUserTags(chosenuserid); + let tags = getUserTags(interaction.guildId, chosenuserid); let newsorted = []; matches.forEach((f) => { let tagged = false; @@ -62,12 +62,12 @@ module.exports = { let chosenmittens = interaction.options.getString("type"); let targetuser = interaction.options.getUser("user") ?? interaction.user; // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(targetuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, targetuser.id)?.mainconsent) { await handleConsent(interaction, targetuser.id); return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } @@ -75,6 +75,7 @@ module.exports = { let data = { textarray: "texts_mitten", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: targetuser, c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type @@ -90,7 +91,7 @@ module.exports = { let blocked = false; if (chosenmittens) { - let tags = getUserTags(targetuser.id); + let tags = getUserTags(interaction.guildId, targetuser.id); let i = getBaseMitten(chosenmittens) tags.forEach((t) => { if (i && i.tags && i.tags[t] && (targetuser != interaction.user)) { @@ -104,10 +105,10 @@ module.exports = { return; } - if (!getHeavyBound(interaction.user.id, targetuser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, targetuser.id)) { data.heavy = true; interaction.reply(getText(data)); - } else if (getMitten(interaction.user.id)) { + } else if (getMitten(interaction.guildId, interaction.user.id)) { data.mitten = true; interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); } else { @@ -119,19 +120,19 @@ module.exports = { // Wearing a gag already. data.gag = true; interaction.reply(getText(data)); - assignMitten(interaction.user.id, chosenmittens); + assignMitten(interaction.guildId, interaction.user.id, chosenmittens); } else { // Not wearing a gag data.nogag = true; interaction.reply(getText(data)); - assignMitten(interaction.user.id, chosenmittens); + assignMitten(interaction.guildId, interaction.user.id, chosenmittens); } } else { data.other = true; await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleMajorRestraint(interaction.user, targetuser, "mitten", chosenmittens).then(async () => { - await handleExtremeRestraint(interaction.user, targetuser, "mitten", chosenmittens).then( + await handleMajorRestraint(interaction.guildId, interaction.user, targetuser, "mitten", chosenmittens).then(async () => { + await handleExtremeRestraint(interaction.guildId, interaction.user, targetuser, "mitten", chosenmittens).then( async (success) => { if (getGag(interaction.guildId, targetuser.id)) { data.gag = true; @@ -141,7 +142,7 @@ module.exports = { } await interaction.followUp({ content: `Equipping ${data.textdata.c2}`, withResponse: true, flags: MessageFlags.Ephemeral }); await interaction.followUp(getText(data)); - assignMitten(targetuser.id, chosenmittens); + assignMitten(interaction.guildId, targetuser.id, chosenmittens); }, async (reject) => { let nomessage = `${targetuser} rejected the ${data.textdata.c2}.`; @@ -152,7 +153,7 @@ module.exports = { nomessage = `Something went wrong - Submit a bug report!`; } if (reject == "NoDM") { - nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(targetuser.id, "subject")} ${getPronouns(targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; + nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(interaction.guildId, targetuser.id, "subject")} ${getPronouns(interaction.guildId, targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; } await interaction.followUp({ content: nomessage }); }, @@ -167,7 +168,7 @@ module.exports = { nomessage = `Something went wrong - Submit a bug report!`; } if (reject == "NoDM") { - nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(targetuser.id, "subject")} ${getPronouns(targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; + nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(interaction.guildId, targetuser.id, "subject")} ${getPronouns(interaction.guildId, targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent for this restraint.`; } if (reject == "Cooldown") { nomessage = `${targetuser} has blocked major bondage restraints for now. Please try again in the future.`; @@ -181,7 +182,7 @@ module.exports = { } }, async help(userid, page) { - let restrictedtext = (getMitten(userid)) ? `***You cannot remove your mittens***\n` : "" + let restrictedtext = (getMitten(interaction.guildId, userid)) ? `***You cannot remove your mittens***\n` : "" let overviewtext = `## Mitten ### Usage: /mitten (type) ### Remove: /unmitten (user) diff --git a/commands/outfit.js b/commands/outfit.js index aed27ecd..672b334e 100644 --- a/commands/outfit.js +++ b/commands/outfit.js @@ -33,7 +33,7 @@ module.exports = { let choices = [ { name: "No Outfit to Select", value: -1 } ]; - let outfits = getOutfits(interaction.user.id) + let outfits = getOutfits(interaction.guildId, interaction.user.id) if (outfits.length > 0) { choices = []; for (let i = 0; i < outfits.length; i++) { @@ -48,12 +48,12 @@ module.exports = { try { let subcommand = interaction.options.getSubcommand(); if (subcommand == "menu") { - await interaction.reply(await generateOutfitModal(interaction.user.id, "restore", 1, "0000000000")); + await interaction.reply(await generateOutfitModal(interaction.guildId, interaction.user.id, "restore", 1, "0000000000")); } else if (subcommand == "restore") { let outfitslot = interaction.options.getInteger("slot") if ((outfitslot > -1) && (outfitslot < 20)) { - restoreOutfit(interaction.user.id, getOutfits(interaction.user.id)[outfitslot]); + restoreOutfit(interaction.guildId, interaction.user.id, getOutfits(interaction.guildId, interaction.user.id)[outfitslot]); await interaction.reply({ content: `Reloading Outfit in slot ${outfitslot + 1}...`, flags: MessageFlags.Ephemeral }) } } @@ -67,26 +67,26 @@ module.exports = { // We changed page, new page! if (optionparts[1] == "save" || optionparts[1] == "restore" || optionparts[1] == "rename") { if (optionparts[4]) { - await interaction.update(await generateOutfitModal(interaction.user.id, optionparts[1], optionparts[2], optionparts[4])); + await interaction.update(await generateOutfitModal(interaction.guildId, interaction.user.id, optionparts[1], optionparts[2], optionparts[4])); } else { - await interaction.update(await generateOutfitModal(interaction.user.id, optionparts[1], optionparts[2], "0000000000")); + await interaction.update(await generateOutfitModal(interaction.guildId, interaction.user.id, optionparts[1], optionparts[2], "0000000000")); } } // Changing an option! else if (optionparts[1] == "outfitopt") { let optionbits = optionparts[4]; optionbits = `${optionbits.slice(0, optionparts[3])}${optionbits.charAt(optionparts[3]) == 0 ? `1` : `0`}${optionbits.slice(parseInt(optionparts[3]) + 1)}`; - await interaction.update(await generateOutfitModal(interaction.user.id, "save", optionparts[2], optionbits)); + await interaction.update(await generateOutfitModal(interaction.guildId, interaction.user.id, "save", optionparts[2], optionbits)); } // Equipping an outfit! else if (optionparts[1] == "restoreoutfit") { - restoreOutfit(interaction.user.id, getOutfits(interaction.user.id)[optionparts[3]]); - await interaction.update(await generateOutfitModal(interaction.user.id, "restore", optionparts[2], optionparts[4])); + restoreOutfit(interaction.guildId, interaction.user.id, getOutfits(interaction.user.id)[optionparts[3]]); + await interaction.update(await generateOutfitModal(interaction.guildId, interaction.user.id, "restore", optionparts[2], optionparts[4])); } // Equipping an outfit! else if (optionparts[1] == "saveoutfit") { - assignOutfit(interaction.user.id, parseInt(optionparts[2]) - 1, optionparts[4]); - await interaction.update(await generateOutfitModal(interaction.user.id, "save", optionparts[2], optionparts[4])); + assignOutfit(interaction.guildId, interaction.user.id, parseInt(optionparts[2]) - 1, optionparts[4]); + await interaction.update(await generateOutfitModal(interaction.guildId, interaction.user.id, "save", optionparts[2], optionparts[4])); } // Renaming an outfit! else if (optionparts[1] == "renameoutfit") { @@ -100,11 +100,11 @@ module.exports = { console.log(interaction); let choiceinput = interaction.fields.getTextInputValue("choiceinput"); let optionparts = interaction.customId.split("_"); - renameOutfit(interaction.user.id, parseInt(optionparts[2]), `${choiceinput.slice(0, 50)}`); + renameOutfit(interaction.guildId, interaction.user.id, parseInt(optionparts[2]), `${choiceinput.slice(0, 50)}`); await interaction.reply({ content: `Updated name for Outfit in slot ${parseInt(optionparts[2]) + 1} to **${choiceinput.slice(0, 50)}**`, flags: MessageFlags.Ephemeral }); if (process.recentinteraction) { if (process.recentinteraction[interaction.user.id]?.timestamp + 895000 > performance.now()) { - await process.recentinteraction[interaction.user.id].interaction.editReply(await generateOutfitModal(interaction.user.id, "rename", Math.ceil(optionparts[2] / 5), "0000000000")); + await process.recentinteraction[interaction.user.id].interaction.editReply(await generateOutfitModal(interaction.guildId, interaction.user.id, "rename", Math.ceil(optionparts[2] / 5), "0000000000")); } delete process.recentinteraction[interaction.user.id]; } diff --git a/commands/pronouns.js b/commands/pronouns.js index abfb913e..082992b6 100644 --- a/commands/pronouns.js +++ b/commands/pronouns.js @@ -1,9 +1,9 @@ const { SlashCommandBuilder, MessageFlags } = require("discord.js"); const { pronounsMap } = require("../lists/pronounsMap.js"); const { setPronouns } = require("../functions/setters/config/setPronouns.js"); +const { pronounsMap } = require("../lists/pronounsMap.js") -// Build the choice array -const pronounTypes = []; +let pronounTypes = []; for (const x of pronounsMap.keys()) { pronounTypes.push({ name: x, value: x }); @@ -23,7 +23,7 @@ module.exports = { async execute(interaction) { try { interaction.reply({ content: `Your pronouns have been set to "${interaction.options.getString("pronouns")}"`, flags: MessageFlags.Ephemeral }); - setPronouns(interaction.user.id, interaction.options.getString("pronouns")); + setPronouns(interaction.guildId, interaction.user.id, interaction.options.getString("pronouns")); } catch (err) { console.log(err); } diff --git a/commands/reset.js b/commands/reset.js index 8466ac1b..b1eda3f8 100644 --- a/commands/reset.js +++ b/commands/reset.js @@ -10,6 +10,7 @@ const { removeCorset } = require("../functions/setters/corset/removeCorset.js"); const { deleteWearable } = require("../functions/setters/wearable/removeWearable.js"); const { deleteHeadwear } = require("../functions/setters/headwear/removeHeadwear.js"); const { getServerOption } = require("../functions/getters/config/getServerOption.js"); +const { removeToy } = require("../functions/setters/toy/removeToy.js"); module.exports = { data: new SlashCommandBuilder() @@ -22,39 +23,35 @@ module.exports = { if (interaction.member.permissions.has(PermissionFlagsBits.ManageMessages)) { // User has the permission, proceed with the action (e.g., a purge command) await interaction.reply({ content: `Resetting ${resetuser}`, flags: MessageFlags.Ephemeral }); - deleteGag(resetuser.id, undefined, true); - deleteMitten(resetuser.id); - removeChastity(resetuser.id, undefined, true); - removeChastityBra(resetuser.id, undefined, true); - if (process.toys) { - delete process.toys[resetuser.id]; - } - removeCollar(resetuser.id); - removeHeavy(resetuser.id, undefined, true); - removeCorset(resetuser.id); - deleteWearable(resetuser.id); - deleteHeadwear(resetuser.id, undefined, true); - setArousalCooldown(resetuser.id); + deleteGag(interaction.guildId, resetuser.id, undefined, true); + deleteMitten(interaction.guildId, resetuser.id); + removeChastity(interaction.guildId, resetuser.id, undefined, true); + removeChastityBra(interaction.guildId, resetuser.id, undefined, true); + removeToy(interaction.guildId, resetuser.id, undefined, true) + removeCollar(interaction.guildId, resetuser.id); + removeHeavy(interaction.guildId, resetuser.id, undefined, true); + removeCorset(interaction.guildId, resetuser.id); + deleteWearable(interaction.guildId, resetuser.id); + deleteHeadwear(interaction.guildId, resetuser.id, undefined, true); + setArousalCooldown(interaction.guildId, resetuser.id); } else { if (getServerOption(interaction.guildId, "server-safewordroleid") === "") { // no safeword role was setup. Make the user talk to a mod. - await interaction.reply({ content: "Please DM a mod about this command if someone needs to be reset.", flags: MessageFlags.Ephemeral }); + await interaction.reply({ content: "Gagbot looks at your pleas for freedom and smirks as you squirm helplessly. (DM a mod)", flags: MessageFlags.Ephemeral }); } else if (getServerOption(interaction.guildId, "server-safewordroleid") && interaction.member.roles.cache.has(getServerOption(interaction.guildId, "server-safewordroleid"))) { // User has the safeword role, we should remove all their restraints because they safeworded await interaction.reply({ content: "Resetting all of your restraints because you are safeworded.", flags: MessageFlags.Ephemeral }); - deleteGag(interaction.user.id, undefined, true); - deleteMitten(interaction.user.id); - removeChastity(interaction.user.id, undefined, true); - removeChastityBra(interaction.user.id, undefined, true); - if (process.toys) { - delete process.toys[interaction.user.id]; - } - removeCollar(interaction.user.id); - removeHeavy(interaction.user.id, undefined, true); - removeCorset(interaction.user.id); - deleteWearable(interaction.user.id); - deleteHeadwear(interaction.user.id, undefined, true); - setArousalCooldown(interaction.user.id); + deleteGag(interaction.guildId, interaction.user.id, undefined, true); + deleteMitten(interaction.guildId, interaction.user.id); + removeChastity(interaction.guildId, interaction.user.id, undefined, true); + removeChastityBra(interaction.guildId, interaction.user.id, undefined, true); + removeToy(interaction.guildId, resetuser.id, undefined, true) + removeCollar(interaction.guildId, interaction.user.id); + removeHeavy(interaction.guildId, interaction.user.id, undefined, true); + removeCorset(interaction.guildId, interaction.user.id); + deleteWearable(interaction.guildId, interaction.user.id); + deleteHeadwear(interaction.guildId, interaction.user.id, undefined, true); + setArousalCooldown(interaction.guildId, interaction.user.id); } else { // User does not have the permission, send an error message, but only if they don't have the safeworded role. If they do, then await interaction.reply({ content: "Please DM a mod about this command if someone needs to be reset.", flags: MessageFlags.Ephemeral }); diff --git a/commands/scoreboard.js b/commands/scoreboard.js index c99b914b..8c8afba7 100644 --- a/commands/scoreboard.js +++ b/commands/scoreboard.js @@ -26,7 +26,7 @@ async function generateList(menuchoice) { let placements = ["1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th"] let fulltext = `## Scoreboard - **${menus.find((t) => t.useroption == menuchoice).name}**\n`; - let stats = statsGetAllStat(menuchoice).sort((a,b) => { return b[1] - a[1]}) + let stats = statsGetAllStat(interaction.guildId, menuchoice).sort((a,b) => { return b[1] - a[1]}) if (stats.length == 0) { fulltext = `${fulltext}*No Leaderboard Data*` } diff --git a/commands/shock.js b/commands/shock.js index 75b7662d..09468b4a 100644 --- a/commands/shock.js +++ b/commands/shock.js @@ -20,23 +20,24 @@ module.exports = { try { let targetuser = interaction.options.getUser("user") ?? interaction.user; // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(targetuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, targetuser.id)?.mainconsent) { await handleConsent(interaction, targetuser.id); return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } // Build data tree: let data = { + serverID: interaction.guildId, interactionuser: { id: interaction.user.id }, targetuser: { id: targetuser.id }, - c1: getCollarName(targetuser.id, getCollar(targetuser.id)?.collartype) ?? "collar" + c1: getCollarName(interaction.guildId, targetuser.id, getCollar(interaction.guildId, targetuser.id)?.collartype) ?? "collar" } // Figure out the tone to shock the user with - let tone = getOption(targetuser.id, "shocktone") ?? "playful"; + let tone = getOption(interaction.guildId, targetuser.id, "shocktone") ?? "playful"; if (tone == "both") { if (Math.random() > 0.5) { tone = "playful" @@ -47,20 +48,20 @@ module.exports = { } if (targetuser.id != interaction.user.id) { - if (!getCollar(targetuser.id)) { + if (!getCollar(interaction.guildId, targetuser.id)) { await interaction.reply({ content: `<@${targetuser.id}> isn't wearing a collar.`, flags: MessageFlags.Ephemeral }) return; } - if ((getCollar(targetuser.id)?.collartype != "remoteshockcollar") && !(getCollar(targetuser.id)?.additionalcollars?.includes("remoteshockcollar"))) { + if ((getCollar(interaction.guildId, targetuser.id)?.collartype != "remoteshockcollar") && !(getCollar(interaction.guildId, targetuser.id)?.additionalcollars?.includes("remoteshockcollar"))) { await interaction.reply({ content: `<@${targetuser.id}> isn't wearing a remote controlled shock collar.`, flags: MessageFlags.Ephemeral }) return; } - await handleTouchEvent(interaction.user, targetuser, "shock", true).then( + await handleTouchEvent(interaction.guildId, interaction.user, targetuser, "shock", true).then( async (success) => { - addArousal(targetuser.id, (2.0 + Math.random() * 6.0)); // Add 2-8 arousal. + addArousal(interaction.guildId, targetuser.id, (2.0 + Math.random() * 6.0)); // Add 2-8 arousal. await interaction.reply({ content: getTextGeneric(`remotecontrolshock_other_${tone}`, data) }) - statsAddCounter(targetuser.id, "timesshocked"); - shockUser(targetuser.id) + statsAddCounter(interaction.guildId, targetuser.id, "timesshocked"); + shockUser(interaction.guildId, targetuser.id) }, async (failure) => { await interaction.reply({ content: `You don't have access to <@${targetuser.id}>'s collar remote control!`, flags: MessageFlags.Ephemeral }) @@ -68,23 +69,23 @@ module.exports = { ) } else { - if (!getCollar(targetuser.id)) { + if (!getCollar(interaction.guildId, targetuser.id)) { await interaction.reply({ content: `You aren't wearing a collar.`, flags: MessageFlags.Ephemeral }) return; } - if ((getCollar(targetuser.id)?.collartype != "remoteshockcollar") && !(getCollar(targetuser.id)?.additionalcollars?.includes("remoteshockcollar"))) { + if ((getCollar(interaction.guildId, targetuser.id)?.collartype != "remoteshockcollar") && !(getCollar(interaction.guildId, targetuser.id)?.additionalcollars?.includes("remoteshockcollar"))) { await interaction.reply({ content: `You aren't wearing a remote controlled shock collar.`, flags: MessageFlags.Ephemeral }) return; } - if (!canAccessCollar(targetuser.id, interaction.user.id).access) { + if (!canAccessCollar(interaction.guildId, targetuser.id, interaction.user.id).access) { await interaction.reply({ content: `You don't have access to your collar's remote control!`, flags: MessageFlags.Ephemeral }) return; } - addArousal(targetuser.id, (2.0 + Math.random() * 6.0)); // Add 2-8 arousal. + addArousal(interaction.guildId, targetuser.id, (2.0 + Math.random() * 6.0)); // Add 2-8 arousal. await interaction.reply({ content: getTextGeneric(`remotecontrolshock_self_${tone}`, data) }) - statsAddCounter(targetuser.id, "timesshocked"); - statsAddCounter(targetuser.id, "timesshockedself"); - shockUser(targetuser.id) + statsAddCounter(interaction.guildId, targetuser.id, "timesshocked"); + statsAddCounter(interaction.guildId, targetuser.id, "timesshockedself"); + shockUser(interaction.guildId, targetuser.id) } } catch (err) { console.log(err); diff --git a/commands/struggle.js b/commands/struggle.js index d1b9af9b..fc51357f 100644 --- a/commands/struggle.js +++ b/commands/struggle.js @@ -26,30 +26,30 @@ module.exports = { async autoComplete(interaction) { const focusedValue = interaction.options.getFocused(); try { - let heavybondage = getHeavy(interaction.user.id); + let heavybondage = getHeavy(interaction.guildId, interaction.user.id); let gagbondage = getGagLast(interaction.guildId, interaction.user.id); - let mittenbondage = getMitten(interaction.user.id); - let chastitybondage = getChastity(interaction.user.id); - let chastitybrabondage = getChastityBra(interaction.user.id) - let headbondage = getHeadwear(interaction.user.id); - let corsetbondage = getCorset(interaction.user.id); - let collarbondage = getCollar(interaction.user.id); + let mittenbondage = getMitten(interaction.guildId, interaction.user.id); + let chastitybondage = getChastity(interaction.guildId, interaction.user.id); + let chastitybrabondage = getChastityBra(interaction.guildId, interaction.user.id) + let headbondage = getHeadwear(interaction.guildId, interaction.user.id); + let corsetbondage = getCorset(interaction.guildId, interaction.user.id); + let collarbondage = getCollar(interaction.guildId, interaction.user.id); let outopts = []; if (heavybondage) { - outopts.push({ name: `Heavy Bondage: ${getHeavy(interaction.user.id).displayname}`, value: "heavy" }); + outopts.push({ name: `Heavy Bondage: ${getHeavy(interaction.guildId, interaction.user.id).displayname}`, value: "heavy" }); } if (gagbondage) { outopts.push({ name: `Gag: ${convertGagText(getGagLast(interaction.guildId, interaction.user.id))}`, value: "gag" }); } if (mittenbondage) { - outopts.push({ name: `Mittens${mittenbondage.mittenname ? `: ${getMittenName(interaction.user.id)}` : ""}`, value: "mitten" }); + outopts.push({ name: `Mittens${mittenbondage.mittenname ? `: ${getMittenName(interaction.guildId, interaction.user.id)}` : ""}`, value: "mitten" }); } if (chastitybondage) { - outopts.push({ name: `Chastity${chastitybondage.chastitytype ? `: ${getChastityName(interaction.user.id)}` : " Belt"}`, value: "chastity" }); + outopts.push({ name: `Chastity${chastitybondage.chastitytype ? `: ${getChastityName(interaction.guildId, interaction.user.id)}` : " Belt"}`, value: "chastity" }); } if (chastitybrabondage) { - outopts.push({ name: `Chastity Bra${chastitybrabondage.chastitytype ? `: ${getChastityBraName(interaction.user.id)}` : " Bra"}`, value: "chastitybra" }); + outopts.push({ name: `Chastity Bra${chastitybrabondage.chastitytype ? `: ${getChastityBraName(interaction.guildId, interaction.user.id)}` : " Bra"}`, value: "chastitybra" }); } if (headbondage.length > 0) { outopts.push({ name: `Head Restraints`, value: "head" }); @@ -58,7 +58,7 @@ module.exports = { outopts.push({ name: `Corset`, value: "corset" }); } if (collarbondage) { - outopts.push({ name: `Collar${collarbondage.collartype ? `: ${getCollarName(interaction.user.id)}` : ""}`, value: "collar" }); + outopts.push({ name: `Collar${collarbondage.collartype ? `: ${getCollarName(interaction.guildId, interaction.user.id)}` : ""}`, value: "collar" }); } if (outopts.length == 0) { @@ -74,31 +74,32 @@ module.exports = { async execute(interaction) { try { // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } - let heavybondage = getHeavy(interaction.user.id)?.displayname; + let heavybondage = getHeavy(interaction.guildId, interaction.user.id)?.displayname; let gagbondage = getGagLast(interaction.guildId, interaction.user.id); - let mittenbondage = getMitten(interaction.user.id); - let chastitybondage = getChastity(interaction.user.id); - let chastitybrabondage = getChastityBra(interaction.user.id) - let headbondage = getHeadwear(interaction.user.id); - let corsetbondage = getCorset(interaction.user.id); - let collarbondage = getCollar(interaction.user.id); + let mittenbondage = getMitten(interaction.guildId, interaction.user.id); + let chastitybondage = getChastity(interaction.guildId, interaction.user.id); + let chastitybrabondage = getChastityBra(interaction.guildId, interaction.user.id) + let headbondage = getHeadwear(interaction.guildId, interaction.user.id); + let corsetbondage = getCorset(interaction.guildId, interaction.user.id); + let collarbondage = getCollar(interaction.guildId, interaction.user.id); // Build data tree: let data = { textarray: "texts_struggle", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: interaction.user, // Doesn't really matter but we're adding to avoid a crash - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type - c2: convertGagText(interaction.guildId, getGagLast(interaction.guildId, interaction.user.id)), - c3: getMittenName(interaction.user.id) ?? "mittens", - c4: getChastityName(interaction.user.id) ?? "chastity belt", - c5: getCollarName(interaction.user.id) ?? "collar", - c6: getChastityBraName(interaction.user.id) ?? "chastity bra" + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type + c2: convertGagText(getGagLast(interaction.guildId, interaction.user.id)), + c3: getMittenName(interaction.guildId, interaction.user.id) ?? "mittens", + c4: getChastityName(interaction.guildId, interaction.user.id) ?? "chastity belt", + c5: getCollarName(interaction.guildId, interaction.user.id) ?? "collar", + c6: getChastityBraName(interaction.guildId, interaction.user.id) ?? "chastity bra" }, }; diff --git a/commands/timelock.js b/commands/timelock.js index d08e9922..90d59a0c 100644 --- a/commands/timelock.js +++ b/commands/timelock.js @@ -23,9 +23,9 @@ module.exports = { const focusedValue = interaction.options.getFocused(); // Note, we only need to know if we can ***unlock*** a restraint to timelock it. let chosenuserid = interaction.options.get("wearer")?.value ?? interaction.user.id; // Note we can only retrieve the user ID here! - let collarkeyholder = getCollar(chosenuserid) && canAccessCollar(chosenuserid, interaction.user.id, true).access; - let chastitykeyholder = getChastity(chosenuserid) && canAccessChastity(chosenuserid, interaction.user.id, true).access; - let chastitybrakeyholder = getChastityBra(chosenuserid) && canAccessChastityBra(chosenuserid, interaction.user.id, true).access; + let collarkeyholder = getCollar(interaction.guildId, chosenuserid) && canAccessCollar(interaction.guildId, chosenuserid, interaction.user.id, true).access; + let chastitykeyholder = getChastity(interaction.guildId, chosenuserid) && canAccessChastity(interaction.guildId, chosenuserid, interaction.user.id, true).access; + let chastitybrakeyholder = getChastityBra(interaction.guildId, chosenuserid) && canAccessChastityBra(interaction.guildId, chosenuserid, interaction.user.id, true).access; let choices = []; if (!collarkeyholder && !chastitykeyholder && !chastitybrakeyholder) { @@ -66,12 +66,12 @@ module.exports = { return; } - if (!getHeavyBound(interaction.user.id, wearer.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, wearer.id)) { if (wearer == interaction.user) { - interaction.reply(`${interaction.user} pulls against ${their(wearer.id)} ${getHeavy(interaction.user.id).displayname} trying to apply a timelock to ${their(wearer.id)} chastity belt, but is completely stuck!`); + interaction.reply(`${interaction.user} pulls against ${their(interaction.guildId, wearer.id)} ${getHeavy(interaction.guildId, interaction.user.id).displayname} trying to apply a timelock to ${their(interaction.guildId, wearer.id)} chastity belt, but is completely stuck!`); return; } else { - interaction.reply(`${interaction.user} pulls against ${their(wearer.id)} ${getHeavy(interaction.user.id).displayname} trying to apply a timelock to ${wearer}'s chastity belt, but is completely stuck!`); + interaction.reply(`${interaction.user} pulls against ${their(interaction.guildId, wearer.id)} ${getHeavy(interaction.guildId, interaction.user.id).displayname} trying to apply a timelock to ${wearer}'s chastity belt, but is completely stuck!`); return; } } @@ -79,7 +79,7 @@ module.exports = { interaction.showModal(timelockChastityModal(interaction, wearer)); break; case "chastitybra": - let chastitybra = getChastityBra(wearer.id); + let chastitybra = getChastityBra(interaction.guildId, wearer.id); if (!chastitybra) { interaction.reply({ content: `${wearer} is not wearing a chastity bra`, flags: MessageFlags.Ephemeral }); @@ -96,12 +96,12 @@ module.exports = { return; } - if (!getHeavyBound(interaction.user.id, wearer.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, wearer.id)) { if (wearer == interaction.user) { - interaction.reply(`${interaction.user} pulls against ${their(wearer.id)} ${getHeavy(interaction.user.id).displayname} trying to apply a timelock to ${their(wearer.id)} chastity bra, but is completely stuck!`); + interaction.reply(`${interaction.user} pulls against ${their(interaction.guildId, wearer.id)} ${getHeavy(interaction.guildId, interaction.user.id).displayname} trying to apply a timelock to ${their(interaction.guildId, wearer.id)} chastity bra, but is completely stuck!`); return; } else { - interaction.reply(`${interaction.user} pulls against ${their(wearer.id)} ${getHeavy(interaction.user.id).displayname} trying to apply a timelock to ${wearer}'s chastity bra, but is completely stuck!`); + interaction.reply(`${interaction.user} pulls against ${their(interaction.guildId, wearer.id)} ${getHeavy(interaction.guildId, interaction.user.id).displayname} trying to apply a timelock to ${wearer}'s chastity bra, but is completely stuck!`); return; } } @@ -109,7 +109,7 @@ module.exports = { interaction.showModal(timelockChastityBraModal(interaction, wearer)); break; case "collar": - let collar = getCollar(wearer.id); + let collar = getCollar(interaction.guildId, wearer.id); if (!collar) { interaction.reply({ content: `${wearer} is not wearing a collar`, flags: MessageFlags.Ephemeral }); @@ -126,12 +126,12 @@ module.exports = { return; } - if (!getHeavyBound(interaction.user.id, wearer.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, wearer.id)) { if (wearer == interaction.user) { - interaction.reply(`${interaction.user} pulls against ${their(wearer.id)} ${getHeavy(interaction.user.id).displayname} trying to apply a timelock to ${their(wearer.id)} collar, but is completely stuck!`); + interaction.reply(`${interaction.user} pulls against ${their(interaction.guildId, wearer.id)} ${getHeavy(interaction.guildId, interaction.user.id).displayname} trying to apply a timelock to ${their(interaction.guildId, wearer.id)} collar, but is completely stuck!`); return; } else { - interaction.reply(`${interaction.user} pulls against ${their(wearer.id)} ${getHeavy(interaction.user.id).displayname} trying to apply a timelock to ${wearer}'s collar, but is completely stuck!`); + interaction.reply(`${interaction.user} pulls against ${their(interaction.guildId, wearer.id)} ${getHeavy(interaction.guildId, interaction.user.id).displayname} trying to apply a timelock to ${wearer}'s collar, but is completely stuck!`); return; } } @@ -214,7 +214,7 @@ module.exports = { confirmation = await response.resource.message.awaitMessageComponent({ filter: collectorFilter, time: 300_000 }); if (confirmation.customId === "confirm") { confirmation.update({ content: `Engaging your timelock!`, components: [] }); - let data = { textarray: "texts_timelock", textdata: { interactionuser: interaction.user, targetuser: wearerobject, c1: `<@${keyholder}>` } }; + let data = { textarray: "texts_timelock", textdata: { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearerobject, c1: `<@${keyholder}>` } }; data.timelockengage = true; if (access == 0) { data.everyoneaccess = true; @@ -236,13 +236,13 @@ module.exports = { } data[split[2]] = true; if (split[2] == "chastitybelt") { - timelockChastity(interaction.client, wearer, keyholder, Math.floor(timelockmodal.unlockTime), access, keyholderAfter, interaction.channel.id); + timelockChastity(interaction.guildId, interaction.client, wearer, keyholder, Math.floor(timelockmodal.unlockTime), access, keyholderAfter, interaction.channel.id); await interaction.followUp(getText(data)); } else if (split[2] == "chastitybra") { - timelockChastityBra(interaction.client, wearer, keyholder, Math.floor(timelockmodal.unlockTime), access, keyholderAfter, interaction.channel.id); + timelockChastityBra(interaction.guildId, interaction.client, wearer, keyholder, Math.floor(timelockmodal.unlockTime), access, keyholderAfter, interaction.channel.id); await interaction.followUp(getText(data)); } else if (split[2] == "collar") { - timelockCollar(interaction.client, wearer, keyholder, Math.floor(timelockmodal.unlockTime), access, keyholderAfter, interaction.channel.id); + timelockCollar(interaction.guildId, interaction.client, wearer, keyholder, Math.floor(timelockmodal.unlockTime), access, keyholderAfter, interaction.channel.id); await interaction.followUp(getText(data)); } } else if (confirmation.customId === "reject") { diff --git a/commands/toy.js b/commands/toy.js index bc08edc3..58201964 100644 --- a/commands/toy.js +++ b/commands/toy.js @@ -48,16 +48,16 @@ module.exports = { let toytype = interaction.options.getString("type") ?? "vibe_bullet" let toybase = getBaseToy(toytype); // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(toyuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, toyuser.id)?.mainconsent) { await handleConsent(interaction, toyuser.id); return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } - if (userBlockArousingToy(toyuser.id, toytype)) { + if (userBlockArousingToy(interaction.guildId, toyuser.id, toytype)) { if (toyuser.id == interaction.user.id) { interaction.reply({ content: `You have disabled the Arousal System in **/config** and would not be affected by this toy. Please review the Arousal System setting and enable it to use arousing toys.`, flags: MessageFlags.Ephemeral }); } else { @@ -69,9 +69,10 @@ module.exports = { let data = { textarray: "texts_toy", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: toyuser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type c2: getBaseToy(toytype).toyname, // the chosen vibe type c3: toyintensity, }, @@ -86,13 +87,13 @@ module.exports = { return; } - if (!getHeavyBound(interaction.user.id, toyuser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, toyuser.id)) { // We are in heavy bondage data.heavy = true; if (toyuser == interaction.user) { // ourselves data.self = true; - if (toybase.canEquip({ userID: toyuser.id, keyholderID: interaction.user.id })) { + if (toybase.canEquip({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id })) { // can equip data.access = true; data[toybase.category] = true; @@ -106,7 +107,7 @@ module.exports = { } else { // someone else data.other = true; - if (toybase.canEquip({ userID: toyuser.id, keyholderID: interaction.user.id })) { + if (toybase.canEquip({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id })) { // cannot equip data.access = true; data[toybase.category] = true; @@ -128,20 +129,20 @@ module.exports = { if (getSpecificToy(toyuser.id, toytype)) { // toy already on wearer data.toy = true; - if (toybase.blocker({ userID: toyuser.id })) { + if (toybase.blocker({ serverID: interaction.guildId, userID: toyuser.id })) { data.blocker = true - if (toybase.canModify({ userID: toyuser.id, keyholderID: interaction.user.id })) { + if (toybase.canModify({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id })) { // can access the toy data.access = true; data[toybase.category] = true; - let fumble = toybase.fumble({ userID: toyuser.id, keyholderID: interaction.user.id }) + let fumble = toybase.fumble({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id }) if (fumble > 0) { // We fumbled the key data.fumble = true; if (fumble > 1) { // We lost the key data.keyloss = true; - let discardresult = toybase.discard({ userID: toyuser.id, keyholderID: interaction.user.id }) + let discardresult = toybase.discard({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id }) if (discardresult) { data[discardresult] = true } interaction.reply(getText(data)) } @@ -154,7 +155,7 @@ module.exports = { else { // Successfully unlocked blocking device data.nofumble = true; - assignToy(toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); + assignToy(interaction.guildId, toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); interaction.reply(getText(data)) } } @@ -169,27 +170,27 @@ module.exports = { // Not wearing chastity or anything data.noblocker = true data[toybase.category] = true; - assignToy(toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); + assignToy(interaction.guildId, toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); interaction.reply(getText(data)) } } else { // Toy is not already worn! data.notoy = true; - if (toybase.blocker({ userID: toyuser.id })) { + if (toybase.blocker({ serverID: interaction.guildId, userID: toyuser.id })) { data.blocker = true - if (toybase.canEquip({ userID: toyuser.id, keyholderID: interaction.user.id })) { + if (toybase.canEquip({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id })) { // can put the toy on them data.access = true; data[toybase.category] = true; - let fumble = toybase.fumble({ userID: toyuser.id, keyholderID: interaction.user.id }) + let fumble = toybase.fumble({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id }) if (fumble > 0) { // We fumbled the key data.fumble = true; if (fumble > 1) { // We lost the key data.keyloss = true; - let discardresult = toybase.discard({ userID: toyuser.id, keyholderID: interaction.user.id }) + let discardresult = toybase.discard({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id }) if (discardresult) { data[discardresult] = true } interaction.reply(getText(data)) } @@ -202,7 +203,7 @@ module.exports = { else { // Successfully unlocked blocking device data.nofumble = true; - assignToy(toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); + assignToy(interaction.guildId, toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); interaction.reply(getText(data)) } } @@ -217,7 +218,7 @@ module.exports = { // Not wearing chastity or anything data.noblocker = true data[toybase.category] = true; - assignToy(toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); + assignToy(interaction.guildId, toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); interaction.reply(getText(data)) } } @@ -228,20 +229,20 @@ module.exports = { if (getSpecificToy(toyuser.id, toytype)) { // toy already on wearer data.toy = true; - if (toybase.blocker({ userID: toyuser.id })) { + if (toybase.blocker({ serverID: interaction.guildId, userID: toyuser.id })) { data.blocker = true; - if (toybase.canModify({ userID: toyuser.id, keyholderID: interaction.user.id })) { + if (toybase.canModify({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id })) { // can access the toy data.access = true; data[toybase.category] = true; - let fumble = toybase.fumble({ userID: toyuser.id, keyholderID: interaction.user.id }) + let fumble = toybase.fumble({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id }) if (fumble > 0) { // We fumbled the key data.fumble = true; if (fumble > 1) { // We lost the key data.keyloss = true; - let discardresult = toybase.discard({ userID: toyuser.id, keyholderID: interaction.user.id }) + let discardresult = toybase.discard({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id }) if (discardresult) { data[discardresult] = true } interaction.reply(getText(data)) } @@ -254,7 +255,7 @@ module.exports = { else { // Successfully unlocked blocking device data.nofumble = true; - assignToy(toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); + assignToy(interaction.guildId, toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); interaction.reply(getText(data)) } } @@ -269,7 +270,7 @@ module.exports = { // Not wearing chastity or anything data.noblocker = true data[toybase.category] = true; - assignToy(toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); + assignToy(interaction.guildId, toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); interaction.reply(getText(data)) } } @@ -278,18 +279,18 @@ module.exports = { data.notoy = true; if (toybase.blocker({ userID: toyuser.id })) { data.blocker = true; - if (toybase.canEquip({ userID: toyuser.id, keyholderID: interaction.user.id })) { + if (toybase.canEquip({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id })) { // can put the toy on them data.access = true; data[toybase.category] = true; - let fumble = toybase.fumble({ userID: toyuser.id, keyholderID: interaction.user.id }) + let fumble = toybase.fumble({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id }) if (fumble > 0) { // We fumbled the key data.fumble = true; if (fumble > 1) { // We lost the key data.keyloss = true; - let discardresult = toybase.discard({ userID: toyuser.id, keyholderID: interaction.user.id }) + let discardresult = toybase.discard({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id }) if (discardresult) { data[discardresult] = true } interaction.reply(getText(data)) } @@ -302,7 +303,7 @@ module.exports = { else { // Successfully unlocked blocking device data.nofumble = true; - assignToy(toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); + assignToy(interaction.guildId, toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); interaction.reply(getText(data)) } } @@ -317,7 +318,7 @@ module.exports = { // Not wearing chastity or anything data.noblocker = true data[toybase.category] = true; - assignToy(toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); + assignToy(interaction.guildId, toyuser.id, interaction.user.id, toyintensity, toytype, interaction.user.id); interaction.reply(getText(data)) } } diff --git a/commands/unchastity.js b/commands/unchastity.js index 63f89969..78d5aac7 100644 --- a/commands/unchastity.js +++ b/commands/unchastity.js @@ -25,7 +25,7 @@ module.exports = { let chastitywearer = interaction.options.getUser("wearer") ? interaction.options.getUser("wearer") : interaction.user; let braorbelt = interaction.options.getString("braorbelt") ?? "chastitybelt"; // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } @@ -35,20 +35,20 @@ module.exports = { textdata: { interactionuser: interaction.user, targetuser: chastitywearer, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type }, }; data[braorbelt] = true; if (braorbelt == "chastitybelt") { // Trying to take off a chastity belt - if (!getHeavyBound(interaction.user.id, chastitywearer.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, chastitywearer.id)) { // In heavy bondage, cannot take off the belt anyway data.heavy = true; if (chastitywearer == interaction.user) { // trying to take off own belt data.self = true; - if (getChastity(interaction.user.id)) { + if (getChastity(interaction.guildId, interaction.user.id)) { // in chastity data.chastity = true; interaction.reply(getText(data)); @@ -59,7 +59,7 @@ module.exports = { } } else { data.other = true; - if (getChastity(interaction.user.id)) { + if (getChastity(interaction.guildId, interaction.user.id)) { data.chastity = true; interaction.reply(getText(data)); } else { @@ -77,20 +77,20 @@ module.exports = { if (chastitywearer == interaction.user) { // This is ourselves data.self = true; - if (getChastity(chastitywearer.id)) { + if (getChastity(interaction.guildId, chastitywearer.id)) { // We are in chastity data.chastity = true; - if (getBaseChastity(getChastity(chastitywearer.id).chastitytype ?? "belt_silver").canUnequip({ userID: chastitywearer.id, keyholderID: interaction.user.id })) { + if (getBaseChastity(getChastity(interaction.guildId, chastitywearer.id).chastitytype ?? "belt_silver").canUnequip({ serverID: interaction.guildId, userID: chastitywearer.id, keyholderID: interaction.user.id })) { // We have the key to our belt data.key = true; - const fumbleResult = getBaseChastity(getChastity(chastitywearer.id).chastitytype ?? "belt_silver").fumble({ userID: chastitywearer.id, keyholderID: interaction.user.id }) + const fumbleResult = getBaseChastity(getChastity(interaction.guildId, chastitywearer.id).chastitytype ?? "belt_silver").fumble({ serverID: interaction.guildId, userID: chastitywearer.id, keyholderID: interaction.user.id }) if (fumbleResult > 0) { // We fumbled data.fumble = true; - if ((getOption(chastitywearer.id, "keyloss") == "enabled") && fumbleResult > 1) { + if ((getOption(interaction.guildId, chastitywearer.id, "keyloss") == "enabled") && fumbleResult > 1) { // We lost the key data.discard = true; - let discardresult = getBaseChastity(getChastity(chastitywearer.id).chastitytype ?? "belt_silver").discard({ userID: chastitywearer.id, keyholderID: interaction.user.id }) + let discardresult = getBaseChastity(getChastity(interaction.guildId, chastitywearer.id).chastitytype ?? "belt_silver").discard({ serverID: interaction.guildId, userID: chastitywearer.id, keyholderID: interaction.user.id }) data[discardresult] = true; interaction.reply(getText(data)); } else { @@ -101,7 +101,7 @@ module.exports = { // We didnt lose the keys data.nofumble = true; interaction.reply(getText(data)); - removeChastity(chastitywearer.id, interaction.user.id); + removeChastity(interaction.guildId, chastitywearer.id, interaction.user.id); } } else { // We don't have the keys @@ -116,20 +116,20 @@ module.exports = { } else { // This is someone else data.other = true; - if (getChastity(chastitywearer.id)) { + if (getChastity(interaction.guildId, chastitywearer.id)) { // They are in chastity data.chastity = true; - if (getBaseChastity(getChastity(chastitywearer.id).chastitytype ?? "belt_silver").canUnequip({ userID: chastitywearer.id, keyholderID: interaction.user.id })) { + if (getBaseChastity(getChastity(interaction.guildId, chastitywearer.id).chastitytype ?? "belt_silver").canUnequip({ serverID: interaction.guildId, userID: chastitywearer.id, keyholderID: interaction.user.id })) { // We have their chastity key data.key = true; - const fumbleResult = getBaseChastity(getChastity(chastitywearer.id).chastitytype ?? "belt_silver").fumble({ userID: chastitywearer.id, keyholderID: interaction.user.id }) + const fumbleResult = getBaseChastity(getChastity(interaction.guildId, chastitywearer.id).chastitytype ?? "belt_silver").fumble({ serverID: interaction.guildId, userID: chastitywearer.id, keyholderID: interaction.user.id }) if (fumbleResult > 0) { // We fumbled the key data.fumble = true; - if ((getOption(chastitywearer.id, "keyloss") == "enabled") && fumbleResult > 1) { + if ((getOption(interaction.guildId, chastitywearer.id, "keyloss") == "enabled") && fumbleResult > 1) { // We lost the key data.discard = true; - let discardresult = getBaseChastity(getChastity(chastitywearer.id).chastitytype ?? "belt_silver").discard({ userID: chastitywearer.id, keyholderID: interaction.user.id }) + let discardresult = getBaseChastity(getChastity(interaction.guildId, chastitywearer.id).chastitytype ?? "belt_silver").discard({ serverID: interaction.guildId, userID: chastitywearer.id, keyholderID: interaction.user.id }) data[discardresult] = true; interaction.reply(getText(data)); } else { @@ -140,7 +140,7 @@ module.exports = { // did not fumble! data.nofumble = true; interaction.reply(getText(data)); - removeChastity(chastitywearer.id, interaction.user.id); + removeChastity(interaction.guildId, chastitywearer.id, interaction.user.id); } } else { // We don't have their chastity key @@ -156,13 +156,13 @@ module.exports = { } } else { // Trying to take off a chastity bra - if (!getHeavyBound(interaction.user.id, chastitywearer.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, chastitywearer.id)) { // In heavy bondage, cannot take off the belt anyway data.heavy = true; if (chastitywearer == interaction.user) { // trying to take off own belt data.self = true; - if (getChastityBra(interaction.user.id)) { + if (getChastityBra(interaction.guildId, interaction.user.id)) { // in chastity data.chastity = true; interaction.reply(getText(data)); @@ -173,7 +173,7 @@ module.exports = { } } else { data.other = true; - if (getChastityBra(interaction.user.id)) { + if (getChastityBra(interaction.guildId, interaction.user.id)) { data.chastity = true; interaction.reply(getText(data)); } else { @@ -191,20 +191,20 @@ module.exports = { if (chastitywearer == interaction.user) { // This is ourselves data.self = true; - if (getChastityBra(chastitywearer.id)) { + if (getChastityBra(interaction.guildId, chastitywearer.id)) { // We are in chastity data.chastity = true; - if (getBaseChastity(getChastityBra(chastitywearer.id).chastitytype ?? "bra_silver").canUnequip({ userID: chastitywearer.id, keyholderID: interaction.user.id })) { + if (getBaseChastity(getChastityBra(interaction.guildId, chastitywearer.id).chastitytype ?? "bra_silver").canUnequip({ serverID: interaction.guildId, userID: chastitywearer.id, keyholderID: interaction.user.id })) { // We have the key to our belt data.key = true; - const fumbleResult = getBaseChastity(getChastityBra(chastitywearer.id).chastitytype ?? "bra_silver").fumble({ userID: chastitywearer.id, keyholderID: interaction.user.id }) + const fumbleResult = getBaseChastity(getChastityBra(interaction.guildId, chastitywearer.id).chastitytype ?? "bra_silver").fumble({ serverID: interaction.guildId, userID: chastitywearer.id, keyholderID: interaction.user.id }) if (fumbleResult > 0) { // We fumbled data.fumble = true; - if ((getOption(chastitywearer.id, "keyloss") == "enabled") && fumbleResult > 1) { + if ((getOption(interaction.guildId, chastitywearer.id, "keyloss") == "enabled") && fumbleResult > 1) { // We lost the key data.discard = true; - let discardresult = getBaseChastity(getChastityBra(chastitywearer.id).chastitytype ?? "bra_silver").discard({ userID: chastitywearer.id, keyholderID: interaction.user.id }) + let discardresult = getBaseChastity(getChastityBra(interaction.guildId, chastitywearer.id).chastitytype ?? "bra_silver").discard({ serverID: interaction.guildId, userID: chastitywearer.id, keyholderID: interaction.user.id }) data[discardresult] = true; interaction.reply(getText(data)); } else { @@ -215,7 +215,7 @@ module.exports = { // We didnt lose the keys data.nofumble = true; interaction.reply(getText(data)); - removeChastityBra(chastitywearer.id, interaction.user.id); + removeChastityBra(interaction.guildId, chastitywearer.id, interaction.user.id); } } else { // We don't have the keys @@ -230,20 +230,20 @@ module.exports = { } else { // This is someone else data.other = true; - if (getChastityBra(chastitywearer.id)) { + if (getChastityBra(interaction.guildId, chastitywearer.id)) { // They are in chastity data.chastity = true; - if (getBaseChastity(getChastityBra(chastitywearer.id).chastitytype ?? "bra_silver").canUnequip({ userID: chastitywearer.id, keyholderID: interaction.user.id })) { + if (getBaseChastity(getChastityBra(interaction.guildId, chastitywearer.id).chastitytype ?? "bra_silver").canUnequip({ serverID: interaction.guildId, userID: chastitywearer.id, keyholderID: interaction.user.id })) { // We have their chastity key or otherwise have access data.key = true; - const fumbleResult = getBaseChastity(getChastityBra(chastitywearer.id).chastitytype ?? "bra_silver").fumble({ userID: chastitywearer.id, keyholderID: interaction.user.id }) + const fumbleResult = getBaseChastity(getChastityBra(interaction.guildId, chastitywearer.id).chastitytype ?? "bra_silver").fumble({ serverID: interaction.guildId, userID: chastitywearer.id, keyholderID: interaction.user.id }) if (fumbleResult > 0) { // We fumbled the key data.fumble = true; - if ((getOption(chastitywearer.id, "keyloss") == "enabled") && fumbleResult > 1) { + if ((getOption(interaction.guildId, chastitywearer.id, "keyloss") == "enabled") && fumbleResult > 1) { // We lost the key data.discard = true; - let discardresult = getBaseChastity(getChastityBra(chastitywearer.id).chastitytype ?? "bra_silver").discard({ userID: chastitywearer.id, keyholderID: interaction.user.id }) + let discardresult = getBaseChastity(getChastityBra(interaction.guildId, chastitywearer.id).chastitytype ?? "bra_silver").discard({ serverID: interaction.guildId, userID: chastitywearer.id, keyholderID: interaction.user.id }) data[discardresult] = true; interaction.reply(getText(data)); } else { @@ -254,7 +254,7 @@ module.exports = { // did not fumble! data.nofumble = true; interaction.reply(getText(data)); - removeChastityBra(chastitywearer.id, interaction.user.id); + removeChastityBra(interaction.guildId, chastitywearer.id, interaction.user.id); } } else { // We don't have their chastity key diff --git a/commands/uncollar.js b/commands/uncollar.js index a3633e34..f3f7fde3 100644 --- a/commands/uncollar.js +++ b/commands/uncollar.js @@ -20,20 +20,21 @@ module.exports = { let data = { textarray: "texts_uncollar", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: collaruser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type - c2: getCollarName(collaruser.id, getCollar(collaruser.id)?.collartype) ?? "collar" + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type + c2: getCollarName(interaction.guildId, collaruser.id, getCollar(interaction.guildId, collaruser.id)?.collartype) ?? "collar" }, }; - if (!getHeavyBound(interaction.user.id, interaction.user.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, interaction.user.id)) { // in heavy bondage, can't data.heavy = true; if (interaction.user == collaruser) { // This is ourselves data.self = true; - if (getCollar(interaction.user.id)) { + if (getCollar(interaction.guildId, interaction.user.id)) { // we are wearing a collar data.collar = true; interaction.reply(getText(data)); @@ -45,7 +46,7 @@ module.exports = { } else { // This is someone else data.other = true; - if (getCollar(collaruser.id)) { + if (getCollar(interaction.guildId, collaruser.id)) { // They are wearing a collar data.collar = true; interaction.reply(getText(data)); @@ -61,14 +62,14 @@ module.exports = { if (interaction.user == collaruser) { // This is ourselves data.self = true; - if (getCollar(collaruser.id)) { + if (getCollar(interaction.guildId, collaruser.id)) { // we are wearing a collar data.collar = true; - if (canAccessCollar(collaruser.id, interaction.user.id, true).access) { + if (canAccessCollar(interaction.guildId, collaruser.id, interaction.user.id, true).access) { // We have the key to our own collar data.key = true; interaction.reply(getText(data)); - removeCollar(collaruser.id); + removeCollar(interaction.guildId, collaruser.id); } else { // We do not have the key to our collar. data.nokey = true; @@ -82,18 +83,18 @@ module.exports = { } else { // This is someone else data.other = true; - if (getCollar(collaruser.id)) { + if (getCollar(interaction.guildId, collaruser.id)) { // they are wearing a collar data.collar = true; - if (canAccessCollar(collaruser.id, interaction.user.id, true).access) { + if (canAccessCollar(interaction.guildId, collaruser.id, interaction.user.id, true).access) { // We have the key to their collar data.key = true; interaction.reply(getText(data)); - removeCollar(collaruser.id); + removeCollar(interaction.guildId, collaruser.id); } else { // We do not have the key to their collar. Ephemeral data.nokey = true; - if (!getCollar(collaruser.id).keyholderOnly && getCollar(collaruser.id).keyholder == collaruser.id) { + if (!getCollar(interaction.guildId, collaruser.id).keyholderOnly && getCollar(interaction.guildId, collaruser.id).keyholder == collaruser.id) { // They're wearing an unlocked collar - its their choice! data.nokeyholderonly = true; interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); diff --git a/commands/uncorset.js b/commands/uncorset.js index 66e336a4..4483efd2 100644 --- a/commands/uncorset.js +++ b/commands/uncorset.js @@ -24,30 +24,31 @@ module.exports = { try { let corsetuser = interaction.options.getUser("user") ? interaction.options.getUser("user") : interaction.user; // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } let data = { textarray: "texts_uncorset", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: corsetuser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type - c2: getBaseCorset(getCorset(corsetuser.id).type)?.name ?? "Leather Corset", // corset type + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type + c2: getBaseCorset(getCorset(interaction.guildId, corsetuser.id).type)?.name ?? "Leather Corset", // corset type }, }; - if (!getHeavyBound(interaction.user.id, corsetuser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, corsetuser.id)) { // User is in heavy bondage data.heavy = true; if (corsetuser == interaction.user) { // Working with ourselves! data.self = true; - if (getCorset(corsetuser.id)) { + if (getCorset(interaction.guildId, corsetuser.id)) { // We are wearing a corset! data.corset = true; - if (getChastity(corsetuser.id)) { + if (getChastity(interaction.guildId, corsetuser.id)) { // We're in a chastity belt! data.chastity = true; interaction.reply(getText(data)); @@ -64,10 +65,10 @@ module.exports = { } else { // Working with others data.other = true; - if (getCorset(corsetuser.id)) { + if (getCorset(interaction.guildId, corsetuser.id)) { // They are wearing a corset! data.corset = true; - if (getChastity(corsetuser.id)) { + if (getChastity(interaction.guildId, orsetuser.id)) { // They're in a chastity belt! data.chastity = true; interaction.reply(getText(data)); @@ -88,23 +89,23 @@ module.exports = { if (corsetuser == interaction.user) { // Working with ourselves! data.self = true; - if (getCorset(corsetuser.id)) { + if (getCorset(interaction.guildId, corsetuser.id)) { // We are wearing a corset! data.corset = true; - if (getChastity(corsetuser.id)) { + if (getChastity(interaction.guildId, corsetuser.id)) { // We're in a chastity belt! data.chastity = true; - if (canAccessChastity(corsetuser.id, interaction.user.id).access) { + if (canAccessChastity(interaction.guildId, corsetuser.id, interaction.user.id).access) { // We own the key for the chastity belt data.key = true; - const fumbleResult = getBaseChastity(getChastity(corsetuser.id).chastitytype).fumble({ userID: corsetuser.id, keyholderID: interaction.user.id }) + const fumbleResult = getBaseChastity(getChastity(interaction.guildId, corsetuser.id).chastitytype).fumble({ serverID: interaction.guildId, userID: corsetuser.id, keyholderID: interaction.user.id }) if (fumbleResult > 0) { // We fumbled the key data.fumble = true; - if ((getOption(corsetuser.id, "keyloss") == "enabled") && fumbleResult > 1) { + if ((getOption(interaction.guildId, corsetuser.id, "keyloss") == "enabled") && fumbleResult > 1) { // We lost the key while fumbling data.discard = true; - let discardresult = getBaseChastity(getChastity(corsetuser.id).chastitytype ?? "belt_silver").discard({ userID: corsetuser.id, keyholderID: interaction.user.id }) + let discardresult = getBaseChastity(getChastity(interaction.guildId, corsetuser.id).chastitytype ?? "belt_silver").discard({ serverID: interaction.guildId, userID: corsetuser.id, keyholderID: interaction.user.id }) data[discardresult] = true; interaction.reply(getText(data)); } else { @@ -115,7 +116,7 @@ module.exports = { // We didnt fumble! data.nofumble = true; interaction.reply(getText(data)); - removeCorset(corsetuser.id); + removeCorset(interaction.guildId, corsetuser.id); } } // Note, no public access to our own belt! @@ -128,7 +129,7 @@ module.exports = { // We're not belted data.nochastity = true; interaction.reply(getText(data)); - removeCorset(corsetuser.id); + removeCorset(interaction.guildId, corsetuser.id); } } else { // We're not in a corset @@ -138,23 +139,23 @@ module.exports = { } else { // Working with others data.other = true; - if (getCorset(corsetuser.id)) { + if (getCorset(interaction.guildId, corsetuser.id)) { // They are wearing a corset! data.corset = true; - if (getChastity(corsetuser.id)) { + if (getChastity(interaction.guildId, corsetuser.id)) { // They're in a chastity belt! data.chastity = true; - if (canAccessChastity(corsetuser.id, interaction.user.id).access && !canAccessChastity(corsetuser.id, interaction.user.id).public) { + if (canAccessChastity(interaction.guildId, corsetuser.id, interaction.user.id).access && !canAccessChastity(interaction.guildId, corsetuser.id, interaction.user.id).public) { // We own the key for the chastity belt and it is NOT sealed. data.key = true; - const fumbleResult = getBaseChastity(getChastity(corsetuser.id).chastitytype).fumble({ userID: corsetuser.id, keyholderID: interaction.user.id }) + const fumbleResult = getBaseChastity(getChastity(interaction.guildId, corsetuser.id).chastitytype).fumble({ serverID: interaction.guildId, userID: corsetuser.id, keyholderID: interaction.user.id }) if (fumbleResult > 0) { // We fumbled the key data.fumble = true; - if ((getOption(corsetuser.id, "keyloss") == "enabled") && fumbleResult > 1) { + if ((getOption(interaction.guildId, corsetuser.id, "keyloss") == "enabled") && fumbleResult > 1) { // We lost the key while fumbling data.discard = true; - let discardresult = getBaseChastity(getChastity(corsetuser.id).chastitytype ?? "belt_silver").discard({ userID: corsetuser.id, keyholderID: interaction.user.id }) + let discardresult = getBaseChastity(getChastity(interaction.guildId, corsetuser.id).chastitytype ?? "belt_silver").discard({ serverID: interaction.guildId, userID: corsetuser.id, keyholderID: interaction.user.id }) data[discardresult] = true; interaction.reply(getText(data)); } else { @@ -165,20 +166,20 @@ module.exports = { // We didnt fumble! data.nofumble = true; // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interaction.user.id, corsetuser.id, "corset") == true) { + if (checkBondageRemoval(interaction.guildId, interaction.user.id, corsetuser.id, "corset") == true) { // Allowed immediately, lets go interaction.reply(getText(data)); - removeCorset(corsetuser.id); + removeCorset(interaction.guildId, corsetuser.id); } else { // We need to ask first. let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "corset"; interaction.reply({ content: getTextGeneric("unbind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interaction.user, corsetuser, "corset").then( + let canRemove = await handleBondageRemoval(interaction.guildId, interaction.user, corsetuser, "corset").then( async (res) => { await interaction.editReply(getTextGeneric("unbind_accept", datatogeneric)); await interaction.followUp(getText(data)); - removeCorset(corsetuser.id); + removeCorset(interaction.guildId, corsetuser.id); }, async (rej) => { await interaction.editReply(getTextGeneric("unbind_decline", datatogeneric)); @@ -186,24 +187,24 @@ module.exports = { ); } } - } else if (canAccessChastity(corsetuser.id, interaction.user.id).access && canAccessChastity(corsetuser.id, interaction.user.id).public) { + } else if (canAccessChastity(interaction.guildId, corsetuser.id, interaction.user.id).access && canAccessChastity(interaction.guildId, corsetuser.id, interaction.user.id).public) { // This is a public access belt! data.public = true; // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interaction.user.id, corsetuser.id, "corset") == true) { + if (checkBondageRemoval(interaction.guildId, interaction.user.id, corsetuser.id, "corset") == true) { // Allowed immediately, lets go interaction.reply(getText(data)); - removeCorset(corsetuser.id); + removeCorset(interaction.guildId, corsetuser.id); } else { // We need to ask first. let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "corset"; interaction.reply({ content: getTextGeneric("unbind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interaction.user, corsetuser, "corset").then( + let canRemove = await handleBondageRemoval(interaction.guildId, interaction.user, corsetuser, "corset").then( async (res) => { await interaction.editReply(getTextGeneric("unbind_accept", datatogeneric)); await interaction.followUp(getText(data)); - removeCorset(corsetuser.id); + removeCorset(interaction.guildId, corsetuser.id); }, async (rej) => { await interaction.editReply(getTextGeneric("unbind_decline", datatogeneric)); @@ -219,7 +220,7 @@ module.exports = { // They're not belted data.nochastity = true; // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interaction.user.id, corsetuser.id, "corset") == true) { + if (checkBondageRemoval(interaction.guildId, interaction.user.id, corsetuser.id, "corset") == true) { // Allowed immediately, lets go interaction.reply(getText(data)); removeCorset(corsetuser.id); @@ -228,11 +229,11 @@ module.exports = { let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "corset"; interaction.reply({ content: getTextGeneric("unbind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interaction.user, corsetuser, "corset").then( + let canRemove = await handleBondageRemoval(interaction.guildId, interaction.user, corsetuser, "corset").then( async (res) => { await interaction.editReply(getTextGeneric("unbind_accept", datatogeneric)); await interaction.followUp(getText(data)); - removeCorset(corsetuser.id); + removeCorset(interaction.guildId, corsetuser.id); }, async (rej) => { await interaction.editReply(getTextGeneric("unbind_decline", datatogeneric)); diff --git a/commands/ungag.js b/commands/ungag.js index 3afb70dc..1031acc9 100644 --- a/commands/ungag.js +++ b/commands/ungag.js @@ -60,22 +60,23 @@ module.exports = { gagtoremove = getGags(interaction.guildId, gaggeduser.id)[0].gagtype; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } let data = { textarray: "texts_ungag", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: gaggeduser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type c2: process.gagtypes.find((t) => t.value == gagtoremove)?.name ?? "gag", }, }; // Fuck it, I'm just gonna redo the code path because I've been redoing all the removals anyway. - if (!getHeavyBound(interaction.user.id, gaggeduser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, gaggeduser.id)) { // We are in heavy bondage data.heavy = true; if (gaggeduser == interaction.user) { @@ -106,7 +107,7 @@ module.exports = { } else { // Not in heavy bondage data.noheavy = true; - if (getMitten(interaction.user.id)) { + if (getMitten(interaction.guildId, interaction.user.id)) { // We are wearing mittens! data.mitten = true; if (gaggeduser == interaction.user) { @@ -145,23 +146,23 @@ module.exports = { data.gag = true; // Now check if we have any gags that are locked on! let lockedheadgears = []; - if (process.headwear[gaggeduser.id]) { lockedheadgears = Object.keys(process.headwear[gaggeduser.id]) } - if (gagtoremove && process.headwear[gaggeduser.id] && process.headwear[gaggeduser.id][`gagharness_${gagtoremove}`]) { + if (process.headwear[interaction.guildId][gaggeduser.id]) { lockedheadgears = Object.keys(process.headwear[interaction.guildId][gaggeduser.id]) } + if (gagtoremove && process.headwear[interaction.guildId][gaggeduser.id] && process.headwear[interaction.guildId][gaggeduser.id][`gagharness_${gagtoremove}`]) { data.failed = true interaction.reply(getText(data)); } else if (gagtoremove) { data.single = true; interaction.reply(getText(data)); - deleteGag(gaggeduser.id, gagtoremove); + deleteGag(interaction.guildId, gaggeduser.id, gagtoremove); } else if (lockedheadgears.find((h) => h.startsWith(`gagharness`))) { data.multipleharnessed = true; interaction.reply(getText(data)); - deleteGag(gaggeduser.id); + deleteGag(interaction.guildId, gaggeduser.id); } else { data.multiple = true; interaction.reply(getText(data)); - deleteGag(gaggeduser.id); + deleteGag(interaction.guildId, gaggeduser.id); } } else { // Not gagged! Ephemeral @@ -176,19 +177,19 @@ module.exports = { data.gag = true; // Now check if we have any gags that are locked on! let lockedheadgears = []; - if (process.headwear[gaggeduser.id]) { lockedheadgears = Object.keys(process.headwear[gaggeduser.id]) } - if (gagtoremove && process.headwear[gaggeduser.id] && process.headwear[gaggeduser.id][`gagharness_${gagtoremove}`]) { + if (process.headwear[interaction.guildId][gaggeduser.id]) { lockedheadgears = Object.keys(process.headwear[interaction.guildId][gaggeduser.id]) } + if (gagtoremove && process.headwear[interaction.guildId][gaggeduser.id] && process.headwear[interaction.guildId][gaggeduser.id][`gagharness_${gagtoremove}`]) { data.failed = true interaction.reply(getText(data)); return; } // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interaction.user.id, gaggeduser.id, "gag") == true) { + if (checkBondageRemoval(interaction.guildId, interaction.user.id, gaggeduser.id, "gag") == true) { // Allowed immediately, lets go if (gagtoremove) { data.single = true; interaction.reply(getText(data)); - deleteGag(gaggeduser.id, gagtoremove); + deleteGag(interaction.guildId, gaggeduser.id, gagtoremove); } else { if (lockedheadgears.find((h) => h.startsWith(`gagharness`))) { data.multipleharnessed = true; @@ -197,20 +198,20 @@ module.exports = { data.multiple = true; } interaction.reply(getText(data)); - deleteGag(gaggeduser.id); + deleteGag(interaction.guildId, gaggeduser.id); } } else { // We need to ask first. let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "gag"; interaction.reply({ content: getTextGeneric("unbind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interaction.user, gaggeduser, "gag").then( + let canRemove = await handleBondageRemoval(interaction.guildId, interaction.user, gaggeduser, "gag").then( async (res) => { await interaction.editReply(getTextGeneric("unbind_accept", datatogeneric)); if (gagtoremove) { data.single = true; await interaction.followUp(getText(data)); - deleteGag(gaggeduser.id, gagtoremove); + deleteGag(interaction.guildId, gaggeduser.id, gagtoremove); } else { if (lockedheadgears.find((h) => h.startsWith(`gagharness`))) { data.multipleharnessed = true; @@ -219,7 +220,7 @@ module.exports = { data.multiple = true; } await interaction.followUp(getText(data)); - deleteGag(gaggeduser.id); + deleteGag(interaction.guildId, gaggeduser.id); } }, async (rej) => { diff --git a/commands/unheavy.js b/commands/unheavy.js index b6d021e3..6b59d720 100644 --- a/commands/unheavy.js +++ b/commands/unheavy.js @@ -26,7 +26,7 @@ module.exports = { try { const focusedValue = interaction.options.getFocused(); let chosenuserid = interaction.options.get("user")?.value ?? interaction.user.id; // Note we can only retrieve the user ID here! - let autocompletes = getHeavyList(chosenuserid).map((h) => { return { name: getBaseHeavy(h.type).name, value: h.type }}) + let autocompletes = getHeavyList(interaction.guildId, chosenuserid).map((h) => { return { name: getBaseHeavy(h.type).name, value: h.type }}) let matches = didYouMean(focusedValue, autocompletes, { matchPath: ['name'], returnType: ReturnTypeEnums.ALL_SORTED_MATCHES, // Returns any match meeting 20% of the input @@ -48,21 +48,22 @@ module.exports = { let heavyuser = interaction.options.getUser("user") ? interaction.options.getUser("user") : interaction.user; let heavytype = interaction.options.getString("type") ?? getHeavy(heavyuser.id)?.type; // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } let data = { textarray: "texts_unheavy", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: heavyuser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type - c2: getHeavy(heavyuser.id, heavytype)?.displayname ?? getBaseHeavy(heavytype)?.name + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type + c2: getHeavy(interaction.guildId, heavyuser.id, heavytype)?.displayname ?? getBaseHeavy(heavytype)?.name }, }; - if (!getHeavy(heavyuser.id, heavytype)) { + if (!getHeavy(interaction.guildId, heavyuser.id, heavytype)) { // They aren't bound lol. data.noheavy = true; data.noheavyequipped = true; @@ -71,7 +72,7 @@ module.exports = { return; } - if (!getHeavyBound(interaction.user.id, heavyuser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, heavyuser.id)) { // user IS in heavy bondage data.heavy = true; if (interaction.user == heavyuser) { @@ -86,7 +87,7 @@ module.exports = { } else { // Not in heavy bondage data.noheavy = true; - if (getHeavy(heavyuser.id, heavytype)) { + if (getHeavy(interaction.guildId, heavyuser.id, heavytype)) { data.heavyequipped = true; if (interaction.user == heavyuser) { data.self = true; @@ -95,20 +96,20 @@ module.exports = { data.other = true; } // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interaction.user.id, heavyuser.id, "heavy") == true) { + if (checkBondageRemoval(interaction.guildId, interaction.user.id, heavyuser.id, "heavy") == true) { // Allowed immediately, lets go interaction.reply(getText(data)); - removeHeavy(heavyuser.id, heavytype); + removeHeavy(interaction.guildId, heavyuser.id, heavytype); } else { // We need to ask first. let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "heavy bondage"; interaction.reply({ content: getTextGeneric("unbind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interaction.user, heavyuser, getHeavy(heavyuser.id, heavytype)?.displayname ?? "heavy bondage").then( + let canRemove = await handleBondageRemoval(interaction.guildId, interaction.user, heavyuser, getHeavy(interaction.guildId, heavyuser.id, heavytype)?.displayname ?? "heavy bondage").then( async (res) => { await interaction.editReply(getTextGeneric("unbind_accept", datatogeneric)); await interaction.followUp(getText(data)); - removeHeavy(heavyuser.id, heavytype); + removeHeavy(interaction.guildId, heavyuser.id, heavytype); }, async (rej) => { await interaction.editReply(getTextGeneric("unbind_decline", datatogeneric)); diff --git a/commands/unmask.js b/commands/unmask.js index 7f23c8bb..1dbe27ef 100644 --- a/commands/unmask.js +++ b/commands/unmask.js @@ -23,8 +23,8 @@ module.exports = { if (focusedValue == "") { try { // User hasn't entered anything, lets give them a suggested set of 10 - let itemsworn = getHeadwear(chosenuserid); - let itemslocked = getLockedHeadgear(chosenuserid); + let itemsworn = getHeadwear(interaction.guildId, chosenuserid); + let itemslocked = getLockedHeadgear(interaction.guildId, chosenuserid); // Remove anything we're already wearing from the list let sorted = process.autocompletes.headtypes.filter((f) => itemsworn.includes(f.value)); @@ -36,8 +36,8 @@ module.exports = { } } else { try { - let itemsworn = getHeadwear(chosenuserid); - let itemslocked = getLockedHeadgear(chosenuserid); + let itemsworn = getHeadwear(interaction.guildId, chosenuserid); + let itemslocked = getLockedHeadgear(interaction.guildId, chosenuserid); // Remove anything we're already wearing from the list let sorted = process.headtypes.filter((f) => itemsworn.includes(f.value)); @@ -52,29 +52,30 @@ module.exports = { async execute(interaction) { try { let headwearuser = interaction.options.getUser("user") ?? interaction.user; - let headwearchoice = interaction.options.getString("type") ?? (getHeadwear(headwearuser.id) && getHeadwear(headwearuser.id)[0]); + let headwearchoice = interaction.options.getString("type") ?? (getHeadwear(interaction.guildId, headwearuser.id) && getHeadwear(interaction.guildId, headwearuser.id)[0]); // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(headwearuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, headwearuser.id)?.mainconsent) { await handleConsent(interaction, headwearuser.id); return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } let data = { textarray: "texts_unheadwear", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: headwearuser, headwearchoice: headwearchoice ?? "none", - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type - c2: getHeadwearName(headwearuser.id, headwearchoice), + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type + c2: getHeadwearName(interaction.guildId, headwearuser.id, headwearchoice), }, }; - if (getHeadwear(headwearuser.id)[0] == undefined) { + if (getHeadwear(interaction.guildId, headwearuser.id)[0] == undefined) { data.noneworn = true if (headwearuser.id == interaction.user.id) { data.self = true @@ -92,7 +93,7 @@ module.exports = { return; } - if (!getHeavyBound(interaction.user.id, headwearuser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, headwearuser.id)) { // target is in heavy bondage data.heavy = true; if (headwearuser.id == interaction.user.id) { @@ -101,7 +102,7 @@ module.exports = { if (headwearchoice) { // We're targetting a specific headwear piece. data.single = true; - if (getHeadwear(headwearuser.id).includes(headwearchoice)) { + if (getHeadwear(interaction.guildId, headwearuser.id).includes(headwearchoice)) { // Wearing the headgear already data.worn = true; interaction.reply(getText(data)); @@ -113,7 +114,7 @@ module.exports = { } else { // We're removing ALL headwear data.multiple = true; - if (getHeadwear(headwearuser.id).length > 0) { + if (getHeadwear(interaction.guildId, headwearuser.id).length > 0) { // Wearing something data.worn = true; interaction.reply(getText(data)); @@ -129,7 +130,7 @@ module.exports = { if (headwearchoice) { // We're targetting a specific headwear piece. data.single = true; - if (getHeadwear(headwearuser.id).includes(headwearchoice)) { + if (getHeadwear(interaction.guildId, headwearuser.id).includes(headwearchoice)) { // Wearing the headgear already data.worn = true; interaction.reply(getText(data)); @@ -141,7 +142,7 @@ module.exports = { } else { // We're removing ALL headwear data.multiple = true; - if (getHeadwear(headwearuser.id).length > 0) { + if (getHeadwear(interaction.guildId, headwearuser.id).length > 0) { // Wearing something data.worn = true; interaction.reply(getText(data)); @@ -155,7 +156,7 @@ module.exports = { } else { // Not in heavy bondage data.noheavy = true; - if (getMitten(interaction.user.id)) { + if (getMitten(interaction.guildId, interaction.user.id)) { // Wearing mittens! data.mitten = true; if (headwearuser.id == interaction.user.id) { @@ -164,7 +165,7 @@ module.exports = { if (headwearchoice) { // We're targetting a specific headwear piece. data.single = true; - if (getHeadwear(headwearuser.id).includes(headwearchoice)) { + if (getHeadwear(interaction.guildId, headwearuser.id).includes(headwearchoice)) { // Wearing the headgear already data.worn = true; interaction.reply(getText(data)); @@ -176,7 +177,7 @@ module.exports = { } else { // We're removing ALL headwear data.multiple = true; - if (getHeadwear(headwearuser.id).length > 0) { + if (getHeadwear(interaction.guildId, headwearuser.id).length > 0) { // Wearing something data.worn = true; interaction.reply(getText(data)); @@ -192,7 +193,7 @@ module.exports = { if (headwearchoice) { // We're targetting a specific headwear piece. data.single = true; - if (getHeadwear(headwearuser.id).includes(headwearchoice)) { + if (getHeadwear(interaction.guildId, headwearuser.id).includes(headwearchoice)) { // Wearing the headgear already data.worn = true; interaction.reply(getText(data)); @@ -204,7 +205,7 @@ module.exports = { } else { // We're removing ALL headwear data.multiple = true; - if (getHeadwear(headwearuser.id).length > 0) { + if (getHeadwear(interaction.guildId, headwearuser.id).length > 0) { // Wearing something data.worn = true; interaction.reply(getText(data)); @@ -224,10 +225,10 @@ module.exports = { if (headwearchoice) { // Targetting one specific headgear data.single = true; - if (getHeadwear(headwearuser.id).includes(headwearchoice)) { + if (getHeadwear(interaction.guildId, headwearuser.id).includes(headwearchoice)) { // Wearing the headgear already, Ephemeral - if (process.headwear[headwearuser.id][headwearchoice]) { - if ((process.headwear[headwearuser.id][headwearchoice].lockable) && (process.headwear[headwearuser.id][headwearchoice].origbinder != interaction.user.id)) { + if (process.headwear[interaction.guildId][headwearuser.id][headwearchoice]) { + if ((process.headwear[interaction.guildId][headwearuser.id][headwearchoice].lockable) && (process.headwear[interaction.guildId][headwearuser.id][headwearchoice].origbinder != interaction.user.id)) { // Not allowed to unlock headgear someone else put on us. data.locked = true; interaction.reply(getText(data)); @@ -236,7 +237,7 @@ module.exports = { } data.worn = true; interaction.reply(getText(data)); - deleteHeadwear(headwearuser.id, headwearchoice); + deleteHeadwear(interaction.guildId, headwearuser.id, headwearchoice); } else { // Not wearing it! data.noworn = true; @@ -245,11 +246,11 @@ module.exports = { } else { // Targetting all headgear data.multiple = true; - if (getHeadwear(headwearuser.id).length > 0) { + if (getHeadwear(interaction.guildId, headwearuser.id).length > 0) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply(getText(data)); - deleteHeadwear(headwearuser.id, headwearchoice); + deleteHeadwear(interaction.guildId, headwearuser.id, headwearchoice); } else { // Not wearing it! data.noworn = true; @@ -262,10 +263,10 @@ module.exports = { if (headwearchoice) { // Targetting one specific headgear data.single = true; - if (getHeadwear(headwearuser.id).includes(headwearchoice)) { + if (getHeadwear(interaction.guildId, headwearuser.id).includes(headwearchoice)) { // Wearing the headgear already, Ephemeral - if (process.headwear[headwearuser.id][headwearchoice]) { - if ((process.headwear[headwearuser.id][headwearchoice].lockable) && (process.headwear[headwearuser.id][headwearchoice].origbinder != interaction.user.id)) { + if (process.headwear[interaction.guildId][headwearuser.id][headwearchoice]) { + if ((process.headwear[interaction.guildId][headwearuser.id][headwearchoice].lockable) && (process.headwear[interaction.guildId][headwearuser.id][headwearchoice].origbinder != interaction.user.id)) { // Not allowed to unlock headgear someone else put on them. data.locked = true; interaction.reply(getText(data)); @@ -274,20 +275,20 @@ module.exports = { } data.worn = true; // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interaction.user.id, headwearuser.id, "headwear", headwearchoice) == true) { + if (checkBondageRemoval(interaction.guildId, interaction.user.id, headwearuser.id, "headwear", headwearchoice) == true) { // Allowed immediately, lets go interaction.reply(getText(data)); - deleteHeadwear(headwearuser.id, headwearchoice); + deleteHeadwear(interaction.guildId, headwearuser.id, headwearchoice); } else { // We need to ask first. let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "head restraints"; interaction.reply({ content: getTextGeneric("unbind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interaction.user, headwearuser, "head restraints").then( + let canRemove = await handleBondageRemoval(interaction.guildId, interaction.user, headwearuser, "head restraints").then( async (res) => { await interaction.editReply(getTextGeneric("unbind_accept", datatogeneric)); await interaction.followUp(getText(data)); - deleteHeadwear(headwearuser.id, headwearchoice); + deleteHeadwear(interaction.guildId, headwearuser.id, headwearchoice); }, async (rej) => { await interaction.editReply(getTextGeneric("unbind_decline", datatogeneric)); @@ -306,20 +307,20 @@ module.exports = { // Wearing the headgear already, Ephemeral data.worn = true; // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interaction.user.id, headwearuser.id, "headwear") == true) { + if (checkBondageRemoval(interaction.guildId, interaction.user.id, headwearuser.id, "headwear") == true) { // Allowed immediately, lets go interaction.reply(getText(data)); - deleteHeadwear(headwearuser.id, headwearchoice); + deleteHeadwear(interaction.guildId, headwearuser.id, headwearchoice); } else { // We need to ask first. let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "head restraints"; interaction.reply({ content: getTextGeneric("unbind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interaction.user, headwearuser, "head restraints").then( + let canRemove = await handleBondageRemoval(interaction.guildId, interaction.user, headwearuser, "head restraints").then( async (res) => { await interaction.editReply(getTextGeneric("unbind_accept", datatogeneric)); await interaction.followUp(getText(data)); - deleteHeadwear(headwearuser.id, headwearchoice); + deleteHeadwear(interaction.guildId, headwearuser.id, headwearchoice); }, async (rej) => { await interaction.editReply(getTextGeneric("unbind_decline", datatogeneric)); diff --git a/commands/unmitten.js b/commands/unmitten.js index e4fc6967..888f8d64 100644 --- a/commands/unmitten.js +++ b/commands/unmitten.js @@ -19,20 +19,21 @@ module.exports = { try { let mitteneduser = interaction.options.getUser("user") ? interaction.options.getUser("user") : interaction.user; // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } let data = { textarray: "texts_unmitten", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: mitteneduser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type - c2: getMittenName(getMitten(mitteneduser.id)?.mittenname) ?? "mittens" + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type + c2: getMittenName(getMitten(interaction.guildId, mitteneduser.id)?.mittenname) ?? "mittens" }, }; - if (!getHeavyBound(interaction.user.id, mitteneduser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, mitteneduser.id)) { data.heavy = true; if (interaction.options.getUser("user") == interaction.user) { data.self = true; @@ -41,27 +42,27 @@ module.exports = { data.other = true; interaction.reply(getText(data)); } - } else if (getMitten(mitteneduser.id)) { + } else if (getMitten(interaction.guildId, mitteneduser.id)) { data.noheavy = true; if (mitteneduser != interaction.user) { data.other = true; if (getGag(interaction.guildId, mitteneduser.id)) { data.gag = true; // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interaction.user.id, mitteneduser.id, "mitten") == true) { + if (checkBondageRemoval(interaction.guildId, interaction.user.id, mitteneduser.id, "mitten") == true) { // Allowed immediately, lets go interaction.reply(getText(data)); - deleteMitten(mitteneduser.id); + deleteMitten(interaction.guildId, mitteneduser.id); } else { // We need to ask first. let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "mittens"; interaction.reply({ content: getTextGeneric("unbind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interaction.user, mitteneduser, "mittens").then( + let canRemove = await handleBondageRemoval(interaction.guildId, interaction.user, mitteneduser, "mittens").then( async (res) => { await interaction.editReply(getTextGeneric("unbind_accept", datatogeneric)); await interaction.followUp(getText(data)); - deleteMitten(mitteneduser.id); + deleteMitten(interaction.guildId, mitteneduser.id); }, async (rej) => { await interaction.editReply(getTextGeneric("unbind_decline", datatogeneric)); @@ -71,20 +72,20 @@ module.exports = { } else { data.nogag = true; // Now lets make sure the wearer wants that. - if (checkBondageRemoval(interaction.user.id, mitteneduser.id, "mitten") == true) { + if (checkBondageRemoval(interaction.guildId, interaction.user.id, mitteneduser.id, "mitten") == true) { // Allowed immediately, lets go interaction.reply(getText(data)); - deleteMitten(mitteneduser.id); + deleteMitten(interaction.guildId, mitteneduser.id); } else { // We need to ask first. let datatogeneric = Object.assign({}, data.textdata); datatogeneric.c1 = "mittens"; interaction.reply({ content: getTextGeneric("unbind", datatogeneric), flags: MessageFlags.Ephemeral }); - let canRemove = await handleBondageRemoval(interaction.user, mitteneduser, "mittens").then( + let canRemove = await handleBondageRemoval(interaction.guildId, interaction.user, mitteneduser, "mittens").then( async (res) => { await interaction.editReply(getTextGeneric("unbind_accept", datatogeneric)); await interaction.followUp(getText(data)); - deleteMitten(mitteneduser.id); + deleteMitten(interaction.guildId, mitteneduser.id); }, async (rej) => { await interaction.editReply(getTextGeneric("unbind_decline", datatogeneric)); diff --git a/commands/untoy.js b/commands/untoy.js index e2b69aa3..9b8e8e3f 100644 --- a/commands/untoy.js +++ b/commands/untoy.js @@ -9,6 +9,7 @@ const { getHeavy } = require("../functions/getters/heavy/getHeavy"); const { getHeavyBound } = require("../functions/getters/heavy/getHeavyBound"); const { getSpecificToy } = require("../functions/getters/toy/getSpecificToy"); const { removeToy } = require("../functions/setters/toy/removeToy"); +const { getOption } = require("../functions/getters/config/getOption"); module.exports = { @@ -25,7 +26,7 @@ module.exports = { try { const focusedValue = interaction.options.getFocused(); let chosenuserid = interaction.options.get("user")?.value ?? interaction.user.id; // Note we can only retrieve the user ID here! - let autocompletes = getToys(chosenuserid).map((t) => { return { name: getBaseToy(t.type).toyname, value: t.type }}) + let autocompletes = getToys(interaction.guildId, chosenuserid).map((t) => { return { name: getBaseToy(t.type).toyname, value: t.type }}) console.log(autocompletes) let matches = didYouMean(focusedValue, autocompletes, { matchPath: ['name'], @@ -52,8 +53,8 @@ module.exports = { let toyuser = interaction.options.getUser("user") ?? interaction.user; let toyintensity = interaction.options.getNumber("intensity") ?? 5; let toytype = interaction.options.getString("type"); - if ((toytype == undefined) && (getToys(toyuser.id)) && (getToys(toyuser.id).length > 0)) { - toytype = getToys(toyuser.id)[0]?.type + if ((toytype == undefined) && (getToys(interaction.guildId, toyuser.id)) && (getToys(interaction.guildId, toyuser.id).length > 0)) { + toytype = getToys(interaction.guildId, toyuser.id)[0]?.type } if (toytype == undefined) { interaction.reply({ content: `${toyuser} is not wearing any toys!`, flags: MessageFlags.Ephemeral }) @@ -61,12 +62,12 @@ module.exports = { } let toybase = getBaseToy(toytype); // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(toyuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, toyuser.id)?.mainconsent) { await handleConsent(interaction, toyuser.id); return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } @@ -74,9 +75,10 @@ module.exports = { let data = { textarray: "texts_untoy", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: toyuser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type c2: getBaseToy(toytype)?.toyname, // the chosen vibe type c3: toyintensity, }, @@ -91,13 +93,13 @@ module.exports = { return; }*/ - if (!getHeavyBound(interaction.user.id, toyuser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, toyuser.id)) { // We are in heavy bondage data.heavy = true; if (toyuser == interaction.user) { // ourselves data.self = true; - if (toybase.canUnequip({ userID: toyuser.id, keyholderID: interaction.user.id })) { + if (toybase.canUnequip({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id })) { // cannot equip data.access = true; data[toybase.category] = true; @@ -111,7 +113,7 @@ module.exports = { } else { // someone else data.other = true; - if (toybase.canUnequip({ userID: toyuser.id, keyholderID: interaction.user.id })) { + if (toybase.canUnequip({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id })) { // cannot equip data.access = true; data[toybase.category] = true; @@ -133,20 +135,20 @@ module.exports = { if (getSpecificToy(toyuser.id, toytype)) { // toy already on wearer data.toy = true; - if (toybase.blocker({ userID: toyuser.id })) { + if (toybase.blocker({ serverID: interaction.guildId, userID: toyuser.id })) { data.blocker = true; - if (toybase.canUnequip({ userID: toyuser.id, keyholderID: interaction.user.id })) { + if (toybase.canUnequip({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id })) { // can access the toy data.access = true; data[toybase.category] = true; - let fumble = toybase.fumble({ userID: toyuser.id, keyholderID: interaction.user.id }) + let fumble = toybase.fumble({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id }) if (fumble > 0) { // We fumbled the key data.fumble = true; - if (fumble > 1) { + if ((getOption(interaction.guildId, toyuser.id, "keyloss") == "enabled") && (fumble > 1)) { // We lost the key data.keyloss = true; - let discardresult = toybase.discard({ userID: toyuser.id, keyholderID: interaction.user.id }) + let discardresult = toybase.discard({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id }) if (discardresult) { data[discardresult] = true } interaction.reply(getText(data)) } @@ -159,7 +161,7 @@ module.exports = { else { // Successfully unlocked blocking device data.nofumble = true; - removeToy(toyuser.id, interaction.user.id, toytype) + removeToy(interaction.guildId, toyuser.id, interaction.user.id, toytype) interaction.reply(getText(data)) } } @@ -174,7 +176,7 @@ module.exports = { // Not wearing anything to block access data.noblocker = true; data[toybase.category] = true; - removeToy(toyuser.id, interaction.user.id, toytype) + removeToy(interaction.guildId, toyuser.id, interaction.user.id, toytype) interaction.reply(getText(data)) } } @@ -190,20 +192,20 @@ module.exports = { if (getSpecificToy(toyuser.id, toytype)) { // toy already on wearer data.toy = true; - if (toybase.blocker({ userID: toyuser.id })) { + if (toybase.blocker({ serverID: interaction.guildId, userID: toyuser.id })) { data.blocker = true; - if (toybase.canUnequip({ userID: toyuser.id, keyholderID: interaction.user.id })) { + if (toybase.canUnequip({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id })) { // can access the toy data.access = true; data[toybase.category] = true; - let fumble = toybase.fumble({ userID: toyuser.id, keyholderID: interaction.user.id }) + let fumble = toybase.fumble({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id }) if (fumble > 0) { // We fumbled the key data.fumble = true; - if (fumble > 1) { + if ((getOption(interaction.guildId, toyuser.id, "keyloss") == "enabled") && (fumble > 1)) { // We lost the key data.keyloss = true; - let discardresult = toybase.discard({ userID: toyuser.id, keyholderID: interaction.user.id }) + let discardresult = toybase.discard({ serverID: interaction.guildId, userID: toyuser.id, keyholderID: interaction.user.id }) if (discardresult) { data[discardresult] = true } interaction.reply(getText(data)) } @@ -216,7 +218,7 @@ module.exports = { else { // Successfully unlocked blocking device data.nofumble = true; - removeToy(toyuser.id, interaction.user.id, toytype) + removeToy(interaction.guildId, toyuser.id, interaction.user.id, toytype) interaction.reply(getText(data)) } } @@ -231,7 +233,7 @@ module.exports = { // Not wearing anything to block access data.noblocker = true; data[toybase.category] = true; - removeToy(toyuser.id, interaction.user.id, toytype) + removeToy(interaction.guildId, toyuser.id, interaction.user.id, toytype) interaction.reply(getText(data)) } } diff --git a/commands/unwear.js b/commands/unwear.js index 7b8baf8d..98e78a16 100644 --- a/commands/unwear.js +++ b/commands/unwear.js @@ -21,8 +21,8 @@ module.exports = { if (focusedValue == "") { try { // User hasn't entered anything, lets give them a suggested set of 10 - let itemsworn = getWearable(chosenuserid); - let itemslocked = getLockedWearable(chosenuserid); + let itemsworn = getWearable(interaction.guildId, chosenuserid); + let itemslocked = getLockedWearable(interaction.guildId, chosenuserid); // Remove anything we're already wearing from the list let sorted = process.autocompletes.wearables.filter((f) => itemsworn.includes(f.value)); @@ -34,8 +34,8 @@ module.exports = { } } else { try { - let itemsworn = getWearable(chosenuserid); - let itemslocked = getLockedWearable(chosenuserid); + let itemsworn = getWearable(interaction.guildId, chosenuserid); + let itemslocked = getLockedWearable(interaction.guildId, chosenuserid); // Remove anything we're already wearing from the list let sorted = process.autocompletes.wearables.filter((f) => itemsworn.includes(f.value)); @@ -52,21 +52,22 @@ module.exports = { let wearableuser = interaction.options.getUser("user") ? interaction.options.getUser("user") : interaction.user; let wearablechoice = interaction.options.getString("type"); // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(wearableuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, wearableuser.id)?.mainconsent) { await handleConsent(interaction, wearableuser.id); return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } let data = { textarray: "texts_unwear", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: wearableuser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type c2: getWearableName(wearableuser.id, wearablechoice), }, }; @@ -77,7 +78,7 @@ module.exports = { return; } - if (!getHeavyBound(interaction.user.id, wearableuser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, wearableuser.id)) { // target is in heavy bondage data.heavy = true; if (wearableuser.id == interaction.user.id) { @@ -86,7 +87,7 @@ module.exports = { if (wearablechoice) { // We're targetting a specific wearable piece. data.single = true; - if (getWearable(wearableuser.id).includes(wearablechoice)) { + if (getWearable(interaction.guildId, wearableuser.id).includes(wearablechoice)) { // Wearing the headgear already data.worn = true; interaction.reply(getText(data)); @@ -98,7 +99,7 @@ module.exports = { } else { // We're removing ALL wearable data.multiple = true; - if (getWearable(wearableuser.id).length > 0) { + if (getWearable(interaction.guildId, wearableuser.id).length > 0) { // Wearing something data.worn = true; interaction.reply(getText(data)); @@ -114,7 +115,7 @@ module.exports = { if (wearablechoice) { // We're targetting a specific wearable piece. data.single = true; - if (getWearable(wearableuser.id).includes(wearablechoice)) { + if (getWearable(interaction.guildId, wearableuser.id).includes(wearablechoice)) { // Wearing the headgear already data.worn = true; interaction.reply(getText(data)); @@ -126,7 +127,7 @@ module.exports = { } else { // We're removing ALL wearable data.multiple = true; - if (getWearable(wearableuser.id).length > 0) { + if (getWearable(interaction.guildId, wearableuser.id).length > 0) { // Wearing something data.worn = true; interaction.reply(getText(data)); @@ -146,11 +147,11 @@ module.exports = { if (wearablechoice) { // Targetting one specific headgear data.single = true; - if (getWearable(wearableuser.id).includes(wearablechoice)) { + if (getWearable(interaction.guildId, wearableuser.id).includes(wearablechoice)) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply(getText(data)); - deleteWearable(wearableuser.id, wearablechoice); + deleteWearable(interaction.guildId, wearableuser.id, wearablechoice); } else { // Not wearing it! data.noworn = true; @@ -159,11 +160,11 @@ module.exports = { } else { // Targetting all headgear data.multiple = true; - if (getWearable(wearableuser.id).length > 0) { + if (getWearable(interaction.guildId, wearableuser.id).length > 0) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply(getText(data)); - deleteWearable(wearableuser.id, wearablechoice); + deleteWearable(interaction.guildId, wearableuser.id, wearablechoice); } else { // Not wearing it! data.noworn = true; @@ -176,11 +177,11 @@ module.exports = { if (wearablechoice) { // Targetting one specific headgear data.single = true; - if (getWearable(wearableuser.id).includes(wearablechoice)) { + if (getWearable(interaction.guildId, wearableuser.id).includes(wearablechoice)) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply(getText(data)); - deleteWearable(wearableuser.id, wearablechoice); + deleteWearable(interaction.guildId, wearableuser.id, wearablechoice); } else { // Not wearing it! data.noworn = true; @@ -189,11 +190,11 @@ module.exports = { } else { // Targetting all headgear data.multiple = true; - if (getWearable(wearableuser.id).length > 0) { + if (getWearable(interaction.guildId, wearableuser.id).length > 0) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply(getText(data)); - deleteWearable(wearableuser.id, wearablechoice); + deleteWearable(interaction.guildId, wearableuser.id, wearablechoice); } else { // Not wearing it! data.noworn = true; diff --git a/commands/wear.js b/commands/wear.js index d16f49cf..e0a984c8 100644 --- a/commands/wear.js +++ b/commands/wear.js @@ -20,7 +20,7 @@ module.exports = { async autoComplete(interaction) { try { let chosenuserid = interaction.options.get("user")?.value ?? interaction.user.id; // Note we can only retrieve the user ID here! - let itemsworn = getWearable(chosenuserid); + let itemsworn = getWearable(interaction.guildId, chosenuserid); // Remove anything we're already wearing from the list const focusedValue = interaction.options.getFocused(); @@ -33,7 +33,7 @@ module.exports = { if (matches.length == 0) { matches = autocompletes.slice(0,25); } - let tags = getUserTags(chosenuserid); + let tags = getUserTags(interaction.guildId, chosenuserid); let newsorted = []; matches.forEach((f) => { let tagged = false; @@ -60,21 +60,22 @@ module.exports = { let wearableuser = interaction.options.getUser("user") ? interaction.options.getUser("user") : interaction.user; let wearablechoice = interaction.options.getString("type") ? interaction.options.getString("type") : "catsuit_latex"; // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(wearableuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, wearableuser.id)?.mainconsent) { await handleConsent(interaction, wearableuser.id); return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } let data = { + serverID: interaction.guildId, textarray: "texts_wear", textdata: { interactionuser: interaction.user, targetuser: wearableuser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type c2: getWearableName(wearableuser.id, wearablechoice), }, }; @@ -87,7 +88,7 @@ module.exports = { let blocked = false; if (wearablechoice) { - let tags = getUserTags(wearableuser.id); + let tags = getUserTags(interaction.guildId, wearableuser.id); let i = getBaseWearable(wearablechoice) tags.forEach((t) => { if (i && i.tags && i.tags[t] && (wearableuser != interaction.user)) { @@ -101,13 +102,13 @@ module.exports = { return; } - if (!getHeavyBound(interaction.user.id, wearableuser.id)) { + if (!getHeavyBound(interaction.guildId, interaction.user.id, wearableuser.id)) { // target is in heavy bondage data.heavy = true; if (wearableuser.id == interaction.user.id) { // ourselves data.self = true; - if (getWearable(wearableuser.id).includes(wearablechoice)) { + if (getWearable(interaction.guildId, wearableuser.id).includes(wearablechoice)) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); @@ -119,7 +120,7 @@ module.exports = { } else { // Them data.other = true; - if (getWearable(wearableuser.id).includes(wearablechoice)) { + if (getWearable(interaction.guildId, wearableuser.id).includes(wearablechoice)) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); @@ -135,27 +136,27 @@ module.exports = { if (wearableuser.id == interaction.user.id) { // ourselves data.self = true; - if (getWearable(wearableuser.id).includes(wearablechoice)) { + if (getWearable(interaction.guildId, wearableuser.id).includes(wearablechoice)) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); } else { // Not wearing it! data.noworn = true; - assignWearable(wearableuser.id, wearablechoice); + assignWearable(interaction.guildId, wearableuser.id, wearablechoice); interaction.reply(getText(data)); } } else { // Them data.other = true; - if (getWearable(wearableuser.id).includes(wearablechoice)) { + if (getWearable(interaction.guildId, wearableuser.id).includes(wearablechoice)) { // Wearing the headgear already, Ephemeral data.worn = true; interaction.reply({ content: getText(data), flags: MessageFlags.Ephemeral }); } else { // Not wearing it! data.noworn = true; - assignWearable(wearableuser.id, wearablechoice); + assignWearable(interaction.guildId, wearableuser.id, wearablechoice); interaction.reply(getText(data)); } } diff --git a/gags/politeSub.js b/gags/politeSub.js index 61b2e951..c465d670 100644 --- a/gags/politeSub.js +++ b/gags/politeSub.js @@ -15,6 +15,8 @@ const honorifictitles = [ "maam", "madame", "madam", + "milady", + "milord", "lady", "ladies", "lord", From 24fccd2b89062a9c7b8a6d4e8363ec245bbb3424 Mon Sep 17 00:00:00 2001 From: Enraa Date: Mon, 22 Jun 2026 19:12:38 -0700 Subject: [PATCH 37/44] context commands --- contextcommands/message/Button Board.js | 9 ++++--- contextcommands/message/Edit Message.js | 6 ++--- contextcommands/message/Give Keys.js | 14 +++++----- contextcommands/message/Headpat.js | 17 ++++++------ contextcommands/message/Inspect User.js | 14 +++++----- contextcommands/user/Give Keys.js | 2 +- contextcommands/user/Headpat.js | 11 ++++---- contextcommands/user/Inspect User.js | 2 +- contextcommands/user/Shock.js | 35 +++++++++++++------------ 9 files changed, 57 insertions(+), 53 deletions(-) diff --git a/contextcommands/message/Button Board.js b/contextcommands/message/Button Board.js index 1034c568..324e372f 100644 --- a/contextcommands/message/Button Board.js +++ b/contextcommands/message/Button Board.js @@ -23,7 +23,7 @@ module.exports = { [ `BOT|${process.emojis.armbinder}`, `BOT|${process.emojis.collar}`, `BOT|${process.emojis.chastity}`, `BOT|${process.emojis.gag}`, `BOT|${process.emojis.wand}` ], [ `BOT|${process.emojis.happymaid}`, `BOT|${process.emojis.yesh}`, `BOT|${process.emojis.tetowoah}`, `BOT|${process.emojis.miku}`, `BOT|${process.emojis.shyumm}` ], ] - if (!getHeadwearRestrictions(interaction.user.id).canInspect) { + if (!getHeadwearRestrictions(interaction.guildId, interaction.user.id).canInspect) { buttons = buttons.map((ba) => { console.log(ba); return arrayShuffle(ba) @@ -36,11 +36,11 @@ module.exports = { let b = new ButtonBuilder() .setCustomId(`buttonboard_${bb}`) .setStyle(ButtonStyle.Secondary) - if (getHeadwearRestrictions(interaction.user.id).canInspect && bb.startsWith('BOT|')) { + if (getHeadwearRestrictions(interaction.guildId, interaction.user.id).canInspect && bb.startsWith('BOT|')) { b.setEmoji(bb.split("|")[1]) } else { - b.setLabel(!getHeadwearRestrictions(interaction.user.id).canInspect ? "ā“" : bb) + b.setLabel(!getHeadwearRestrictions(interaction.guildId, interaction.user.id).canInspect ? "ā“" : bb) } return b; }) @@ -60,10 +60,11 @@ module.exports = { let buttonemoji = interaction.customId.split("_")[1] buttonemoji = buttonemoji.replace("BOT|", "") let data_in = { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: interaction.user, c1: buttonemoji, - c2: getHeadwearRestrictions(interaction.user.id).canInspect ? "cansee" : "blind" + c2: getHeadwearRestrictions(interaction.guildId, interaction.user.id).canInspect ? "cansee" : "blind" } let channelwithmessage = interaction.client.channels.cache.get(interaction.channelId); diff --git a/contextcommands/message/Edit Message.js b/contextcommands/message/Edit Message.js index d156ccb8..bd4d9e08 100644 --- a/contextcommands/message/Edit Message.js +++ b/contextcommands/message/Edit Message.js @@ -32,7 +32,7 @@ module.exports = { let founduserid; // Check for engraved pet tag - let engravedpettags = getAllSelectedOption("engravedcollarname") + let engravedpettags = getAllSelectedOption(interaction.guildId, "engravedcollarname") Object.keys(engravedpettags).forEach((k) => { // If the visor matches, then we found our pet! if (message.author.username.startsWith(engravedpettags[k]) && (engravedpettags[k].length > 0)) { @@ -41,7 +41,7 @@ module.exports = { } }) // Doll Visors - let dollvisorids = getAllSelectedOption("dollvisorname") + let dollvisorids = getAllSelectedOption(interaction.guildId, "dollvisorname") Object.keys(dollvisorids).forEach((k) => { // If the visor matches, then we found our doll! if (message.author.username.startsWith(dollvisorids[k])) { @@ -49,7 +49,7 @@ module.exports = { } }) // Drone Visors - let dronevisorids = getAllSelectedOption("dronevisorname") + let dronevisorids = getAllSelectedOption(interaction.guildId, "dronevisorname") Object.keys(dronevisorids).forEach((k) => { // If the visor matches, then we found our drone! if (message.author.username.startsWith(`⬔-Drone ${dronevisorids[k]}`)) { diff --git a/contextcommands/message/Give Keys.js b/contextcommands/message/Give Keys.js index d1b558e4..228e0c52 100644 --- a/contextcommands/message/Give Keys.js +++ b/contextcommands/message/Give Keys.js @@ -13,12 +13,12 @@ module.exports = { let message = await channel.messages.fetch(interaction.targetId) if (message) { if (message.webhookId == null) { - interaction.reply(await generateKeyGivingModal(interaction.user.id, message.author.id ?? interaction.user.id, message.author.id ?? interaction.user.id, "0000")) + interaction.reply(await generateKeyGivingModal(interaction.guildId, interaction.user.id, message.author.id ?? interaction.user.id, message.author.id ?? interaction.user.id, "0000")) } else { let founduserid; // Check for engraved pet tag - let engravedpettags = getAllSelectedOption("engravedcollarname") + let engravedpettags = getAllSelectedOption(interaction.guildId, "engravedcollarname") Object.keys(engravedpettags).forEach((k) => { // If the visor matches, then we found our pet! if (message.author.username.startsWith(engravedpettags[k]) && (engravedpettags[k].length > 0)) { @@ -27,7 +27,7 @@ module.exports = { } }) // Doll Visors - let dollvisorids = getAllSelectedOption("dollvisorname") + let dollvisorids = getAllSelectedOption(interaction.guildId, "dollvisorname") Object.keys(dollvisorids).forEach((k) => { // If the visor matches, then we found our doll! if (message.author.username.startsWith(dollvisorids[k])) { @@ -35,7 +35,7 @@ module.exports = { } }) // Drone Visors - let dronevisorids = getAllSelectedOption("dronevisorname") + let dronevisorids = getAllSelectedOption(interaction.guildId, "dronevisorname") Object.keys(dronevisorids).forEach((k) => { // If the visor matches, then we found our drone! if (message.author.username.startsWith(`⬔-Drone ${dronevisorids[k]}`)) { @@ -69,15 +69,15 @@ module.exports = { } } } - interaction.reply(await generateKeyGivingModal(interaction.user.id, founduserid ?? interaction.user.id, founduserid ?? interaction.user.id, "0000")) + interaction.reply(await generateKeyGivingModal(interaction.guildId, interaction.user.id, founduserid ?? interaction.user.id, founduserid ?? interaction.user.id, "0000")) } } else { - interaction.reply(await generateKeyGivingModal(interaction.user.id, undefined, undefined, "0000")) + interaction.reply(await generateKeyGivingModal(interaction.guildId, interaction.user.id, undefined, undefined, "0000")) } } else { - interaction.reply(await generateKeyGivingModal(interaction.user.id, undefined, undefined, "0000")) + interaction.reply(await generateKeyGivingModal(interaction.guildId, interaction.user.id, undefined, undefined, "0000")) } } catch (err) { console.log(err); diff --git a/contextcommands/message/Headpat.js b/contextcommands/message/Headpat.js index 4cdc3f3a..96edb186 100644 --- a/contextcommands/message/Headpat.js +++ b/contextcommands/message/Headpat.js @@ -23,7 +23,7 @@ module.exports = { else { let founduserid; // Check for engraved pet tag - let engravedpettags = getAllSelectedOption("engravedcollarname") + let engravedpettags = getAllSelectedOption(interaction.guildId, "engravedcollarname") Object.keys(engravedpettags).forEach((k) => { // If the visor matches, then we found our pet! if (message.author.username.startsWith(engravedpettags[k]) && (engravedpettags[k].length > 0)) { @@ -32,7 +32,7 @@ module.exports = { } }) // Doll Visors - let dollvisorids = getAllSelectedOption("dollvisorname") + let dollvisorids = getAllSelectedOption(interaction.guildId, "dollvisorname") Object.keys(dollvisorids).forEach((k) => { // If the visor matches, then we found our doll! if (message.author.username.startsWith(dollvisorids[k])) { @@ -40,7 +40,7 @@ module.exports = { } }) // Drone Visors - let dronevisorids = getAllSelectedOption("dronevisorname") + let dronevisorids = getAllSelectedOption(interaction.guildId, "dronevisorname") Object.keys(dronevisorids).forEach((k) => { // If the visor matches, then we found our drone! if (message.author.username.startsWith(`⬔-Drone ${dronevisorids[k]}`)) { @@ -80,12 +80,12 @@ module.exports = { } if (targetuser) { // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(targetuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, targetuser.id)?.mainconsent) { await handleConsent(interaction, targetuser.id); return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } @@ -93,6 +93,7 @@ module.exports = { let data = { textarray: "texts_touch", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: targetuser, //c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type @@ -100,10 +101,10 @@ module.exports = { }, }; await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleTouchEvent(interaction.user, targetuser, "headpat").then( + await handleTouchEvent(interaction.guildId, interaction.user, targetuser, "headpat").then( async (success) => { await interaction.followUp({ content: `Headpatting ${targetuser}`, flags: MessageFlags.Ephemeral }) - let headpatattempt = rollPatChance(interaction.user.id, targetuser.id, interaction.guildId) + let headpatattempt = rollPatChance(interaction.guildId, interaction.user.id, targetuser.id, interaction.guildId) data.headpat = true; if (interaction.user.id == targetuser.id) { @@ -152,7 +153,7 @@ module.exports = { nomessage = `Something went wrong - Submit a bug report!`; } if (reject == "NoDM") { - nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(chastityuser.id, "subject")} ${getPronouns(chastityuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent to touch.`; + nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(interaction.guildId, targetuser.id, "subject")} ${getPronouns(interaction.guildId, targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent to touch.`; } await interaction.followUp({ content: nomessage }); }, diff --git a/contextcommands/message/Inspect User.js b/contextcommands/message/Inspect User.js index 5de4cf45..cfe085e1 100644 --- a/contextcommands/message/Inspect User.js +++ b/contextcommands/message/Inspect User.js @@ -13,12 +13,12 @@ module.exports = { let message = await channel.messages.fetch(interaction.targetId) if (message) { if (message.webhookId == null) { - interaction.reply(await inspectModal(interaction.user.id, message.author.id ?? interaction.user.id, "overview", 1)) + interaction.reply(await inspectModal(interaction.guildId, interaction.user.id, message.author.id ?? interaction.user.id, "overview", 1)) } else { let founduserid; // Check for engraved pet tag - let engravedpettags = getAllSelectedOption("engravedcollarname") + let engravedpettags = getAllSelectedOption(interaction.guildId, "engravedcollarname") Object.keys(engravedpettags).forEach((k) => { // If the visor matches, then we found our pet! if (message.author.username.startsWith(engravedpettags[k]) && (engravedpettags[k].length > 0)) { @@ -27,7 +27,7 @@ module.exports = { } }) // Doll Visors - let dollvisorids = getAllSelectedOption("dollvisorname") + let dollvisorids = getAllSelectedOption(interaction.guildId, "dollvisorname") Object.keys(dollvisorids).forEach((k) => { // If the visor matches, then we found our doll! if (message.author.username.startsWith(dollvisorids[k])) { @@ -35,7 +35,7 @@ module.exports = { } }) // Drone Visors - let dronevisorids = getAllSelectedOption("dronevisorname") + let dronevisorids = getAllSelectedOption(interaction.guildId, "dronevisorname") Object.keys(dronevisorids).forEach((k) => { // If the visor matches, then we found our drone! if (message.author.username.startsWith(`⬔-Drone ${dronevisorids[k]}`)) { @@ -69,15 +69,15 @@ module.exports = { } } } - interaction.reply(await inspectModal(interaction.user.id, founduserid ?? interaction.user.id, "overview", 1)) + interaction.reply(await inspectModal(interaction.guildId, interaction.user.id, founduserid ?? interaction.user.id, "overview", 1)) } } else { - interaction.reply(await inspectModal(interaction.user.id, interaction.user.id, "overview", 1)) + interaction.reply(await inspectModal(interaction.guildId, interaction.user.id, interaction.user.id, "overview", 1)) } } else { - interaction.reply(await inspectModal(interaction.user.id, interaction.user.id, "overview", 1)) + interaction.reply(await inspectModal(interaction.guildId, interaction.user.id, interaction.user.id, "overview", 1)) } } catch (err) { console.log(err); diff --git a/contextcommands/user/Give Keys.js b/contextcommands/user/Give Keys.js index 9b0c99d3..6003561d 100644 --- a/contextcommands/user/Give Keys.js +++ b/contextcommands/user/Give Keys.js @@ -7,7 +7,7 @@ module.exports = { .setType(ApplicationCommandType.User), // This command will appear when right-clicking a user async execute(interaction) { try { - interaction.reply(await generateKeyGivingModal(interaction.user.id, interaction.targetId ?? interaction.user.id, interaction.targetId ?? interaction.user.id, "0000")) + interaction.reply(await generateKeyGivingModal(interaction.guildId, interaction.user.id, interaction.targetId ?? interaction.user.id, interaction.targetId ?? interaction.user.id, "0000")) } catch (err) { console.log(err); } diff --git a/contextcommands/user/Headpat.js b/contextcommands/user/Headpat.js index 6708611e..685f0e4d 100644 --- a/contextcommands/user/Headpat.js +++ b/contextcommands/user/Headpat.js @@ -14,12 +14,12 @@ module.exports = { console.log(interaction); let targetuser = await interaction.guild.members.fetch(interaction.targetId) // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(targetuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, targetuser.id)?.mainconsent) { await handleConsent(interaction, targetuser.id); return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } @@ -27,6 +27,7 @@ module.exports = { let data = { textarray: "texts_touch", textdata: { + serverID: interaction.guildId, interactionuser: interaction.user, targetuser: targetuser, //c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type @@ -34,10 +35,10 @@ module.exports = { }, }; await interaction.deferReply({ flags: MessageFlags.Ephemeral }); - await handleTouchEvent(interaction.user, targetuser, "headpat").then( + await handleTouchEvent(interaction.guildId, interaction.user, targetuser, "headpat").then( async (success) => { await interaction.followUp({ content: `Headpatting ${targetuser}`, flags: MessageFlags.Ephemeral }) - let headpatattempt = rollPatChance(interaction.user.id, targetuser.id, interaction.guildId) + let headpatattempt = rollPatChance(interaction.guildId, interaction.user.id, targetuser.id, interaction.guildId) data.headpat = true; if (interaction.user.id == targetuser.id) { @@ -86,7 +87,7 @@ module.exports = { nomessage = `Something went wrong - Submit a bug report!`; } if (reject == "NoDM") { - nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(chastityuser.id, "subject")} ${getPronouns(chastityuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent to touch.`; + nomessage = `Something went wrong sending a DM to ${targetuser}, or ${getPronouns(interaction.guildId, targetuser.id, "subject")} ${getPronouns(interaction.guildId, targetuser.id, "subject") == "they" ? `have` : "has"} DMs from this server disabled. Cannot obtain consent to touch.`; } await interaction.followUp({ content: nomessage }); }, diff --git a/contextcommands/user/Inspect User.js b/contextcommands/user/Inspect User.js index 212f6405..bd89fef0 100644 --- a/contextcommands/user/Inspect User.js +++ b/contextcommands/user/Inspect User.js @@ -7,7 +7,7 @@ module.exports = { .setType(ApplicationCommandType.User), // This command will appear when right-clicking a user async execute(interaction) { try { - interaction.reply(await inspectModal(interaction.user.id, interaction.targetId ?? interaction.user.id, "overview", 1)) + interaction.reply(await inspectModal(interaction.guildId, interaction.user.id, interaction.targetId ?? interaction.user.id, "overview", 1)) } catch (err) { console.log(err); } diff --git a/contextcommands/user/Shock.js b/contextcommands/user/Shock.js index d25a623f..9d14d16f 100644 --- a/contextcommands/user/Shock.js +++ b/contextcommands/user/Shock.js @@ -18,22 +18,23 @@ module.exports = { try { let targetuser = await interaction.guild.members.fetch(interaction.targetId) // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(targetuser.id)?.mainconsent) { + if (!getConsent(interaction.guildId, targetuser.id)?.mainconsent) { await handleConsent(interaction, targetuser.id); return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } let data = { + serverID: interaction.guildId, interactionuser: { id: interaction.user.id }, targetuser: { id: interaction.targetId }, - c1: getCollarName(interaction.targetId, getCollar(interaction.targetId)?.collartype) ?? "collar" + c1: getCollarName(interaction.guildId, interaction.targetId, getCollar(interaction.guildId, interaction.targetId)?.collartype) ?? "collar" } // Figure out the tone to shock the user with - let tone = getOption(targetuser.id, "shocktone") ?? "playful"; + let tone = getOption(interaction.guildId, targetuser.id, "shocktone") ?? "playful"; if (tone == "both") { if (Math.random() > 0.5) { tone = "playful" @@ -43,20 +44,20 @@ module.exports = { }; } if (interaction.targetId != interaction.user.id) { - if (!getCollar(interaction.targetId)) { + if (!getCollar(interaction.guildId, interaction.targetId)) { await interaction.reply({ content: `<@${interaction.targetId}> isn't wearing a collar.`, flags: MessageFlags.Ephemeral }) return; } - if ((getCollar(interaction.targetId)?.collartype != "remoteshockcollar") && !(getCollar(interaction.targetId)?.additionalcollars?.includes("remoteshockcollar"))) { + if ((getCollar(interaction.guildId, interaction.targetId)?.collartype != "remoteshockcollar") && !(getCollar(interaction.guildId, interaction.targetId)?.additionalcollars?.includes("remoteshockcollar"))) { await interaction.reply({ content: `<@${interaction.targetId}> isn't wearing a remote controlled shock collar.`, flags: MessageFlags.Ephemeral }) return; } - await handleTouchEvent({ id: interaction.user.id }, { id: interaction.targetId }, "shock", true).then( + await handleTouchEvent(interaction.guildId, { id: interaction.user.id }, { id: interaction.targetId }, "shock", true).then( async (success) => { - addArousal(interaction.targetId, (2.0 + Math.random() * 6.0)); // Add 2-8 arousal. + addArousal(interaction.guildId, interaction.targetId, (2.0 + Math.random() * 6.0)); // Add 2-8 arousal. await interaction.reply({ content: getTextGeneric(`remotecontrolshock_other_${tone}`, data) }) - statsAddCounter(interaction.targetId, "timesshocked"); - shockUser(interaction.targetId); + statsAddCounter(interaction.guildId, interaction.targetId, "timesshocked"); + shockUser(interaction.guildId, interaction.targetId); }, async (failure) => { await interaction.reply({ content: `You don't have access to <@${interaction.targetId}>'s collar remote control!`, flags: MessageFlags.Ephemeral }) @@ -64,23 +65,23 @@ module.exports = { ) } else { - if (!getCollar(interaction.targetId)) { + if (!getCollar(interaction.guildId, interaction.targetId)) { await interaction.reply({ content: `You aren't wearing a collar.`, flags: MessageFlags.Ephemeral }) return; } - if ((getCollar(interaction.targetId)?.collartype != "remoteshockcollar") && !(getCollar(interaction.targetId)?.additionalcollars?.includes("remoteshockcollar"))) { + if ((getCollar(interaction.guildId, interaction.targetId)?.collartype != "remoteshockcollar") && !(getCollar(interaction.guildId, interaction.targetId)?.additionalcollars?.includes("remoteshockcollar"))) { await interaction.reply({ content: `You aren't wearing a remote controlled shock collar.`, flags: MessageFlags.Ephemeral }) return; } - if (!canAccessCollar(interaction.targetId, interaction.user.id).access) { + if (!canAccessCollar(interaction.guildId, interaction.targetId, interaction.user.id).access) { await interaction.reply({ content: `You don't have access to your collar's remote control!`, flags: MessageFlags.Ephemeral }) return; } - addArousal(interaction.targetId, (2.0 + Math.random() * 6.0)); // Add 2-8 arousal. + addArousal(interaction.guildId, interaction.targetId, (2.0 + Math.random() * 6.0)); // Add 2-8 arousal. await interaction.reply({ content: getTextGeneric(`remotecontrolshock_self_${tone}`, data) }) - statsAddCounter(interaction.targetId, "timesshocked"); - statsAddCounter(interaction.targetId, "timesshockedself"); - shockUser(interaction.targetId); + statsAddCounter(interaction.guildId, interaction.targetId, "timesshocked"); + statsAddCounter(interaction.guildId, interaction.targetId, "timesshockedself"); + shockUser(interaction.guildId, interaction.targetId); } } catch (err) { console.log(err); From 68f1c4d701dd6318c6e1d36318e243bb3ad77990 Mon Sep 17 00:00:00 2001 From: Enraa Date: Mon, 22 Jun 2026 22:09:39 -0700 Subject: [PATCH 38/44] arrow functions cause crashes --- commands/pronouns.js | 1 - functions/collarfunctions.js | 1 - functions/dollfunctions.js | 7 +- functions/gagfunctions.js | 2 +- functions/getters/config/getPronouns.js | 2 +- functions/getters/config/getPronounsSet.js | 2 +- functions/getters/heavy/getBaseHeavy.js | 2 +- functions/getters/wearable/getWearable.js | 1 + functions/headwearfunctions.js | 6 +- functions/other/TESTS/traceFirstParam.js | 3 +- functions/other/convertPronounsText.js | 2 +- functions/pronounfunctions.js | 2 +- functions/textfunctions.js | 4 +- functions/timefunctions.js | 172 ++++++++++++--------- index.js | 138 ++++++++++------- 15 files changed, 194 insertions(+), 151 deletions(-) diff --git a/commands/pronouns.js b/commands/pronouns.js index 082992b6..b17b8c2c 100644 --- a/commands/pronouns.js +++ b/commands/pronouns.js @@ -1,5 +1,4 @@ const { SlashCommandBuilder, MessageFlags } = require("discord.js"); -const { pronounsMap } = require("../lists/pronounsMap.js"); const { setPronouns } = require("../functions/setters/config/setPronouns.js"); const { pronounsMap } = require("../lists/pronounsMap.js") diff --git a/functions/collarfunctions.js b/functions/collarfunctions.js index ca5bcc88..6ed0d791 100644 --- a/functions/collarfunctions.js +++ b/functions/collarfunctions.js @@ -1,4 +1,3 @@ -import { Poll } from 'discord.js'; const fs = require("fs"); const path = require("path"); const https = require("https"); diff --git a/functions/dollfunctions.js b/functions/dollfunctions.js index e2c6308a..b77727eb 100644 --- a/functions/dollfunctions.js +++ b/functions/dollfunctions.js @@ -5,6 +5,7 @@ const { getHeadwear } = require("./getters/headwear/getHeadwear.js"); const { getOption } = require("./getters/config/getOption.js"); const { markForSave } = require("./other/markForSave.js"); const { traceFirstParam } = require("./other/TESTS/traceFirstParam.js"); +const { getGags } = require("./getters/gag/getGags.js"); // Regex to capture the user's intended text segments post-corset and post-vibrator. // NOTE: Code uses invisible EOT control characters to encapsulate additions from corset/vibrator. @@ -192,7 +193,7 @@ function checkDollification(serverID, userID) { if (isValidDoll(serverID, userID)) { // If user is NOT a doll, make them a doll. if (process.dolls[serverID] == undefined) { process.dolls[serverID] = {} } - if (!process.dolls[serverID][userID]) { + if (process.dolls[serverID] && !process.dolls[serverID][userID]) { process.dolls[serverID][userID] = { violations: 0, punishmentLevel: 0, goodDollStreak: 0 }; // Save the doll to the database. markForSave("dolls"); @@ -200,9 +201,9 @@ function checkDollification(serverID, userID) { isDoll = true; // Undollify if needed } else { - if (process.dolls[serverID][userID]) { + if (process.dolls[serverID] && process.dolls[serverID][userID]) { delete process.dolls[serverID][userID]; - // Save the doll to the database. + // Remove the doll from the database. markForSave("dolls"); } } diff --git a/functions/gagfunctions.js b/functions/gagfunctions.js index c74bdca2..dc2ce3ff 100644 --- a/functions/gagfunctions.js +++ b/functions/gagfunctions.js @@ -207,7 +207,7 @@ const modifymessage = async (msg, threadId, messageonly) => { let msgTree = new MessageAST(msg.content); // Build AST from message let msgTreeMods = {"modified":false, "emojiModified":false, "corseted":false} // Store a boolean in an object to allow pass by reference. - processHeadwearEmoji(msg.guild.id, msg.author.id, msgTree, msgTreeMods, getOption(msg.guild.id, msg.author.id, "dollvisorname")) + processHeadwearEmoji(msg.guildId, msg.author.id, msgTree, msgTreeMods, getOption(msg.guild.id, msg.author.id, "dollvisorname")) processHeadwearTruthgas(msg.guild.id, msg.author.id, msgTree, msgTreeMods) await processPregarbleGags(msg, msgTree, msgTreeMods) // Perform early garbles before arousal and corset effects. diff --git a/functions/getters/config/getPronouns.js b/functions/getters/config/getPronouns.js index f5937376..5467b607 100644 --- a/functions/getters/config/getPronouns.js +++ b/functions/getters/config/getPronouns.js @@ -20,7 +20,7 @@ const { getProcessVariable } = require("./getProcessVariable"); * --- * ##### Returns a string with the user's pronoun in the appropriate tense *******************************************/ -const getPronouns = (serverID, user, form, capitalize = false) => { +function getPronouns(serverID, user, form, capitalize = false) { traceFirstParam(arguments[0]); let output = ""; if (getProcessVariable(serverID, user, "pronouns")) { diff --git a/functions/getters/config/getPronounsSet.js b/functions/getters/config/getPronounsSet.js index 59aa6924..f0eee6fc 100644 --- a/functions/getters/config/getPronounsSet.js +++ b/functions/getters/config/getPronounsSet.js @@ -10,7 +10,7 @@ const { getProcessVariable } = require("./getProcessVariable"); * --- * ##### Returns a string with the user's standard pronoun representation *******************************************/ -const getPronounsSet = (serverID, user) => { +function getPronounsSet(serverID, user) { traceFirstParam(arguments[0]); if (getProcessVariable(serverID, user, "pronouns")) { return `${getProcessVariable(serverID, user, "pronouns")["subject"]}/${getProcessVariable(serverID, user, "pronouns")["subject"] != "it" ? getProcessVariable(serverID, user, "pronouns")["object"] : getProcessVariable(serverID, user, "pronouns")["possessive"]}`; diff --git a/functions/getters/heavy/getBaseHeavy.js b/functions/getters/heavy/getBaseHeavy.js index e5c0bead..5fd95f38 100644 --- a/functions/getters/heavy/getBaseHeavy.js +++ b/functions/getters/heavy/getBaseHeavy.js @@ -16,7 +16,7 @@ const { heavytypes } = require("../../heavyfunctions"); * - noother?: If true, prevents putting on others * - namefunction?: async (interaction, data) => Sets custom name on heavy object **************/ -const getBaseHeavy = (type) => { +function getBaseHeavy(type) { return heavytypes.find((h) => h.value === type); }; diff --git a/functions/getters/wearable/getWearable.js b/functions/getters/wearable/getWearable.js index f3841797..2b1bf04b 100644 --- a/functions/getters/wearable/getWearable.js +++ b/functions/getters/wearable/getWearable.js @@ -1,4 +1,5 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getProcessVariable } = require("../config/getProcessVariable"); /********** * Gets a list of clothing the user is currently wearing diff --git a/functions/headwearfunctions.js b/functions/headwearfunctions.js index 9baf18a0..755c9d24 100644 --- a/functions/headwearfunctions.js +++ b/functions/headwearfunctions.js @@ -103,7 +103,7 @@ const loadHeadwearTypes = () => { process.autocompletes.headtypes = headwearautocompletes; }; -const replaceEmoji = (text, parent, replaceEmoji, msgModified, matchFound) => { +function replaceEmoji(text, parent, replaceEmoji, msgModified, matchFound) { if(text !== replaceEmoji){ msgModified.modified = true; msgModified.emojiModified = true; @@ -113,7 +113,7 @@ const replaceEmoji = (text, parent, replaceEmoji, msgModified, matchFound) => { } } // Removes all emoji, optionally using an assigned emoji if they are wearing a mask with it! -const processHeadwearEmoji = (serverID, userID, msgTree, msgModified, dollvisoroverride) => { +function processHeadwearEmoji(serverID, userID, msgTree, msgModified, dollvisoroverride) { traceFirstParam(arguments[0]); // Do nothing if no headwear blocks. if (getHeadwearRestrictions(serverID, userID).canEmote) {return;} @@ -299,7 +299,7 @@ const truthgasopposites = (text, parent, msgModified) => { return outtext.slice(1) // Cut the leading space } // Changes words and negates them -const processHeadwearTruthgas = (serverID, userID, msgTree, msgModified) => { +function processHeadwearTruthgas(serverID, userID, msgTree, msgModified) { traceFirstParam(arguments[0]); // Do nothing if no headwear blocks. if (!getHeadwear(serverID, userID).includes("gasmask_truthgas")) { return } diff --git a/functions/other/TESTS/traceFirstParam.js b/functions/other/TESTS/traceFirstParam.js index d5c85da5..c2d4adb7 100644 --- a/functions/other/TESTS/traceFirstParam.js +++ b/functions/other/TESTS/traceFirstParam.js @@ -13,8 +13,9 @@ *******/ function traceFirstParam(serverID) { if (!process.client.guilds.cache.get(serverID)) { + console.log(serverID) console.error(`Invalid server ID ${serverID}!`) - throw new Error(err) + throw new Error() } } diff --git a/functions/other/convertPronounsText.js b/functions/other/convertPronounsText.js index e82dcd28..0aa705e6 100644 --- a/functions/other/convertPronounsText.js +++ b/functions/other/convertPronounsText.js @@ -28,7 +28,7 @@ const { DOLLVISORS } = require("../headwearfunctions"); * --- * ##### Returns a string with appropriate pronouns ***********/ -const convertPronounsText = (text, data) => { +function convertPronounsText(text, data) { let interactionuser = data.interactionuser; let targetuser = data.targetuser ?? data.interactionuser; // If we didnt supply a target, just use interaction user for both. diff --git a/functions/pronounfunctions.js b/functions/pronounfunctions.js index dbca45d1..246af552 100644 --- a/functions/pronounfunctions.js +++ b/functions/pronounfunctions.js @@ -3,7 +3,7 @@ const { ButtonStyle, ComponentType } = require("discord.js"); const { ActionRowBuilder } = require("@discordjs/builders"); const { setPronouns } = require("./setters/config/setPronouns.js"); -const remindPronouns = async (serverID, user) => { +async function remindPronouns(serverID, user) { traceFirstParam(arguments[0]); if (process.recentlyremindedpronouns == undefined) { process.recentlyremindedpronouns = {} diff --git a/functions/textfunctions.js b/functions/textfunctions.js index bb4e25cb..c7b7bc7d 100644 --- a/functions/textfunctions.js +++ b/functions/textfunctions.js @@ -5335,7 +5335,7 @@ const textarrays = { }; // Get generic text and spit out a pronoun respecting version YAY -const getTextGeneric = (type, data_in) => { +function getTextGeneric(type, data_in) { let generics = { unbind: ["TARGET_TAG has elected to prompt for TARGET_THEIR VAR_C1 to be removed. Please wait as TARGET_THEY confirmTARGET_S (5 minute timeout)."], unbind_decline: ["TARGET_TAG has declined your help with USER_THEIR VAR_C1."], @@ -5582,7 +5582,7 @@ to get the particular array of texts for that condition. THE PROPERTY ORDER IS IMPORTANT TO ENSURE THE TEXT RETRIEVAL WORKS AS INTENDED. -------------------------------------*/ -const getText = (data) => { +function getText(data) { try { let textarray = data.textarray; let data_in = data.textdata; diff --git a/functions/timefunctions.js b/functions/timefunctions.js index 69d73482..48969321 100644 --- a/functions/timefunctions.js +++ b/functions/timefunctions.js @@ -340,92 +340,108 @@ function runTickEvents() { } // Headwear if (process.headwear) { - Object.keys(process.headwear).forEach((userid) => { - getHeadwear(userid).forEach((h) => { - if (process.eventfunctions.headwear && process.eventfunctions.headwear[h] && process.eventfunctions.headwear[h].tick) { - process.eventfunctions.headwear[h].tick(userid); - } - }); + Object.keys(process.headwear).forEach((serverid) => { + Object.keys(process.headwear[serverid]).forEach((userid) => { + getHeadwear(serverid, userid).forEach((h) => { + if (process.eventfunctions.headwear && process.eventfunctions.headwear[h] && process.eventfunctions.headwear[h].tick) { + process.eventfunctions.headwear[h].tick(serverid, userid); + } + }); + }); }); } // Mittens if (process.mitten) { - Object.keys(process.mitten).forEach((userid) => { - if (getMitten(userid)) { - if (process.eventfunctions.mitten && process.eventfunctions.mitten[getMitten(userid).mittenname] && process.eventfunctions.mitten[getMitten(userid).mittenname].tick) { - process.eventfunctions.mitten[getMitten(userid).mittenname].tick(userid); - } - } + Object.keys(process.mitten).forEach((serverid) => { + Object.keys(process.mitten[serverid]).forEach((userid) => { + if (getMitten(serverid, userid)) { + if (process.eventfunctions.mitten && process.eventfunctions.mitten[getMitten(serverid, userid).mittenname] && process.eventfunctions.mitten[getMitten(serverid, userid).mittenname].tick) { + process.eventfunctions.mitten[getMitten(serverid, userid).mittenname].tick(serverid, userid); + } + } + }); }); } // Heavy Bondage if (process.heavy) { - Object.keys(process.heavy).forEach((userid) => { - if (getHeavyList(userid).length > 0) { - getHeavyList(userid).forEach((h) => { - if (process.eventfunctions.heavy && process.eventfunctions.heavy[h.type] && process.eventfunctions.heavy[h.type].tick) { - process.eventfunctions.heavy[h.type].tick(userid); - } - }) - } - }); + Object.keys(process.heavy).forEach((serverid) => { + Object.keys(process.heavy[serverid]).forEach((userid) => { + if (getHeavyList(serverid, userid).length > 0) { + getHeavyList(serverid, userid).forEach((h) => { + if (process.eventfunctions.heavy && process.eventfunctions.heavy[h.type] && process.eventfunctions.heavy[h.type].tick) { + process.eventfunctions.heavy[h.type].tick(serverid, userid); + } + }) + } + }); + }); } // Chastity Belts if (process.chastity) { - Object.keys(process.chastity).forEach((userid) => { - if (getChastity(userid)) { - if (process.eventfunctions.chastity && process.eventfunctions.chastity[getChastity(userid).chastitytype] && process.eventfunctions.chastity[getChastity(userid).chastitytype].tick) { - process.eventfunctions.chastity[getChastity(userid).chastitytype].tick(userid); - } - } - }); + Object.keys(process.chastity).forEach((serverid) => { + Object.keys(process.chastity[serverid]).forEach((userid) => { + if (getChastity(serverid, userid)) { + if (process.eventfunctions.chastity && process.eventfunctions.chastity[getChastity(serverid, userid).chastitytype] && process.eventfunctions.chastity[getChastity(serverid, userid).chastitytype].tick) { + process.eventfunctions.chastity[getChastity(serverid, userid).chastitytype].tick(serverid, userid); + } + } + }); + }); } // Chastity Bras if (process.chastitybra) { - Object.keys(process.chastitybra).forEach((userid) => { - if (getChastityBra(userid)) { - if (process.eventfunctions.chastitybra && process.eventfunctions.chastitybra[getChastityBra(userid).chastitytype] && process.eventfunctions.chastitybra[getChastityBra(userid).chastitytype].tick) { - process.eventfunctions.chastitybra[getChastityBra(userid).chastitytype].tick(userid); - } - } - }); + Object.keys(process.chastitybra).forEach((serverid) => { + Object.keys(process.chastitybra[serverid]).forEach((userid) => { + if (getChastityBra(serverid, userid)) { + if (process.eventfunctions.chastitybra && process.eventfunctions.chastitybra[getChastityBra(serverid, userid).chastitytype] && process.eventfunctions.chastitybra[getChastityBra(serverid, userid).chastitytype].tick) { + process.eventfunctions.chastitybra[getChastityBra(serverid, userid).chastitytype].tick(serverid, userid); + } + } + }); + }); } // Wearables if (process.wearable) { - Object.keys(process.wearable).forEach((userid) => { - getWearable(userid).forEach((h) => { - if (process.eventfunctions.wearable && process.eventfunctions.wearable[h] && process.eventfunctions.wearable[h].tick) { - process.eventfunctions.wearable[h].tick(userid); - } - }); - }); + Object.keys(process.wearable).forEach((serverid) => { + Object.keys(process.wearable[serverid]).forEach((userid) => { + getWearable(serverid, userid).forEach((h) => { + if (process.eventfunctions.wearable && process.eventfunctions.wearable[h] && process.eventfunctions.wearable[h].tick) { + process.eventfunctions.wearable[h].tick(serverid, userid); + } + }); + }); + }); } // Toys if (process.toys) { - Object.keys(process.toys).forEach((userid) => { - getToys(userid).forEach((h) => { - if (process.eventfunctions.toys && process.eventfunctions.toys[h.type] && process.eventfunctions.toys[h.type].tick) { - process.eventfunctions.toys[h.type].tick(userid); - } - }); - }); + Object.keys(process.toys).forEach((serverid) => { + Object.keys(process.toys[serverid]).forEach((userid) => { + getToys(serverid, userid).forEach((h) => { + if (process.eventfunctions.toys && process.eventfunctions.toys[h.type] && process.eventfunctions.toys[h.type].tick) { + process.eventfunctions.toys[h.type].tick(serverid, userid); + } + }); + }); + }); } // Collars if (process.collar) { - Object.keys(process.collar).forEach((userid) => { - if (getCollar(userid)) { - if (process.eventfunctions.collar && process.eventfunctions.collar[getCollar(userid).collartype] && process.eventfunctions.collar[getCollar(userid).collartype].tick) { - process.eventfunctions.collar[getCollar(userid).collartype].tick(userid); - } - if (getCollar(userid).additionalcollars) { - getCollar(userid).additionalcollars.forEach((ac) => { - if (process.eventfunctions.collar && process.eventfunctions.collar[ac] && process.eventfunctions.collar[ac].tick) { - process.eventfunctions.collar[ac].tick(userid); - } - }) + Object.keys(process.collar).forEach((serverid) => { + Object.keys(process.collar[serverid]).forEach((userid) => { + if (getCollar(serverid, userid)) { + if (process.eventfunctions.collar && process.eventfunctions.collar[getCollar(serverid, userid).collartype] && process.eventfunctions.collar[getCollar(serverid, userid).collartype].tick) { + process.eventfunctions.collar[getCollar(serverid, userid).collartype].tick(serverid, userid); + } + if (getCollar(serverid, userid).additionalcollars) { + getCollar(serverid, userid).additionalcollars.forEach((ac) => { + if (process.eventfunctions.collar && process.eventfunctions.collar[ac] && process.eventfunctions.collar[ac].tick) { + process.eventfunctions.collar[ac].tick(serverid, userid); + } + }) + } } - } - }); + }); + }); } } @@ -486,23 +502,25 @@ async function scavengeUsers(client) { processvars.forEach(async (v) => { if (process[v] == undefined) { process[v] = {} } Object.keys(process[v]).forEach(async (server) => { - let guildfetched = await client.guilds.fetch(server) - Object.keys(process[v][server]).forEach(async (person) => { - if (guildfetched) { - try { - if (!(await guildfetched.members.fetch(person))) { - delete process[v][server][person] // This person did NOT fetch successfully, so get rid of them. + if (process.client.guilds.cache.has(server)) { + let guildfetched = await client.guilds.fetch(server) + Object.keys(process[v][server]).forEach(async (person) => { + if (guildfetched) { + try { + if (!(await guildfetched.members.fetch(person))) { + delete process[v][server][person] // This person did NOT fetch successfully, so get rid of them. + } } + catch (err) { + console.log(`Crashed while fetching ${person} lol`); + console.log(err); + } + } + else { + console.log(`Guild doesn't exist!`) } - catch (err) { - console.log(`Crashed while fetching ${person} lol`); - console.log(err); - } - } - else { - console.log(`Guild doesn't exist!`) - } - }) + }) + } }) }) } diff --git a/index.js b/index.js index e26645d0..a0d8d5ec 100644 --- a/index.js +++ b/index.js @@ -24,6 +24,7 @@ const { setUpEventFunctions } = require('./functions/eventhandling.js'); const { getBotOption } = require('./functions/getters/config/getBotOption.js'); const { getAllJoinedGuilds } = require("./functions/getters/config/getAllJoinedGuilds.js"); const { logConsole } = require('./functions/logfunctions.js'); +const { markForSave } = require('./functions/other/markForSave.js'); // Prevent node from killing us immediately when we do the next line. process.stdin.resume(); @@ -80,30 +81,30 @@ let GagbotSavedFileDirectory = process.env.GAGBOTFILEDIRECTORY ? process.env.GAG process.GagbotSavedFileDirectory = GagbotSavedFileDirectory // Because honestly, I dont know WHY global stuff in index.js can't be accessble everywhere let processdatatoload = [ - { textname: "gaggedusers.txt", processvar: "gags", default: {}, hasusers: true }, - { textname: "mittenedusers.txt", processvar: "mitten", default: {}, hasusers: true }, - { textname: "chastityusers.txt", processvar: "chastity", default: {}, hasusers: true }, - { textname: "chastitybrausers.txt", processvar: "chastitybra", default: {}, hasusers: true }, - { textname: "toyusers.txt", processvar: "toys", default: {}, hasusers: true }, - { textname: "collarusers.txt", processvar: "collar", default: {}, hasusers: true }, - { textname: "heavyusers.txt", processvar: "heavy", default: {}, hasusers: true }, - { textname: "pronounsusers.txt", processvar: "pronouns", default: {}, hasusers: true }, - { textname: "usersdata.txt", processvar: "usercontext", default: {}, hasusers: true }, - { textname: "consentusers.txt", processvar: "consented", default: {}, hasusers: true }, - { textname: "corsetusers.txt", processvar: "corset", default: {}, hasusers: true }, - { textname: "arousal.txt", processvar: "arousal", default: {}, hasusers: true }, - { textname: "headwearusers.txt", processvar: "headwear", default: {}, hasusers: true }, - { textname: "discardedkeys.txt", processvar: "discardedKeys", default: [] }, - { textname: "configs.txt", processvar: "configs", default: {} }, - { textname: "outfits.txt", processvar: "outfits", default: {} }, - { textname: "dollusers.txt", processvar: "dolls", default: {}, hasusers: true }, - { textname: "wearables.txt", processvar: "wearable", default: {}, hasusers: true }, - { textname: "webhooks.txt", processvar: "webhookstoload", default: {} }, - { textname: "recordedmessages.txt", processvar: "recordedmessages", default: {} }, - { textname: "delveuserdata.txt", processvar: "delveuserdata", default: {}, hasusers: true }, - { textname: "userstats.txt", processvar: "userstats", default: {}, hasusers: true }, - { textname: "memberavatars.txt", processvar: "memberavatars", default: {}, hasusers: true }, - { textname: "heldkeytimers.txt", processvar: "heldkeytimers", default: {}, hasusers: true }, + { textname: "gaggedusers.txt", processvar: "gags", default: {}, rts: "gags", hasusers: true }, + { textname: "mittenedusers.txt", processvar: "mitten", default: {}, rts: "mitten", hasusers: true }, + { textname: "chastityusers.txt", processvar: "chastity", default: {}, rts: "chastity", hasusers: true }, + { textname: "chastitybrausers.txt", processvar: "chastitybra", default: {}, rts: "chastitybra", hasusers: true }, + { textname: "toyusers.txt", processvar: "toys", default: {}, rts: "toys", hasusers: true }, + { textname: "collarusers.txt", processvar: "collar", default: {}, rts: "collar", hasusers: true }, + { textname: "heavyusers.txt", processvar: "heavy", default: {}, rts: "heavy", hasusers: true }, + { textname: "pronounsusers.txt", processvar: "pronouns", default: {}, rts: "pronouns", hasusers: true }, + { textname: "usersdata.txt", processvar: "usercontext", default: {}, rts: "usercontext", hasusers: true }, + { textname: "consentusers.txt", processvar: "consented", default: {}, rts: "consented", hasusers: true }, + { textname: "corsetusers.txt", processvar: "corset", default: {}, rts: "corset", hasusers: true }, + { textname: "arousal.txt", processvar: "arousal", default: {}, rts: "arousal", hasusers: true }, + { textname: "headwearusers.txt", processvar: "headwear", default: {}, rts: "headwear", hasusers: true }, + { textname: "discardedkeys.txt", processvar: "discardedKeys", rts: "discardedKeys", default: [] }, + { textname: "configs.txt", processvar: "configs", default: {}, rts: "configs", }, + { textname: "outfits.txt", processvar: "outfits", default: {}, rts: "outfits", }, + { textname: "dollusers.txt", processvar: "dolls", default: {}, rts: "dolls", hasusers: true }, + { textname: "wearables.txt", processvar: "wearable", default: {}, rts: "wearable", hasusers: true }, + { textname: "webhooks.txt", processvar: "webhookstoload", default: {}, rts: "webhooks", }, + { textname: "recordedmessages.txt", processvar: "recordedmessages", default: {}, rts: "recordedmessages", }, + { textname: "delveuserdata.txt", processvar: "delveuserdata", default: {}, rts: "delveuserdata", hasusers: true }, + { textname: "userstats.txt", processvar: "userstats", default: {}, rts: "userstats", hasusers: true }, + { textname: "memberavatars.txt", processvar: "memberavatars", default: {}, rts: "memberavatars", hasusers: true }, + { textname: "heldkeytimers.txt", processvar: "heldkeytimers", default: {}, rts: "heldkeytimers", hasusers: true }, ] processdatatoload.forEach((s) => { @@ -263,44 +264,67 @@ client.on("clientReady", async () => { generateListTexts(); - // This code will be removed in a later update! - let guilds = process.client.guilds.cache.map(guild => guild.id) - processdatatoload.forEach(async (pd) => { - try { - if (pd.processvar) { - Object.keys(pd.processvar).forEach((user) => { - let useringuilds = []; - if (!guilds.includes(user) && pd.hasusers) { // This is a USER object! - let inaguild = false; - for (const guildID of guilds) { - let guild = process.client.guilds.cache.get(guildID); - try { - let founduser = await guild.members.fetch(user) - if (founduser) { - if (process[pd.processvar][guildID] == undefined) { process[pd.processvar][guildID] = {} } - process[pd.processvar][guildID][user] = Object.assign({}, process[pd.processvar][user]) - inaguild = true; + // This code will be removed in a later update! This is ONLY intended for startup and should be uncommented if needed for updating + /*await new Promise((res,rej) => { + let guilds = process.client.guilds.cache.map(guild => guild.id) + processdatatoload.forEach(async (pd) => { + try { + if (pd.processvar) { + Object.keys(process[pd.processvar]).forEach(async (user) => { + console.log(`Checking ${user} in ${pd.processvar}`) + let useringuilds = []; + if (!guilds.includes(user) && pd.hasusers) { // This is a USER object! + let inaguild = false; + for (const guildID of guilds) { + let guild = process.client.guilds.cache.get(guildID); + try { + let founduser = await guild.members.fetch(user) + if (founduser) { + if (process[pd.processvar][guildID] == undefined) { process[pd.processvar][guildID] = {} } + let newobj = {}; + //Object.keys(process[pd.processvar][user]).forEach((k) => { + // if (Array.isArray(k)) { + // newobj[k] = [...process[pd.processvar][user][k]] + // } + // else { + // } + //}) + process[pd.processvar][guildID][user] = structuredClone(process[pd.processvar][user]) + inaguild = true; + markForSave(pd.rts) + } + } + catch (err) { + // Not in the guild + logConsole(err, 4) + logConsole(`User ${user} is not in ${guildID}`, 4) } } - catch (err) { - // Not in the guild - logConsole(`User ${user} is not in ${guildID}`, 4) + if (inaguild) { + delete process[pd.processvar][user] + } + else { + console.log(`${pd.processvar}: User ${user} is not in ANY guild, leaving in place`) } } - if (inaguild) { - delete process[pd.processvar][user] - } - else { - console.log(`User ${user} is not in ANY guild, leaving in place`) - } - } - }) + }) + } } - } - catch (err) { - console.log(err); - } - }) + catch (err) { + console.log(err); + } + }) + setTimeout(() => { + processdatatoload.forEach(async (pd) => { + if (pd.hasusers) { + console.log(process[pd.processvar]); + } + }) + }, 10000) + setTimeout(() => { + res(true) + }, 20000); + })*/ scavengeUsers(client); setInterval(() => { From dc702bc1e088c38387e7c22fd4de11171afc5cbb Mon Sep 17 00:00:00 2001 From: Enraa Date: Mon, 22 Jun 2026 22:52:48 -0700 Subject: [PATCH 39/44] fixes --- commands/chastity.js | 2 +- commands/gag.js | 2 +- commands/heavy.js | 2 +- commands/mitten.js | 4 ++-- commands/unchastity.js | 1 + commands/unmitten.js | 2 +- eventfunctions/heavy/costumer_mimic.js | 12 ++++++------ functions/getters/collar/getCollarName.js | 1 + functions/getters/heavy/getHeavyList.js | 2 +- functions/getters/mitten/getMittenName.js | 2 +- functions/getters/wearable/getWearableName.js | 1 - functions/setters/arousal/addArousal.js | 3 ++- functions/textfunctions.js | 5 ++++- index.js | 12 ++++++++---- 14 files changed, 30 insertions(+), 21 deletions(-) diff --git a/commands/chastity.js b/commands/chastity.js index 3695b303..554f422d 100644 --- a/commands/chastity.js +++ b/commands/chastity.js @@ -85,7 +85,7 @@ module.exports = { targetuser: chastityuser, c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type c2: (braorbelt == "chastitybelt" ? getChastityName(interaction.guildId, chastityuser.id, bondagetype) : getChastityBraName(interaction.guildId, chastityuser.id, bondagetype)) ?? (braorbelt == "chastitybelt" ? "chastity belt" : "chastity bra"), - c3: `<@${braorbelt == "chastitybelt" ? getChastity(interaction.guildId, chastityuser.id)?.keyholder : getChastityBra(chastityuser.id)?.keyholder}>` + c3: `<@${braorbelt == "chastitybelt" ? getChastity(interaction.guildId, chastityuser.id)?.keyholder : getChastityBra(interaction.guildId, chastityuser.id)?.keyholder}>` }, }; if (braorbelt == "chastitybelt") { diff --git a/commands/gag.js b/commands/gag.js index 03908fdf..ca972ec0 100644 --- a/commands/gag.js +++ b/commands/gag.js @@ -36,7 +36,7 @@ module.exports = { if (matches.length == 0) { matches = autocompletes; } - let tags = getUserTags(interaction.user.id); + let tags = getUserTags(interaction.guildId, interaction.user.id); let newsorted = []; matches.forEach((f) => { let tagged = false; diff --git a/commands/heavy.js b/commands/heavy.js index b3ff7808..8f4991ed 100644 --- a/commands/heavy.js +++ b/commands/heavy.js @@ -70,7 +70,7 @@ module.exports = { return; } // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT - if (!getConsent(interaction.user.id)?.mainconsent) { + if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); return; } diff --git a/commands/mitten.js b/commands/mitten.js index 75e3de79..dd9477d1 100644 --- a/commands/mitten.js +++ b/commands/mitten.js @@ -78,8 +78,8 @@ module.exports = { serverID: interaction.guildId, interactionuser: interaction.user, targetuser: targetuser, - c1: getHeavy(interaction.user.id)?.displayname, // heavy bondage type - c2: getMittenName(interaction.user.id, chosenmittens) ?? "Standard Mittens", + c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type + c2: getMittenName(interaction.guildId, interaction.user.id, chosenmittens) ?? "Standard Mittens", }, }; diff --git a/commands/unchastity.js b/commands/unchastity.js index 78d5aac7..99be0cc6 100644 --- a/commands/unchastity.js +++ b/commands/unchastity.js @@ -31,6 +31,7 @@ module.exports = { } // Build data tree: let data = { + serverID: interaction.guildId, textarray: "texts_unchastity", textdata: { interactionuser: interaction.user, diff --git a/commands/unmitten.js b/commands/unmitten.js index 888f8d64..7c62be4d 100644 --- a/commands/unmitten.js +++ b/commands/unmitten.js @@ -30,7 +30,7 @@ module.exports = { interactionuser: interaction.user, targetuser: mitteneduser, c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type - c2: getMittenName(getMitten(interaction.guildId, mitteneduser.id)?.mittenname) ?? "mittens" + c2: getMittenName(interaction.guildId, getMitten(interaction.guildId, mitteneduser.id)?.mittenname) ?? "mittens" }, }; if (!getHeavyBound(interaction.guildId, interaction.user.id, mitteneduser.id)) { diff --git a/eventfunctions/heavy/costumer_mimic.js b/eventfunctions/heavy/costumer_mimic.js index 9f58de55..7f5eff25 100644 --- a/eventfunctions/heavy/costumer_mimic.js +++ b/eventfunctions/heavy/costumer_mimic.js @@ -384,11 +384,11 @@ let tick = async (serverID, userID, datain) => { if (getProcessVariable(serverID, userID, "userevents") == undefined) { setProcessVariable(serverID, userID, "userevents", {}) } if (getProcessVariable(serverID, userID, "userevents").costumermimic == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic = { stage: 0 } } if (getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx = 0 } - if (getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder = getHeavy(userID).origbinder } + if (getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder = getHeavy(serverID, userID).origbinder } // Randomly select an outfit from mimicCostumes.js if (getProcessVariable(serverID, userID, "userevents").costumermimic.outfit == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.outfit = Object.keys(mimicCostumes)[Math.floor(Math.random() * Object.keys(mimicCostumes).length)]; } - let currclothes = getWearable(userID).filter((f) => (!getLockedWearable(userID).includes(f))); // Current clothes that can be removed + let currclothes = getWearable(serverID, userID).filter((f) => (!getLockedWearable(serverID, userID).includes(f))); // Current clothes that can be removed let shuffledclothes = shuffleWearables(currclothes); // I admittedly dont think a big shuffler's necessary but its fine // Capture length of initial Removable Wearables array if (getProcessVariable(serverID, userID, "userevents").costumermimic.removableclothes == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.removableclothes = shuffledclothes.length } @@ -396,9 +396,9 @@ let tick = async (serverID, userID, datain) => { // get the user object, if it doesn't exist, go away let userobject = await process.client.users.fetch(userID); // The person in the processing terminal! - let targetobject = await process.client.users.fetch(getHeavy(userID).origbinder ?? userID); // The cruel person who threw this person in the terminal! + let targetobject = await process.client.users.fetch(getHeavy(serverID, userID).origbinder ?? userID); // The cruel person who threw this person in the terminal! // Something's wrong. - if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[serverID][userID])) { + if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[serverID] && process.recentmessages[serverID][userID])) { return; } @@ -420,7 +420,7 @@ let tick = async (serverID, userID, datain) => { } // The Mimic is teasing the Victim during the entire event~ (Arousal Gain can be increased or decreased as desired) - addArousal(userID, 1); + addArousal(serverID, userID, 1); console.log(getProcessVariable(serverID, userID, "userevents").costumermimic) @@ -538,7 +538,7 @@ let tick = async (serverID, userID, datain) => { case "headwear": if (!getHeadwear(serverID, userID) || (getHeadwear(serverID, userID) && (getHeadwear(serverID, userID).getHeadwearName != nextitem.itemtowear))) { data.headwear = true; - data.textdata.c1 = getHeadwearName(undefined, nextitem.itemtowear), // headwear name + data.textdata.c1 = getHeadwearName(serverID, undefined, nextitem.itemtowear), // headwear name // Apply the headwear assignHeadwear(serverID, userID, nextitem.itemtowear, targetobject.id) diff --git a/functions/getters/collar/getCollarName.js b/functions/getters/collar/getCollarName.js index 7d588e20..e5f7d661 100644 --- a/functions/getters/collar/getCollarName.js +++ b/functions/getters/collar/getCollarName.js @@ -1,4 +1,5 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); +const { getCollar } = require("./getCollar"); /************ * Gets the full collar name of the User ID. Optionally will get the full collar name of a collar by ID. diff --git a/functions/getters/heavy/getHeavyList.js b/functions/getters/heavy/getHeavyList.js index c7d810d5..eb851399 100644 --- a/functions/getters/heavy/getHeavyList.js +++ b/functions/getters/heavy/getHeavyList.js @@ -15,7 +15,7 @@ const { getProcessVariable } = require("../config/getProcessVariable"); *********/ function getHeavyList(serverID, user) { traceFirstParam(arguments[0]); - return getProcessVariable(serverID, user, "heavy"); + return getProcessVariable(serverID, user, "heavy") ?? []; } exports.getHeavyList = getHeavyList; \ No newline at end of file diff --git a/functions/getters/mitten/getMittenName.js b/functions/getters/mitten/getMittenName.js index dc6bb4da..14f1dbf3 100644 --- a/functions/getters/mitten/getMittenName.js +++ b/functions/getters/mitten/getMittenName.js @@ -27,7 +27,7 @@ function getMittenName(serverID, userID, mittenname) { } if (mittenname) { return convertmittenarr[mittenname]; - } else if (process.mitte[serverID][userID]?.mittenname) { + } else if (process.mitten[serverID][userID]?.mittenname) { return convertmittenarr[process.mitten[serverID][userID]?.mittenname]; } else { return undefined; diff --git a/functions/getters/wearable/getWearableName.js b/functions/getters/wearable/getWearableName.js index a99d0070..daa17914 100644 --- a/functions/getters/wearable/getWearableName.js +++ b/functions/getters/wearable/getWearableName.js @@ -12,7 +12,6 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); * ###### Note: Needs rework to remove the first param and just use wearablename ************/ function getWearableName(userID, wearablename) { - traceFirstParam(arguments[0]); if (process.wearable == undefined) { process.wearable = {}; } diff --git a/functions/setters/arousal/addArousal.js b/functions/setters/arousal/addArousal.js index 103783ee..8c646a12 100644 --- a/functions/setters/arousal/addArousal.js +++ b/functions/setters/arousal/addArousal.js @@ -1,5 +1,6 @@ const { getArousal } = require("../../getters/arousal/getArousal"); const { getCombinedTraits } = require("../../getters/chastity/getCombinedTraits"); +const { getOption } = require("../../getters/config/getOption"); const { getProcessVariable } = require("../../getters/config/getProcessVariable"); const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); @@ -28,7 +29,7 @@ function addArousal(serverID, user, change) { console.log(`ERROR - ${user} is somehow not a number!`) process.arousal[serverID][user].arousal = 0; } - getCombinedTraits(serverID, user).afterArousalChange({ userID: user, prevArousal: (getArousal(serverID, user) - change), currArousal: getArousal(serverID, user) }); + getCombinedTraits(serverID, user).afterArousalChange({ serverID: serverID, userID: user, prevArousal: (getArousal(serverID, user) - change), currArousal: getArousal(serverID, user) }); return getArousal(serverID, user); } diff --git a/functions/textfunctions.js b/functions/textfunctions.js index c7b7bc7d..58125a19 100644 --- a/functions/textfunctions.js +++ b/functions/textfunctions.js @@ -5586,9 +5586,12 @@ function getText(data) { try { let textarray = data.textarray; let data_in = data.textdata; + if (data_in.serverID == undefined) { + data_in.serverID = data.serverID; + } let props = []; for (k in data) { - if (k != "textarray" && k != "textdata") { + if (k != "textarray" && k != "textdata" && k != "serverID") { props.push(k); // Should create the same order. } } diff --git a/index.js b/index.js index a0d8d5ec..555b1a13 100644 --- a/index.js +++ b/index.js @@ -367,7 +367,8 @@ client.on("messageCreate", async (msg) => { if ((getBotOption("bot-allowkeyfinding") == "Enabled")) { handleKeyFinding(msg); } - process.recentmessages[msg.author.id] = msg.channel.id; + if (process.recentmessages[msg.guild.id] == undefined) { process.recentmessages[msg.guild.id] = {} } + process.recentmessages[msg.guild.id][msg.author.id] = msg.channel.id; modifymessage(msg, thread ? msg.channelId : null); } if ((msg.channel.id != process.env.CHANNELID && msg.channel.parentId != process.env.CHANNELID) || (msg.webhookId) || (msg.author.bot) || (msg.stickers?.first()) || (message.flags && message.flags.has(discord.MessageFlags.HasSnapshot)) || (message.flags && message.flags.has(discord.MessageFlags.IsCrosspost))) { return } @@ -382,21 +383,24 @@ client.on('interactionCreate', async (interaction) => { // Handle general interactions from a user if (interaction.channelId && interaction.guildId && interaction.user && interaction.user.id) { if (process.recentmessages == undefined) { process.recentmessages = {} } - process.recentmessages[interaction.user.id] = interaction.channelId; + if (process.recentmessages[interaction.guildId] == undefined) { process.recentmessages[interaction.guildId] = {} } + process.recentmessages[interaction.guildId][interaction.user.id] = interaction.channelId; } // Handle User targeted actions from context menu if (interaction.channelId && interaction.guildId && interaction.user && interaction.targetId && (interaction.commandType == 2)) { if (process.recentmessages == undefined) { process.recentmessages = {} } - process.recentmessages[interaction.targetId] = interaction.channelId; + if (process.recentmessages[interaction.guildId] == undefined) { process.recentmessages[interaction.guildId] = {} } + process.recentmessages[interaction.guildId][interaction.targetId] = interaction.channelId; } // Handle Message targeted headpats if (interaction.channelId && interaction.guildId && interaction.user && interaction.targetId && (interaction.commandType == 3)) { if (process.recentmessages == undefined) { process.recentmessages = {} } + if (process.recentmessages[interaction.guildId] == undefined) { process.recentmessages[interaction.guildId] = {} } let channel = await interaction.client.channels.fetch(interaction.channelId) if (channel) { let message = await channel.messages.fetch(interaction.targetId) if (message) { - process.recentmessages[message.author.id] = interaction.channelId; + process.recentmessages[interaction.guildId][message.author.id] = interaction.channelId; } } } From 46bb0ed6f68df6e5a8a0475937a0811c9e192677 Mon Sep 17 00:00:00 2001 From: Enraa Date: Mon, 22 Jun 2026 23:27:32 -0700 Subject: [PATCH 40/44] CHAOS MIMIC BROKE --- eventfunctions/heavy/costumer_mimic_chaos.js | 22 +++++++++++--------- functions/heavyfunctions.js | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/eventfunctions/heavy/costumer_mimic_chaos.js b/eventfunctions/heavy/costumer_mimic_chaos.js index 1ce1c66f..83a0434e 100644 --- a/eventfunctions/heavy/costumer_mimic_chaos.js +++ b/eventfunctions/heavy/costumer_mimic_chaos.js @@ -6,6 +6,7 @@ const { getChastityBraName } = require("../../functions/getters/chastity/getChas const { getChastityName } = require("../../functions/getters/chastity/getChastityName.js"); const { getCollar } = require("../../functions/getters/collar/getCollar.js"); const { getCollarName } = require("../../functions/getters/collar/getCollarName.js"); +const { getProcessVariable } = require("../../functions/getters/config/getProcessVariable.js"); const { getUserTags } = require("../../functions/getters/config/getUserTags.js"); const { getGag } = require("../../functions/getters/gag/getGag.js"); const { convertGagText } = require("../../functions/getters/gag/getGagName.js"); @@ -23,6 +24,7 @@ const { messageSendChannel } = require("../../functions/messagefunctions.js"); const { assignChastity } = require("../../functions/setters/chastity/assignChastity.js"); const { assignChastityBra } = require("../../functions/setters/chastity/assignChastityBra.js"); const { assignCollar } = require("../../functions/setters/collar/assignCollar.js"); +const { setProcessVariable } = require("../../functions/setters/config/setProcessVariable.js"); const { assignGag } = require("../../functions/setters/gag/assignGag.js"); const { assignHeadwear } = require("../../functions/setters/headwear/assignHeadwear.js"); const { assignHeavy } = require("../../functions/setters/heavy/assignHeavy.js"); @@ -51,10 +53,10 @@ function shuffleWearables(inputArray) { // Then it will spit them out and apply a new heavy item at the end! let tick = async (serverID, userID, datain) => { - if (getProcessVariable(serverID, userID, "userevents") == undefined) { getProcessVariable(serverID, userID, "userevents") = {} } + if (getProcessVariable(serverID, userID, "userevents") == undefined) { setProcessVariable(serverID, userID, "userevents", {}) } if (getProcessVariable(serverID, userID, "userevents").costumermimic == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic = { stage: 0 } } if (getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx = 0 } - if (getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder = getHeavy(userID).origbinder } + if (getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder == undefined) { getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder = getHeavy(serverID, userID).origbinder } // Randomly generate an outfit if (getProcessVariable(serverID, userID, "userevents").costumermimic.outfit == undefined) { @@ -84,7 +86,7 @@ let tick = async (serverID, userID, datain) => { } else if ((randomchoice == 1) && !blocks.includes("mitten")) { // Mitten - arr = mittentypes + arr = [...mittentypes] arr = arr.filter((f) => { let goodtoreturn = true; tags.forEach((t) => { @@ -111,7 +113,7 @@ let tick = async (serverID, userID, datain) => { outfitpieces.push({ category: "mittens", itemtowear: choice.value, color: null }) } else if ((randomchoice == 2) && !blocks.includes("collar")) { - arr = collartypes + arr = [...collartypes] arr = arr.filter((f) => { let goodtoreturn = true; tags.forEach((t) => { @@ -197,7 +199,7 @@ let tick = async (serverID, userID, datain) => { } else if ((randomchoice == 5) && !blocks.includes("heavy")) { // This one has to go to the end, so it is pushed to the heavyend option. - arr = heavytypes + arr = [...heavytypes] arr = arr.filter((f) => { let goodtoreturn = true; tags.forEach((t) => { @@ -224,7 +226,7 @@ let tick = async (serverID, userID, datain) => { heavyend = { category: "heavy", itemtowear: choice.value, color: null } } else if ((randomchoice == 5) && !blocks.includes("headwear")) { - arr = process.headtypes + arr = [...process.headtypes] arr = arr.filter((f) => { let goodtoreturn = true; tags.forEach((t) => { @@ -251,7 +253,7 @@ let tick = async (serverID, userID, datain) => { outfitpieces.push({ category: "headwear", itemtowear: choice.value, color: null }) } else { - arr = wearabletypes + arr = [...wearabletypes] arr = arr.filter((f) => { let goodtoreturn = true; tags.forEach((t) => { @@ -290,7 +292,7 @@ let tick = async (serverID, userID, datain) => { let userobject = await process.client.users.fetch(userID); // The person in the processing terminal! let targetobject = await process.client.users.fetch(getHeavy(serverID, userID).origbinder ?? userID); // The cruel person who threw this person in the terminal! // Something's wrong. - if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[serverID][userID])) { + if (!userobject || !targetobject || !(process.recentmessages && process.recentmessages[serverID] && process.recentmessages[serverID][userID])) { return; } @@ -507,8 +509,8 @@ let tick = async (serverID, userID, datain) => { data.replace = true; } else { - data.textdata.c2 = getChastityBraName(undefined, nextitem.itemtowear), // chastity bra name - assignChastityBra(userID, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder, nextitem.itemtowear) + data.textdata.c2 = getChastityBraName(serverID, undefined, nextitem.itemtowear), // chastity bra name + assignChastityBra(serverID, userID, getProcessVariable(serverID, userID, "userevents").costumermimic.origbinder, nextitem.itemtowear) data.add = true; } messageSendChannel(getText(data), process.recentmessages[serverID][userID]); diff --git a/functions/heavyfunctions.js b/functions/heavyfunctions.js index f9659bc4..a2d5970e 100644 --- a/functions/heavyfunctions.js +++ b/functions/heavyfunctions.js @@ -151,7 +151,7 @@ const heavytypes = [ { name: "Dolly", value: "dolly", tags: ["metal"], denialCoefficient: 3, heavytags: ["arms", "legs"] }, { name: "Costumer Mimic", value: "costumer_mimic", tags: ["confined",], denialCoefficient: 5, heavytags: ["arms", "legs"] }, { name: "Costumer Mimic (Latex)", value: "costumer_mimic_latex", tags: ["confined", "latex"], denialCoefficient: 5, heavytags: ["arms", "legs"] }, - { name: "Costumer Mimic (Chaos)", value: "costumer_mimic_chaos", tags: ["confined", "latex"], denialCoefficient: 5, heavytags: ["arms", "legs"] }, + { name: "Costumer Mimic (Chaos) BROKEN", value: "costumer_mimic_chaos", tags: ["confined", "latex"], denialCoefficient: 5, heavytags: ["arms", "legs"], noself: true, noother: true }, // Currently MASSIVELY broken! { name: "Capture Sphere", value: "capture_sphere", tags: ["confined", "dimensional"], denialCoefficient: 3, heavytags: ["arms", "legs"] }, { name: "Love Sphere", value: "capture_sphere_love", tags: ["confined", "dimensional"], denialCoefficient: 3, heavytags: ["arms", "legs"] }, { name: "Great Sphere", value: "capture_sphere_great", tags: ["confined", "dimensional"], denialCoefficient: 5, heavytags: ["arms", "legs"] }, From 0dafee8ce3fec033061d984f4391665f0a88179a Mon Sep 17 00:00:00 2001 From: Enraa Date: Mon, 22 Jun 2026 23:43:07 -0700 Subject: [PATCH 41/44] inspector gadget --- functions/getters/config/getDisplayTexts.js | 4 ++-- functions/outfitfunctions.js | 5 +++-- index.js | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/getters/config/getDisplayTexts.js b/functions/getters/config/getDisplayTexts.js index 0817fa1d..9d6ee5ea 100644 --- a/functions/getters/config/getDisplayTexts.js +++ b/functions/getters/config/getDisplayTexts.js @@ -47,7 +47,7 @@ async function getDisplayTexts(serverID, userID, inspectuserID) { // Attempt to get the current guild member object for the user. This might have unintended consequences // however I'd have to retool the main function to narrow down to one guild. Too much work currently. let guild = process.client.guilds.cache.get(serverID); - let inspectusername = guild.members.get(inspectuserID).displayname + let inspectusername = guild.members.cache.get(inspectuserID).displayname if (process.heavy && process.heavy[serverID]) { Object.keys(process.heavy[serverID]).forEach((k) => { if (!Array.isArray(process.heavy[serverID][k])) { @@ -70,7 +70,7 @@ async function getDisplayTexts(serverID, userID, inspectuserID) { // ****************** // ****************** Shared Gasmask --- Can't currently test this because linked was disabled for now. - if (getProcessVariable(serverID, inspectuserID, "headwear").sharedbreathhose) { + if (getProcessVariable(serverID, inspectuserID, "headwear")?.sharedbreathhose) { bartext = `${bartext}\n\n${process.emojis.gasmask} Sharing Breath with: <@${getProcessVariable(serverID, inspectuserID, "headwear").sharedbreathhose}>` } // ****************** diff --git a/functions/outfitfunctions.js b/functions/outfitfunctions.js index 2abf556b..ac773eb4 100644 --- a/functions/outfitfunctions.js +++ b/functions/outfitfunctions.js @@ -51,6 +51,7 @@ const { getCollarKeys } = require("./getters/collar/getCollarKeys"); const { getClonedChastityKeysOwned } = require("./getters/chastity/getClonedChastityKeysOwned"); const { getClonedChastityBraKeysOwned } = require("./getters/chastity/getClonedChastityBraKeysOwned"); const { getClonedCollarKeysOwned } = require("./getters/collar/getClonedCollarKeysOwned"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam"); async function generateOutfitModal(serverID, userID, menu, page, options) { traceFirstParam(arguments[0]); @@ -579,7 +580,7 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { wearingtext = `${wearingtext}\n${process.emojis.gag} Gags: **${getGags(serverID, inspectuserID).map((g) => { return `${convertGagText(g.gagtype)} (${g.intensity})`}).join(", ")}**` } // Headwear - if (getHeadwear(inspectuserID).length > 0) { + if (getHeadwear(serverID, inspectuserID).length > 0) { wearingtext = `${wearingtext}\n${process.emojis.gasmask} Masks: **${getHeadwear(serverID, inspectuserID).map((h) => (!getLockedHeadgear(serverID, inspectuserID).includes(h) ? getHeadwearName(serverID, undefined, h) : `*${getHeadwearName(serverID, undefined, h)}*`)).join(", ")}**` let lockedheadgears = []; if (process.headwear[serverID][inspectuserID]) { lockedheadgears = Object.keys(process.headwear[serverID][inspectuserID]) } @@ -770,7 +771,7 @@ async function inspectModal(serverID, userID, inspectuserIDin, menu, page) { wearingtext = `${wearingtext}\n${process.emojis.gag} Gags: **${getGags(serverID, inspectuserID).map((g) => { return `${convertGagText(g.gagtype)} (${g.intensity})`}).join(", ")}**` } // Headwear - if (getHeadwear(inspectuserID).length > 0) { + if (getHeadwear(serverID, inspectuserID).length > 0) { wearingtext = `${wearingtext}\n${process.emojis.gasmask} Masks: **${getHeadwear(serverID, inspectuserID).map((h) => (!getLockedHeadgear(serverID, inspectuserID).includes(h) ? getHeadwearName(serverID, undefined, h) : `*${getHeadwearName(serverID, undefined, h)}*`)).join(", ")}**` let lockedheadgears = []; if (process.headwear[serverID][inspectuserID]) { lockedheadgears = Object.keys(process.headwear[serverID][inspectuserID]) } diff --git a/index.js b/index.js index 555b1a13..2d68a10b 100644 --- a/index.js +++ b/index.js @@ -229,8 +229,7 @@ const client = new discord.Client({ intents: [ discord.GatewayIntentBits.Guilds, discord.GatewayIntentBits.GuildMessages, - discord.GatewayIntentBits.MessageContent, - discord.GatewayIntentBits.GuildMembers + discord.GatewayIntentBits.MessageContent ] }) From b5a2a93b1602036083c8a2d57eb5a327bd6146a8 Mon Sep 17 00:00:00 2001 From: Enraa Date: Tue, 23 Jun 2026 20:27:47 -0700 Subject: [PATCH 42/44] More testing! --- commands/heavy.js | 2 +- commands/struggle.js | 2 +- commands/unheavy.js | 2 +- commands/untoy.js | 2 +- .../chastity/belt_seal_falsecalm.js | 2 +- eventfunctions/collar/collar_struggle.js | 2 +- eventfunctions/gags/chocolate.js | 2 +- eventfunctions/gags/chocolate~.js | 2 +- eventfunctions/gags/gummy.js | 2 +- eventfunctions/gags/jawbreaker.js | 2 +- eventfunctions/gags/jawbreaker~.js | 2 +- eventfunctions/gags/politeSub.js | 2 +- functions/configfunctions.js | 3 +- functions/dollfunctions.js | 8 +- functions/getters/arousal/getArousal.js | 2 +- .../chastity/getChastityBraTimelock.js | 6 +- functions/getters/config/getAlternateName.js | 1 + functions/getters/config/getDisplayTexts.js | 2 +- functions/getters/config/getOutfits.js | 2 +- functions/getters/config/getPronouns.js | 2 +- functions/getters/toy/getSpecificToy.js | 3 +- functions/pronounfunctions.js | 1 + functions/setters/chastity/assignChastity.js | 4 +- functions/setters/gag/removeGag.js | 2 +- functions/timefunctions.js | 15 ++- functions/timelockfunctions.js | 3 +- index.js | 90 +--------------- lists/processdatatoload.js | 32 ++++++ migratedata.js | 101 ++++++++++++++++++ 29 files changed, 177 insertions(+), 124 deletions(-) create mode 100644 lists/processdatatoload.js create mode 100644 migratedata.js diff --git a/commands/heavy.js b/commands/heavy.js index 8f4991ed..5e82e69b 100644 --- a/commands/heavy.js +++ b/commands/heavy.js @@ -138,7 +138,7 @@ module.exports = { let blockertype; getHeavyList(interaction.guildId, targetuser.id).map((h) => getBaseHeavy(h.type)).forEach((h) => { h.heavytags.forEach((t) => { - if (getBaseHeavy(interaction.guildId, heavychoice).heavytags.includes(t)) { + if (getBaseHeavy(heavychoice).heavytags.includes(t)) { canwear = false blocker = h blockertype = t diff --git a/commands/struggle.js b/commands/struggle.js index fc51357f..385b5f35 100644 --- a/commands/struggle.js +++ b/commands/struggle.js @@ -294,7 +294,7 @@ module.exports = { interaction.reply(getText(data)); } // Increment the struggle message counter - statsAddCounter(interaction.user.id, "strugglemessages", 1) + statsAddCounter(interaction.guildId, interaction.user.id, "strugglemessages", 1) } catch (err) { console.log(err); } diff --git a/commands/unheavy.js b/commands/unheavy.js index 6b59d720..c234b0af 100644 --- a/commands/unheavy.js +++ b/commands/unheavy.js @@ -46,7 +46,7 @@ module.exports = { async execute(interaction) { try { let heavyuser = interaction.options.getUser("user") ? interaction.options.getUser("user") : interaction.user; - let heavytype = interaction.options.getString("type") ?? getHeavy(heavyuser.id)?.type; + let heavytype = interaction.options.getString("type") ?? getHeavy(interaction.guildId, heavyuser.id)?.type; // CHECK IF THEY CONSENTED! IF NOT, MAKE THEM CONSENT if (!getConsent(interaction.guildId, interaction.user.id)?.mainconsent) { await handleConsent(interaction, interaction.user.id); diff --git a/commands/untoy.js b/commands/untoy.js index 9b8e8e3f..09609457 100644 --- a/commands/untoy.js +++ b/commands/untoy.js @@ -132,7 +132,7 @@ module.exports = { if (toyuser == interaction.user) { // self data.self = true; - if (getSpecificToy(toyuser.id, toytype)) { + if (getSpecificToy(interaction.guild.id, toyuser.id, toytype)) { // toy already on wearer data.toy = true; if (toybase.blocker({ serverID: interaction.guildId, userID: toyuser.id })) { diff --git a/eventfunctions/chastity/belt_seal_falsecalm.js b/eventfunctions/chastity/belt_seal_falsecalm.js index e28c9d39..0661046b 100644 --- a/eventfunctions/chastity/belt_seal_falsecalm.js +++ b/eventfunctions/chastity/belt_seal_falsecalm.js @@ -13,7 +13,7 @@ let tick = async function(serverID, userid, data) { { // Calc Impact of Toys and increment Base_Arousal getToys(serverID, userid).forEach(toy => { - setUserVar(serverID, userid, "base_arousal", getUserVar(serverID, userid, "base_arousal") + (getBaseToy(serverID, toy.type).calcVibeEffect({ serverID: serverID, userID: userid, intensity: toy.intensity }) * tickMod)) + setUserVar(serverID, userid, "base_arousal", getUserVar(serverID, userid, "base_arousal") + (getBaseToy(toy.type).calcVibeEffect({ serverID: serverID, userID: userid, intensity: toy.intensity }) * tickMod)) }); } else diff --git a/eventfunctions/collar/collar_struggle.js b/eventfunctions/collar/collar_struggle.js index a027cd92..5264395e 100644 --- a/eventfunctions/collar/collar_struggle.js +++ b/eventfunctions/collar/collar_struggle.js @@ -254,5 +254,5 @@ exports.tick = async (serverID, userID, data) => { } exports.msgfunction = (serverID, userid, data) => { - setUserVar(serverID, userid, "struggleCollarMsgs", (getUserVar(userid, "struggleCollarMsgs") ?? 1) + 1); + setUserVar(serverID, userid, "struggleCollarMsgs", (getUserVar(serverID, userid, "struggleCollarMsgs") ?? 1) + 1); } \ No newline at end of file diff --git a/eventfunctions/gags/chocolate.js b/eventfunctions/gags/chocolate.js index fa52899e..7714b7be 100644 --- a/eventfunctions/gags/chocolate.js +++ b/eventfunctions/gags/chocolate.js @@ -15,7 +15,7 @@ async function tick(serverID, userID, data) { } // Decrement Intensity every timer interval - if (getUserVar(serverID, userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "chocolate") && process.recentmessages[serverID][userID]) { + if (getUserVar(serverID, userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "chocolate") && (process.recentmessages[serverID] && process.recentmessages[serverID][userID])) { if(getGag(serverID, userID, "chocolate").intensity > 1){ setUserVar(serverID, userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) // Get Intensity and push decremented version diff --git a/eventfunctions/gags/chocolate~.js b/eventfunctions/gags/chocolate~.js index 90e5c520..58082964 100644 --- a/eventfunctions/gags/chocolate~.js +++ b/eventfunctions/gags/chocolate~.js @@ -18,7 +18,7 @@ async function tick(serverID, userID, data) { } // Decrement Intensity every timer interval - if (getUserVar(serverID, userID, "aphroConfectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "chocolate~") && process.recentmessages[serverID][userID]) { + if (getUserVar(serverID, userID, "aphroConfectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "chocolate~") && (process.recentmessages[serverID] && process.recentmessages[serverID][userID])) { if(getGag(serverID, userID, "chocolate~").intensity > 1){ setUserVar(serverID, userID, "aphroConfectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) diff --git a/eventfunctions/gags/gummy.js b/eventfunctions/gags/gummy.js index cc5582fa..6343b553 100644 --- a/eventfunctions/gags/gummy.js +++ b/eventfunctions/gags/gummy.js @@ -15,7 +15,7 @@ async function tick(serverID, userID, data) { } // Decrement Intensity every timer interval - if (getUserVar(serverID, userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "gummy") && process.recentmessages[serverID][userID]) { + if (getUserVar(serverID, userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "gummy") && (process.recentmessages[serverID] && process.recentmessages[serverID][userID])) { if(getGag(serverID, userID, "gummy").intensity > 1){ setUserVar(serverID, userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) // Get Intensity and push decremented version diff --git a/eventfunctions/gags/jawbreaker.js b/eventfunctions/gags/jawbreaker.js index 9b8000ee..b3bc98f1 100644 --- a/eventfunctions/gags/jawbreaker.js +++ b/eventfunctions/gags/jawbreaker.js @@ -15,7 +15,7 @@ async function tick(serverID, userID, data) { } // Decrement Intensity every timer interval - if (getUserVar(serverID, userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "jawbreaker") && process.recentmessages[serverID][userID]) { + if (getUserVar(serverID, userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "jawbreaker") && (process.recentmessages[serverID] && process.recentmessages[serverID][userID])) { if(getGag(serverID, userID, "jawbreaker").intensity > 1){ setUserVar(serverID, userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) // Get Intensity and push decremented version diff --git a/eventfunctions/gags/jawbreaker~.js b/eventfunctions/gags/jawbreaker~.js index 6fa02d23..2545aa57 100644 --- a/eventfunctions/gags/jawbreaker~.js +++ b/eventfunctions/gags/jawbreaker~.js @@ -16,7 +16,7 @@ async function tick(serverID, userID, data) { } // Decrement Intensity every timer interval - if (getUserVar(serverID, userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "jawbreaker~") && process.recentmessages[serverID][userID]) { + if (getUserVar(serverID, userID, "confectionaryDissolveTimer") < Date.now() && getGag(serverID, userID, "jawbreaker~") && (process.recentmessages[serverID] && process.recentmessages[serverID][userID])) { if(getGag(serverID, userID, "jawbreaker~").intensity > 1){ setUserVar(serverID, userID, "confectionaryDissolveTimer", Date.now() + DISSOLVE_RATE_MS) // Get Intensity and push decremented version diff --git a/eventfunctions/gags/politeSub.js b/eventfunctions/gags/politeSub.js index 347ac915..4a1b1ade 100644 --- a/eventfunctions/gags/politeSub.js +++ b/eventfunctions/gags/politeSub.js @@ -4,7 +4,7 @@ const { setUserVar } = require("../../functions/setters/config/setUserVar") async function tick(serverID, userID, data) { // Remind them on the third infraction and reset - if (getUserVar(serverID, userID, "politeSubSilences") > 2) { + if ((getUserVar(serverID, userID, "politeSubSilences") > 2) && process.recentmessages[serverID]) { messageSendChannel(`<@${userID}> should speak with titles to people, such as "Miss," "Mxtress," "Sir," "-sama" and the like.`, process.recentmessages[serverID][userID]) setUserVar(serverID, userID, "politeSubSilenceTime", undefined) setUserVar(serverID, userID, "politeSubSilences", undefined) diff --git a/functions/configfunctions.js b/functions/configfunctions.js index d553e37d..ebde5c71 100644 --- a/functions/configfunctions.js +++ b/functions/configfunctions.js @@ -6,6 +6,7 @@ const { getServerCmdRefresh } = require("./getters/config/getServerCmdRefresh.js const { getServerOption } = require("./getters/config/getServerOption.js"); const { getBotOption } = require("./getters/config/getBotOption.js"); const { configoptions } = require("../lists/configoptions.js"); +const { getProcessVariable } = require("./getters/config/getProcessVariable.js"); function generateConfigModal(interaction, menuset = "General", page, statustext) { console.log("Start of generate config modal"); @@ -172,7 +173,7 @@ function generateConfigModal(interaction, menuset = "General", page, statustext) .setCustomId(`config_pageoptrevoke_${menuset}`) .setLabel(`Revoke Consent`) .setStyle(ButtonStyle.Danger) - .setDisabled(process.consented[interaction.user.id] == undefined), + .setDisabled(getProcessVariable(interaction.guildId, interaction.user.id, "consented") == undefined), ); pagecomponents.push(buttonsection); } else if (configoptions[menuset][k].menutype == "choice_") { diff --git a/functions/dollfunctions.js b/functions/dollfunctions.js index b77727eb..db839fe7 100644 --- a/functions/dollfunctions.js +++ b/functions/dollfunctions.js @@ -390,8 +390,8 @@ async function textGarbleDOLL(msg, modifiedmessage, outtextin) { } // If the Doll has configured forbidden words, add those to the array. - if (getOption(msg.author.id, "dollpunishwords")) { - getOption(msg.author.id, "dollpunishwords").forEach((r) => { + if (getOption(msg.guild.id, msg.author.id, "dollpunishwords")) { + getOption(msg.guild.id, msg.author.id, "dollpunishwords").forEach((r) => { // Each of these is a regexp already, so adding them is easy! uniquedollprotocol.push({ regex: new RegExp(`\\b(${r})\\b`, "gi"), value: 2, type: "redact", string: r } ) }) @@ -444,7 +444,7 @@ async function textGarbleDOLL(msg, modifiedmessage, outtextin) { if ((dollProtocolViolations > 0 || warnmodified) && i == lastDollifiedMessage) { let totalViolations = dollProtocolViolations; if (dollProtocolLevel != "warning") { - totalViolations = dollProtocolViolations + process.dolls[msg.author.id].violations; + totalViolations = dollProtocolViolations + process.dolls[msg.guild.id, msg.author.id].violations; } // WARN if below punishment threshold. ERROR if exceeded. @@ -470,7 +470,7 @@ async function textGarbleDOLL(msg, modifiedmessage, outtextin) { dollMessageParts[i].text += `\n[1;${violationColor}${violationTier}:[0;${violationColor} Protocol Violation${violationcount} - ${vioMessage}`; } else if (dollProtocolViolations == 0 && i == lastDollifiedMessage) { - let goodDollReturn = rewardDoll(msg.author.id); + let goodDollReturn = rewardDoll(msg.guild.id, msg.author.id); //console.log(goodDollReturn) if (goodDollReturn == "violation") { dollMessageParts[i].text += `\nALERT: Protocol Violation count decremented to (${process.dolls[msg.author.id].violations}/${dollPunishThresh}). It is a Good Doll.`; diff --git a/functions/getters/arousal/getArousal.js b/functions/getters/arousal/getArousal.js index 538b805d..d4303b18 100644 --- a/functions/getters/arousal/getArousal.js +++ b/functions/getters/arousal/getArousal.js @@ -11,7 +11,7 @@ const { traceFirstParam } = require("../../other/TESTS/traceFirstParam"); */ function getArousal(serverID, user) { traceFirstParam(arguments[0]); - return getProcessVariable(serverID, user, "arousal").arousal ?? 0; + return getProcessVariable(serverID, user, "arousal")?.arousal ?? 0; } exports.getArousal = getArousal; \ No newline at end of file diff --git a/functions/getters/chastity/getChastityBraTimelock.js b/functions/getters/chastity/getChastityBraTimelock.js index 552e2ff3..a2debe68 100644 --- a/functions/getters/chastity/getChastityBraTimelock.js +++ b/functions/getters/chastity/getChastityBraTimelock.js @@ -16,10 +16,10 @@ function getChastityBraTimelock(serverID, userID, UNIXTimestring) { process.chastitybra = {}; } if (!UNIXTimestring) { - return getChastityBra(serverID, user)?.unlockTime; + return getChastityBra(serverID, userID)?.unlockTime; } else { - if (getChastityBra(serverID, user)?.unlockTime) { - return ``; + if (getChastityBra(serverID, userID)?.unlockTime) { + return ``; } else { return null; } diff --git a/functions/getters/config/getAlternateName.js b/functions/getters/config/getAlternateName.js index 4e59cb2d..b7ee5e3f 100644 --- a/functions/getters/config/getAlternateName.js +++ b/functions/getters/config/getAlternateName.js @@ -18,6 +18,7 @@ function getAlternateName(serverID, user) { let outname = user.displayName // We're putting a member object in here // Handle pet collar name if ((getCollar(serverID, user.id)?.collartype == "collarengraved") || (getCollar(serverID, user.id) && getCollar(serverID, user.id).additionalcollars && getCollar(serverID, user.id).additionalcollars.includes("collarengraved"))) { + console.log(getOption(serverID, user.id, "engravedcollarname")) if (getOption(serverID, user.id, "engravedcollarname") && getOption(serverID, user.id, "engravedcollarname").length > 0) { outname = getOption(serverID, user.id, "engravedcollarname"); } diff --git a/functions/getters/config/getDisplayTexts.js b/functions/getters/config/getDisplayTexts.js index 9d6ee5ea..8ce5b92f 100644 --- a/functions/getters/config/getDisplayTexts.js +++ b/functions/getters/config/getDisplayTexts.js @@ -36,7 +36,7 @@ async function getDisplayTexts(serverID, userID, inspectuserID) { let arousalchangetext = getArousalChangeDescription(serverID, inspectuserID) bartext = `\n\nšŸ’ž Arousal: **${arousaltext}**${arousalchangetext ? `\n-# **...${arousalchangetext}**` : ""}` } - if (getOption(userID, "arousaldisplay") == "numbers") { + if (getOption(serverID, userID, "arousaldisplay") == "numbers") { bartext = `\n\nšŸ’ž Arousal: **${Math.round(getArousal(serverID, inspectuserID) * 10) / 10}** of **${Math.round(calcDenialCoefficient(serverID, inspectuserID) * 10)}** (${Math.round((getArousal(serverID, inspectuserID) / ((calcDenialCoefficient(serverID, inspectuserID) * 10))) * 100) / 1}%)` } } diff --git a/functions/getters/config/getOutfits.js b/functions/getters/config/getOutfits.js index 69392083..43d1a7fa 100644 --- a/functions/getters/config/getOutfits.js +++ b/functions/getters/config/getOutfits.js @@ -9,7 +9,7 @@ const { getProcessVariable } = require("./getProcessVariable"); *******/ function getOutfits(serverID, userID) { traceFirstParam(arguments[0]); - return getProcessVariable(serverID, userID, "outfits"); + return getProcessVariable(serverID, userID, "outfits") ?? []; } exports.getOutfits = getOutfits; \ No newline at end of file diff --git a/functions/getters/config/getPronouns.js b/functions/getters/config/getPronouns.js index 5467b607..3f8c2e8d 100644 --- a/functions/getters/config/getPronouns.js +++ b/functions/getters/config/getPronouns.js @@ -28,7 +28,7 @@ function getPronouns(serverID, user, form, capitalize = false) { } else { output = pronounsMap.get("they/them")[form]; // If the user has not set pronouns, we should try to send them a DM to have them do so - remindPronouns(user); + remindPronouns(serverID, user); } if (capitalize) { output = output.charAt(0).toUpperCase() + output.slice(1); diff --git a/functions/getters/toy/getSpecificToy.js b/functions/getters/toy/getSpecificToy.js index c4e9aaa3..0c49c30c 100644 --- a/functions/getters/toy/getSpecificToy.js +++ b/functions/getters/toy/getSpecificToy.js @@ -13,8 +13,7 @@ const { getToys } = require("./getToys"); * - intensity: The intensity of the toy 1-20 * - origbinder: The user ID who put the toy on the user **********/ -function getSpecificToy(user, toytype) { - traceFirstParam(arguments[0]); +function getSpecificToy(serverID, user, toytype) { return getToys(serverID, user).find((toy) => toy.type == toytype); } diff --git a/functions/pronounfunctions.js b/functions/pronounfunctions.js index 246af552..4e6a7c40 100644 --- a/functions/pronounfunctions.js +++ b/functions/pronounfunctions.js @@ -2,6 +2,7 @@ const { ButtonBuilder } = require("@discordjs/builders"); const { ButtonStyle, ComponentType } = require("discord.js"); const { ActionRowBuilder } = require("@discordjs/builders"); const { setPronouns } = require("./setters/config/setPronouns.js"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam.js"); async function remindPronouns(serverID, user) { traceFirstParam(arguments[0]); diff --git a/functions/setters/chastity/assignChastity.js b/functions/setters/chastity/assignChastity.js index cf8577b6..6b25d127 100644 --- a/functions/setters/chastity/assignChastity.js +++ b/functions/setters/chastity/assignChastity.js @@ -28,10 +28,10 @@ function assignChastity(serverID, user, keyholder, namedchastity, force = false) // Stop this function immediately if the current chastity belt can't be removed. // If there is none worn, no worries! - if ((oldchastitybase && !oldchastitybase.canUnequip({ userID: user, keyholderID: keyholder })) && !force) { return false }; + if ((oldchastitybase && !oldchastitybase.canUnequip({ serverID: serverID, userID: user, keyholderID: keyholder })) && !force) { return false }; // Call the on unequip for existing chastity if relevant. - if (oldchastitybase) { oldchastitybase.onUnequip({ userID: user, keyholderID: keyholder }) } + if (oldchastitybase) { oldchastitybase.onUnequip({ serverID: serverID, userID: user, keyholderID: keyholder }) } // Assign the new chastity belt to the user process.chastity[serverID][user] = { keyholder: keyholder ? keyholder : "unlocked", timestamp: Date.now(), chastitytype: namedchastity, stateligible: true }; diff --git a/functions/setters/gag/removeGag.js b/functions/setters/gag/removeGag.js index 66c0c667..53504e32 100644 --- a/functions/setters/gag/removeGag.js +++ b/functions/setters/gag/removeGag.js @@ -45,7 +45,7 @@ function deleteGag(serverID, userID, specificgag, force = false) { let loc = process.gags[serverID][userID].findIndex((f) => f.gagtype == specificgag); if (loc > -1) { if (process.gagtypes[process.gags[serverID][userID][loc].gagtype] && process.gagtypes[process.gags[serverID][userID][loc].gagtype].onUnlock) { - process.gagtypes[process.gags[serverID][userID][loc].gagtype].onUnlock({ userID: userID }); + process.gagtypes[process.gags[serverID][userID][loc].gagtype].onUnlock({ serverID: serverID, userID: userID }); } process.gags[serverID][userID].splice(loc, 1); } diff --git a/functions/timefunctions.js b/functions/timefunctions.js index 48969321..1c3e49ad 100644 --- a/functions/timefunctions.js +++ b/functions/timefunctions.js @@ -330,11 +330,16 @@ function runTickEvents() { if (process.gags) { Object.keys(process.gags).forEach((serverid) => { Object.keys(process.gags[serverid]).forEach((userid) => { - getGags(serverid, userid).forEach((g) => { - if (process.eventfunctions.gags && process.eventfunctions.gags[g.gagtype] && process.eventfunctions.gags[g.gagtype].tick) { - process.eventfunctions.gags[g.gagtype].tick(serverid, userid); - } - }); + try { + getGags(serverid, userid).forEach((g) => { + if (process.eventfunctions.gags && process.eventfunctions.gags[g.gagtype] && process.eventfunctions.gags[g.gagtype].tick) { + process.eventfunctions.gags[g.gagtype].tick(serverid, userid); + } + }); + } + catch (err) { + console.log(err); + } }); }); } diff --git a/functions/timelockfunctions.js b/functions/timelockfunctions.js index 4cf0a3ee..7fc6b350 100644 --- a/functions/timelockfunctions.js +++ b/functions/timelockfunctions.js @@ -230,7 +230,8 @@ function checkGagbotKeys() { function gagbotHeldKeyTime(serverID, wearerid, type) { traceFirstParam(arguments[0]); if (process.heldkeytimers == undefined) { process.heldkeytimers = {} } - if (!process.recentmessages[serverID][wearerid]) { return } + if (process.recentmessages[serverID] == undefined) { process.recentmessages[serverID] = {} } + if ((process.recentmessages[serverID] && !process.recentmessages[serverID][wearerid])) { return } if (!process.heldkeytimers[`${serverID}_${wearerid}_${type}`]) { let data = { serverID: serverID, diff --git a/index.js b/index.js index 2d68a10b..fc39e01a 100644 --- a/index.js +++ b/index.js @@ -25,6 +25,7 @@ const { getBotOption } = require('./functions/getters/config/getBotOption.js'); const { getAllJoinedGuilds } = require("./functions/getters/config/getAllJoinedGuilds.js"); const { logConsole } = require('./functions/logfunctions.js'); const { markForSave } = require('./functions/other/markForSave.js'); +const { processdatatoload } = require(`./lists/processdatatoload.js`); // Prevent node from killing us immediately when we do the next line. process.stdin.resume(); @@ -80,33 +81,6 @@ let GagbotSavedFileDirectory = process.env.GAGBOTFILEDIRECTORY ? process.env.GAG process.GagbotSavedFileDirectory = GagbotSavedFileDirectory // Because honestly, I dont know WHY global stuff in index.js can't be accessble everywhere -let processdatatoload = [ - { textname: "gaggedusers.txt", processvar: "gags", default: {}, rts: "gags", hasusers: true }, - { textname: "mittenedusers.txt", processvar: "mitten", default: {}, rts: "mitten", hasusers: true }, - { textname: "chastityusers.txt", processvar: "chastity", default: {}, rts: "chastity", hasusers: true }, - { textname: "chastitybrausers.txt", processvar: "chastitybra", default: {}, rts: "chastitybra", hasusers: true }, - { textname: "toyusers.txt", processvar: "toys", default: {}, rts: "toys", hasusers: true }, - { textname: "collarusers.txt", processvar: "collar", default: {}, rts: "collar", hasusers: true }, - { textname: "heavyusers.txt", processvar: "heavy", default: {}, rts: "heavy", hasusers: true }, - { textname: "pronounsusers.txt", processvar: "pronouns", default: {}, rts: "pronouns", hasusers: true }, - { textname: "usersdata.txt", processvar: "usercontext", default: {}, rts: "usercontext", hasusers: true }, - { textname: "consentusers.txt", processvar: "consented", default: {}, rts: "consented", hasusers: true }, - { textname: "corsetusers.txt", processvar: "corset", default: {}, rts: "corset", hasusers: true }, - { textname: "arousal.txt", processvar: "arousal", default: {}, rts: "arousal", hasusers: true }, - { textname: "headwearusers.txt", processvar: "headwear", default: {}, rts: "headwear", hasusers: true }, - { textname: "discardedkeys.txt", processvar: "discardedKeys", rts: "discardedKeys", default: [] }, - { textname: "configs.txt", processvar: "configs", default: {}, rts: "configs", }, - { textname: "outfits.txt", processvar: "outfits", default: {}, rts: "outfits", }, - { textname: "dollusers.txt", processvar: "dolls", default: {}, rts: "dolls", hasusers: true }, - { textname: "wearables.txt", processvar: "wearable", default: {}, rts: "wearable", hasusers: true }, - { textname: "webhooks.txt", processvar: "webhookstoload", default: {}, rts: "webhooks", }, - { textname: "recordedmessages.txt", processvar: "recordedmessages", default: {}, rts: "recordedmessages", }, - { textname: "delveuserdata.txt", processvar: "delveuserdata", default: {}, rts: "delveuserdata", hasusers: true }, - { textname: "userstats.txt", processvar: "userstats", default: {}, rts: "userstats", hasusers: true }, - { textname: "memberavatars.txt", processvar: "memberavatars", default: {}, rts: "memberavatars", hasusers: true }, - { textname: "heldkeytimers.txt", processvar: "heldkeytimers", default: {}, rts: "heldkeytimers", hasusers: true }, -] - processdatatoload.forEach((s) => { try { if (!fs.existsSync(`${process.GagbotSavedFileDirectory}/${s.textname}`)) { @@ -263,68 +237,6 @@ client.on("clientReady", async () => { generateListTexts(); - // This code will be removed in a later update! This is ONLY intended for startup and should be uncommented if needed for updating - /*await new Promise((res,rej) => { - let guilds = process.client.guilds.cache.map(guild => guild.id) - processdatatoload.forEach(async (pd) => { - try { - if (pd.processvar) { - Object.keys(process[pd.processvar]).forEach(async (user) => { - console.log(`Checking ${user} in ${pd.processvar}`) - let useringuilds = []; - if (!guilds.includes(user) && pd.hasusers) { // This is a USER object! - let inaguild = false; - for (const guildID of guilds) { - let guild = process.client.guilds.cache.get(guildID); - try { - let founduser = await guild.members.fetch(user) - if (founduser) { - if (process[pd.processvar][guildID] == undefined) { process[pd.processvar][guildID] = {} } - let newobj = {}; - //Object.keys(process[pd.processvar][user]).forEach((k) => { - // if (Array.isArray(k)) { - // newobj[k] = [...process[pd.processvar][user][k]] - // } - // else { - // } - //}) - process[pd.processvar][guildID][user] = structuredClone(process[pd.processvar][user]) - inaguild = true; - markForSave(pd.rts) - } - } - catch (err) { - // Not in the guild - logConsole(err, 4) - logConsole(`User ${user} is not in ${guildID}`, 4) - } - } - if (inaguild) { - delete process[pd.processvar][user] - } - else { - console.log(`${pd.processvar}: User ${user} is not in ANY guild, leaving in place`) - } - } - }) - } - } - catch (err) { - console.log(err); - } - }) - setTimeout(() => { - processdatatoload.forEach(async (pd) => { - if (pd.hasusers) { - console.log(process[pd.processvar]); - } - }) - }, 10000) - setTimeout(() => { - res(true) - }, 20000); - })*/ - scavengeUsers(client); setInterval(() => { try { diff --git a/lists/processdatatoload.js b/lists/processdatatoload.js new file mode 100644 index 00000000..e027d9e1 --- /dev/null +++ b/lists/processdatatoload.js @@ -0,0 +1,32 @@ +/******* + * Process data variables called at runtime and referenced for saving + * + *******/ +const processdatatoload = [ + { textname: "gaggedusers.txt", processvar: "gags", default: {}, rts: "gags", hasusers: true }, + { textname: "mittenedusers.txt", processvar: "mitten", default: {}, rts: "mitten", hasusers: true }, + { textname: "chastityusers.txt", processvar: "chastity", default: {}, rts: "chastity", hasusers: true }, + { textname: "chastitybrausers.txt", processvar: "chastitybra", default: {}, rts: "chastitybra", hasusers: true }, + { textname: "toyusers.txt", processvar: "toys", default: {}, rts: "toys", hasusers: true }, + { textname: "collarusers.txt", processvar: "collar", default: {}, rts: "collar", hasusers: true }, + { textname: "heavyusers.txt", processvar: "heavy", default: {}, rts: "heavy", hasusers: true }, + { textname: "pronounsusers.txt", processvar: "pronouns", default: {}, rts: "pronouns", hasusers: true }, + { textname: "usersdata.txt", processvar: "usercontext", default: {}, rts: "usercontext", hasusers: true }, + { textname: "consentusers.txt", processvar: "consented", default: {}, rts: "consented", hasusers: true }, + { textname: "corsetusers.txt", processvar: "corset", default: {}, rts: "corset", hasusers: true }, + { textname: "arousal.txt", processvar: "arousal", default: {}, rts: "arousal", hasusers: true }, + { textname: "headwearusers.txt", processvar: "headwear", default: {}, rts: "headwear", hasusers: true }, + { textname: "discardedkeys.txt", processvar: "discardedKeys", rts: "discardedKeys", default: [] }, + { textname: "configs.txt", processvar: "configs", default: {}, rts: "configs", }, + { textname: "outfits.txt", processvar: "outfits", default: {}, rts: "outfits", }, + { textname: "dollusers.txt", processvar: "dolls", default: {}, rts: "dolls", hasusers: true }, + { textname: "wearables.txt", processvar: "wearable", default: {}, rts: "wearable", hasusers: true }, + { textname: "webhooks.txt", processvar: "webhookstoload", default: {}, rts: "webhooks", }, + { textname: "recordedmessages.txt", processvar: "recordedmessages", default: {}, rts: "recordedmessages", }, + { textname: "delveuserdata.txt", processvar: "delveuserdata", default: {}, rts: "delveuserdata", hasusers: true }, + { textname: "userstats.txt", processvar: "userstats", default: {}, rts: "userstats", hasusers: true }, + { textname: "memberavatars.txt", processvar: "memberavatars", default: {}, rts: "memberavatars", hasusers: true }, + { textname: "heldkeytimers.txt", processvar: "heldkeytimers", default: {}, rts: "heldkeytimers", hasusers: true }, +] + +exports.processdatatoload = processdatatoload; \ No newline at end of file diff --git a/migratedata.js b/migratedata.js new file mode 100644 index 00000000..9368cba4 --- /dev/null +++ b/migratedata.js @@ -0,0 +1,101 @@ +const dotenv = require('dotenv') +dotenv.config() +/********* + * This function should be called in order to read all of the currently saved files and generate new ones in an alternate path. + * Please specify the path below before runtime. This will grab data from .env to run. This migration should only need to be performed once. + * + * Please note, this requires the GUILD MEMBERS privileged intent bit, which is NOT normally needed for running the bot. + * + *********/ +const discord = require('discord.js') +const fs = require(`fs`); +const { processdatatoload } = require('./lists/processdatatoload') + +if (process.env.GAGBOTFILEDIRECTORY === "Z:\\Somewhere\\I\\Belong\\") { process.env.GAGBOTFILEDIRECTORY = "." } +let GagbotSavedFileDirectory = process.env.GAGBOTFILEDIRECTORY ? process.env.GAGBOTFILEDIRECTORY : __dirname + +process.GagbotSavedFileDirectory = GagbotSavedFileDirectory // Because honestly, I dont know WHY global stuff in index.js can't be accessble everywhere + +const newdatapath = `${process.GagbotSavedFileDirectory}/datamigration` + +processdatatoload.forEach((s) => { + try { + if (!fs.existsSync(`${process.GagbotSavedFileDirectory}/${s.textname}`)) { + fs.writeFileSync(`${process.GagbotSavedFileDirectory}/${s.textname}`, JSON.stringify(s.default)) + } + process[s.processvar] = JSON.parse(fs.readFileSync(`${process.GagbotSavedFileDirectory}/${s.textname}`)) + } + catch (err) { + console.log(`Error loading ${s.textname}`) + console.log(err) + } +}) + +const client = new discord.Client({ + intents: [ + discord.GatewayIntentBits.Guilds, + discord.GatewayIntentBits.GuildMessages, + discord.GatewayIntentBits.MessageContent, + discord.GatewayIntentBits.GuildMembers + ] +}) + +client.on("clientReady", async () => { + process.client = client; + await client.application.fetch(); + await client.guilds.fetch(); + console.log(`Bot is owned by user ID ${client?.application?.owner.id}`) + let guildsmapped = client.guilds.cache.map(guild => guild.id); + // First, iterate over each guild, getting a current list of members + for (const guild of client.guilds.cache.values()) { + console.log(guild.id); + let members = await guild.members.fetch(); + let membersmapped = members.map((m) => m.id); + membersmapped.forEach((member) => { + // For each member, check if they have the respective object. + processdatatoload.forEach((pd) => { + if (pd.processvar && pd.hasusers) { + if (!guildsmapped.includes(member) && (process[pd.processvar] && process[pd.processvar][member])) { + if (process[pd.processvar][guild.id] == undefined) { + process[pd.processvar][guild.id] = {}; + } + process[pd.processvar][guild.id][member] = structuredClone(process[pd.processvar][member]) + } + } + }) + // This is a specific fix for configs. + if (process.configs && process.configs.users) { + if (!guildsmapped.includes(member) && process.configs.users[member]) { + if (process.configs.users[guild.id] == undefined) { process.configs.users[guild.id] = {} } + process.configs.users[guild.id][member] = structuredClone(process.configs.users[member]); + } + } + }) + }; + // Second, delete any non-guild ID from our data sets if the target would have users + processdatatoload.forEach((pd) => { + if (pd.processvar && pd.hasusers) { + Object.keys(process[pd.processvar]).forEach((member) => { + if (!guildsmapped.includes(member)) { + delete process[pd.processvar][member]; + } + }) + } + }) + // Thirdly, check process.configs.users for non server user info and trim it. + Object.keys(process.configs.users).forEach((pc) => { + if (!guildsmapped.includes(pc)) { + delete process.configs.users[pc]; + } + }) + // Finally, attempt to save all of the data we loaded. + processdatatoload.forEach((pd) => { + let filepath = `${newdatapath}/${pd.textname}` + fs.writeFileSync(filepath, JSON.stringify(process[pd.processvar])); + }) + console.log(`Completed with migration`) + process.exit(); +}) + + +client.login(process.env.DISCORDBOTTOKEN) \ No newline at end of file From 8100a5e84edf8731c83763e164a058da7545bed3 Mon Sep 17 00:00:00 2001 From: Enraa Date: Tue, 23 Jun 2026 22:04:22 -0700 Subject: [PATCH 43/44] more bug fixing --- commands/chastity.js | 2 +- commands/heavy.js | 2 +- commands/key.js | 2 +- commands/outfit.js | 11 +++- commands/toy.js | 4 +- commands/uncorset.js | 2 +- eventfunctions/collar/collar_struggle.js | 61 ++++++++++--------- eventfunctions/heavy/costumer_mimic.js | 10 ++- eventfunctions/toys/plug_motionsensitive.js | 2 +- functions/dollfunctions.js | 6 +- functions/gagfunctions.js | 3 +- functions/getters/headwear/getHeadwearName.js | 2 +- functions/getters/toy/getToys.js | 2 +- functions/interactivefunctions.js | 2 +- functions/keyfindingfunctions.js | 3 +- functions/messagefunctions.js | 4 ++ lists/processdatatoload.js | 2 +- 17 files changed, 70 insertions(+), 50 deletions(-) diff --git a/commands/chastity.js b/commands/chastity.js index 554f422d..bdd77a2f 100644 --- a/commands/chastity.js +++ b/commands/chastity.js @@ -137,7 +137,7 @@ module.exports = { // Check if the wearer is in an armbinder - if they are, block them. if (!getHeavyBound(interaction.guildId, interaction.user.id, chastityuser.id)) { data.heavy = true; - if (getChastity(chastityuser.id)) { + if (getChastity(interaction.guildId, chastityuser.id)) { // User is in some form of heavy bondage and already has a chastity belt data.chastity = true; interaction.reply(getText(data)); diff --git a/commands/heavy.js b/commands/heavy.js index 5e82e69b..29a5e4bd 100644 --- a/commands/heavy.js +++ b/commands/heavy.js @@ -65,7 +65,7 @@ module.exports = { try { let targetuser = interaction.options.getUser("user") ? interaction.options.getUser("user") : interaction.user; let heavychoice = interaction.options.getString("type") ? interaction.options.getString("type") : "armbinder_latex"; - if ((interaction.user.id == targetuser.id) && (getBaseHeavy(heavychoice).noself)) { + if ((interaction.user.id == targetuser.id) && (getBaseHeavy(heavychoice)?.noself)) { interaction.reply({ content: `You can't bind yourself with that item!`, flags: MessageFlags.Ephemeral }) return; } diff --git a/commands/key.js b/commands/key.js index e9129f8d..76ea249b 100644 --- a/commands/key.js +++ b/commands/key.js @@ -1139,7 +1139,7 @@ module.exports = { } // If the wearer has disabled key loss from fumbling, tell them to leave. - if (getOption(wearertodiscard.id, "keyloss") == "disabled") { + if (getOption(interaction.guildId, wearertodiscard.id, "keyloss") == "disabled") { if (wearertodiscard.id === interaction.user.id) { interaction.reply({ content: `You've disabled key loss from fumbling.`, flags: MessageFlags.Ephemeral }); return; diff --git a/commands/outfit.js b/commands/outfit.js index 672b334e..55ad2ea2 100644 --- a/commands/outfit.js +++ b/commands/outfit.js @@ -52,10 +52,17 @@ module.exports = { } else if (subcommand == "restore") { let outfitslot = interaction.options.getInteger("slot") - if ((outfitslot > -1) && (outfitslot < 20)) { + if (getOutfits(interaction.guildId, interaction.user.id).length == 0) { + await interaction.reply({ content: `Error loading outfits or you have none configured` , flags: MessageFlags.Ephemeral }); + return; + } + else if ((outfitslot > -1) && (outfitslot < 20)) { restoreOutfit(interaction.guildId, interaction.user.id, getOutfits(interaction.guildId, interaction.user.id)[outfitslot]); await interaction.reply({ content: `Reloading Outfit in slot ${outfitslot + 1}...`, flags: MessageFlags.Ephemeral }) } + else { + console.log(`Invalid outfit slot number`) + } } } catch (err) { console.log(err); @@ -80,7 +87,7 @@ module.exports = { } // Equipping an outfit! else if (optionparts[1] == "restoreoutfit") { - restoreOutfit(interaction.guildId, interaction.user.id, getOutfits(interaction.user.id)[optionparts[3]]); + restoreOutfit(interaction.guildId, interaction.user.id, getOutfits(interaction.guildId, interaction.user.id)[optionparts[3]]); await interaction.update(await generateOutfitModal(interaction.guildId, interaction.user.id, "restore", optionparts[2], optionparts[4])); } // Equipping an outfit! diff --git a/commands/toy.js b/commands/toy.js index 58201964..a260a1d3 100644 --- a/commands/toy.js +++ b/commands/toy.js @@ -126,7 +126,7 @@ module.exports = { if (toyuser == interaction.user) { // self data.self = true; - if (getSpecificToy(toyuser.id, toytype)) { + if (getSpecificToy(interaction.guildId, toyuser.id, toytype)) { // toy already on wearer data.toy = true; if (toybase.blocker({ serverID: interaction.guildId, userID: toyuser.id })) { @@ -226,7 +226,7 @@ module.exports = { else { // other data.other = true; - if (getSpecificToy(toyuser.id, toytype)) { + if (getSpecificToy(interaction.guildId, toyuser.id, toytype)) { // toy already on wearer data.toy = true; if (toybase.blocker({ serverID: interaction.guildId, userID: toyuser.id })) { diff --git a/commands/uncorset.js b/commands/uncorset.js index 4483efd2..cefad12b 100644 --- a/commands/uncorset.js +++ b/commands/uncorset.js @@ -35,7 +35,7 @@ module.exports = { interactionuser: interaction.user, targetuser: corsetuser, c1: getHeavy(interaction.guildId, interaction.user.id)?.displayname, // heavy bondage type - c2: getBaseCorset(getCorset(interaction.guildId, corsetuser.id).type)?.name ?? "Leather Corset", // corset type + c2: getBaseCorset(getCorset(interaction.guildId, corsetuser.id)?.type)?.name ?? "Leather Corset", // corset type }, }; diff --git a/eventfunctions/collar/collar_struggle.js b/eventfunctions/collar/collar_struggle.js index 5264395e..e186a828 100644 --- a/eventfunctions/collar/collar_struggle.js +++ b/eventfunctions/collar/collar_struggle.js @@ -64,6 +64,9 @@ exports.tick = async (serverID, userID, data) => { interaction.reply({ content: `Something went wrong with your input. Please let Enraa know with the exact thing you put in the Type field!`, flags: MessageFlags.Ephemeral }) return; }*/ + if (!process.recentmessages[serverID] || (process.recentmessages[serverID][userID] == undefined)) { + return; // Leave if we dont have a server we could send to. + } // This way of doing it is gonna be fucky. // From the top. Lets do an if/else for what kind we chose @@ -72,28 +75,28 @@ exports.tick = async (serverID, userID, data) => { data.heavy = true; // Heavy Bondage is... pretty uniquely only influenced by itself. // It will also only ever have named bondage. - messageSendChannel(getText(data), process.recentmessages[userID]) + messageSendChannel(getText(data), process.recentmessages[serverID][userID]) } else if (chosenopt == "gag" && gagbondage) { data.gag = true; // Gags are influenced by heavy bondage or mittens. if (heavybondage) { // Heavy Bondage is disabling. data.heavy = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { data.noheavy = true; if (mittenbondage || Math.random() > 0.5) { // Either mittened, or not using fingers or similar data.nofingers = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else if (mittenbondage && Math.random() > 0.5) { // Mittened and random chance! data.mitten = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { // No mittens and ABLE TO USE FINGERS! data.nomitten = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } } } else if (chosenopt == "mitten" && mittenbondage) { @@ -104,21 +107,21 @@ exports.tick = async (serverID, userID, data) => { if (heavybondage) { // Heavy Bondage is disabling. data.heavy = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { data.noheavy = true; if (gagbondage || Math.random() > 0.5) { // Either gagged, or not using teeth data.nomouth = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else if (gagbondage && Math.random() > 0.5) { // Gagged and random chance! data.gag = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { // No gag and ABLE TO USE TEETH! data.mouth = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } } } else if (chosenopt == "chastity" && chastitybondage) { @@ -128,22 +131,22 @@ exports.tick = async (serverID, userID, data) => { if (heavybondage) { // Heavy Bondage is disabling. data.heavy = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { // Because the number of responses vary so much, going to use 33% chance for mitten/finger text data.noheavy = true; if (mittenbondage || Math.random() > 0.33) { // Either mittened, or not using fingers or similar data.nofingers = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else if (mittenbondage && Math.random() > 0.66) { // Mittened and random chance! data.mitten = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { // No mittens and ABLE TO USE FINGERS! data.nomitten = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } } } else if (chosenopt == "chastitybra" && chastitybrabondage) { @@ -153,22 +156,22 @@ exports.tick = async (serverID, userID, data) => { if (heavybondage) { // Heavy Bondage is disabling. data.heavy = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { // Because the number of responses vary so much, going to use 33% chance for mitten/finger text data.noheavy = true; if (mittenbondage || Math.random() > 0.5) { // Either mittened, or not using fingers or similar data.nofingers = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else if (mittenbondage && Math.random() > 0.5) { // Mittened and random chance! data.mitten = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { // No mittens and ABLE TO USE FINGERS! data.nomitten = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } } } else if (chosenopt == "head" && headbondage.length > 0) { @@ -178,21 +181,21 @@ exports.tick = async (serverID, userID, data) => { if (heavybondage) { // Heavy Bondage is disabling. data.heavy = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { data.noheavy = true; if (mittenbondage || Math.random() > 0.5) { // Either mittened, or not using fingers or similar data.nofingers = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else if (mittenbondage && Math.random() > 0.5) { // Mittened and random chance! data.mitten = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { // No mittens and ABLE TO USE FINGERS! data.nomitten = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } } } else if (chosenopt == "corset" && corsetbondage) { @@ -202,21 +205,21 @@ exports.tick = async (serverID, userID, data) => { if (heavybondage) { // Heavy Bondage is disabling. data.heavy = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { data.noheavy = true; if (mittenbondage || Math.random() > 0.5) { // Either mittened, or not using fingers or similar data.nofingers = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else if (mittenbondage && Math.random() > 0.5) { // Mittened and random chance! data.mitten = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { // No mittens and ABLE TO USE FINGERS! data.nomitten = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } } } else if (chosenopt == "collar" && collarbondage) { @@ -226,21 +229,21 @@ exports.tick = async (serverID, userID, data) => { if (heavybondage) { // Heavy Bondage is disabling. data.heavy = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { data.noheavy = true; if (mittenbondage || Math.random() > 0.5) { // Either mittened, or not using fingers or similar data.nofingers = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else if (mittenbondage && Math.random() > 0.5) { // Mittened and random chance! data.mitten = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } else { // No mittens and ABLE TO USE FINGERS! data.nomitten = true; - messageSendChannel(getText(data), process.recentmessages[userID]); + messageSendChannel(getText(data), process.recentmessages[serverID][userID]); } } } diff --git a/eventfunctions/heavy/costumer_mimic.js b/eventfunctions/heavy/costumer_mimic.js index 7f5eff25..063a7d02 100644 --- a/eventfunctions/heavy/costumer_mimic.js +++ b/eventfunctions/heavy/costumer_mimic.js @@ -12,6 +12,7 @@ const { getHeadwearName } = require("../../functions/getters/headwear/getHeadwea const { getHeavy } = require("../../functions/getters/heavy/getHeavy.js"); const { getMitten } = require("../../functions/getters/mitten/getMitten.js"); const { getMittenName } = require("../../functions/getters/mitten/getMittenName.js"); +const { getToys } = require("../../functions/getters/toy/getToys.js"); const { getLockedWearable } = require("../../functions/getters/wearable/getLockedWearable.js"); const { getWearable } = require("../../functions/getters/wearable/getWearable.js"); const { getWearableName } = require("../../functions/getters/wearable/getWearableName.js"); @@ -26,6 +27,7 @@ const { assignHeadwear } = require("../../functions/setters/headwear/assignHeadw const { assignHeavy } = require("../../functions/setters/heavy/assignHeavy.js"); const { removeHeavy } = require("../../functions/setters/heavy/removeHeavy.js"); const { assignMitten } = require("../../functions/setters/mitten/assignMitten.js"); +const { assignToy } = require("../../functions/setters/toy/assignToy.js"); const { assignWearable } = require("../../functions/setters/wearable/assignWearable.js"); const { deleteWearable } = require("../../functions/setters/wearable/removeWearable.js"); const { getText } = require("../../functions/textfunctions.js"); @@ -567,9 +569,9 @@ let tick = async (serverID, userID, datain) => { if (!getMitten(serverID, userID) || (getMitten(serverID, userID) && (getMitten(serverID, userID).getMittenName != nextitem.itemtowear))) { data.mitten = true; if (getMitten(serverID, userID)) { - data.textdata.c1 = getMittenName(serverID, undefined, getMitten(userID).mittenname) ?? "mittens", // mitten name + data.textdata.c1 = getMittenName(serverID, undefined, getMitten(serverID, userID).mittenname) ?? "mittens", // mitten name data.textdata.c2 = getMittenName(serverID, undefined, nextitem.itemtowear), // new mitten name - assignMitten(serverID, userID, nextitem.itemtowear, getMitten(userID).origbinder) + assignMitten(serverID, userID, nextitem.itemtowear, getMitten(serverID, userID).origbinder) data.replace = true; } @@ -613,7 +615,7 @@ let tick = async (serverID, userID, datain) => { if (!getChastityBra(serverID, userID) || (getChastityBra(serverID, userID) && (getChastityBra(serverID, userID).getChastityBraName != nextitem.itemtowear))) { data.chastitybra = true; if (getChastityBra(serverID, userID)) { - data.textdata.c1 = getChastityBraName(serverID, undefined, getChastityBra(userID).getChastityBraName) ?? "chastity bra", // chastity bra name + data.textdata.c1 = getChastityBraName(serverID, undefined, getChastityBra(serverID, userID).getChastityBraName) ?? "chastity bra", // chastity bra name data.textdata.c2 = getChastityBraName(serverID, undefined, nextitem.itemtowear), // new chastity bra name // Update Chastity Bra Name with new type @@ -704,8 +706,10 @@ let tick = async (serverID, userID, datain) => { if (getProcessVariable(serverID, userID, "userevents").costumermimic.costumeidx >= mimicCostumes[getProcessVariable(serverID, userID, "userevents").costumermimic.outfit].length) { // Remove Current Heavy (Mimic) if end of Costume Array Reached Without End Marker let data = { + serverID: serverID, textarray: "texts_eventfunctions", textdata: { + serverID: serverID, interactionuser: userobject, targetuser: targetobject, } diff --git a/eventfunctions/toys/plug_motionsensitive.js b/eventfunctions/toys/plug_motionsensitive.js index 596cf3d9..dcf2705a 100644 --- a/eventfunctions/toys/plug_motionsensitive.js +++ b/eventfunctions/toys/plug_motionsensitive.js @@ -4,7 +4,7 @@ const { messageSendChannel } = require("../../functions/messagefunctions"); const { setUserVar } = require("../../functions/setters/config/setUserVar"); function msgfunction(serverID, userid, data) { - if (getUserVar(userid, "motionplugtime") == undefined) { + if (getUserVar(serverID, userid, "motionplugtime") == undefined) { if (process.recentmessages[serverID] && process.recentmessages[serverID][userid]) { try { messageSendChannel(`<@${userid}>'s movement turns on ${getPronouns(serverID, userid, "possessiveDeterminer")} Motion Sensitive Plug!`, process.recentmessages[serverID][userid]) diff --git a/functions/dollfunctions.js b/functions/dollfunctions.js index db839fe7..50be35a4 100644 --- a/functions/dollfunctions.js +++ b/functions/dollfunctions.js @@ -444,7 +444,7 @@ async function textGarbleDOLL(msg, modifiedmessage, outtextin) { if ((dollProtocolViolations > 0 || warnmodified) && i == lastDollifiedMessage) { let totalViolations = dollProtocolViolations; if (dollProtocolLevel != "warning") { - totalViolations = dollProtocolViolations + process.dolls[msg.guild.id, msg.author.id].violations; + totalViolations = dollProtocolViolations + (process.dolls[msg.guild.id, msg.author.id]?.violations ?? 0); } // WARN if below punishment threshold. ERROR if exceeded. @@ -473,9 +473,9 @@ async function textGarbleDOLL(msg, modifiedmessage, outtextin) { let goodDollReturn = rewardDoll(msg.guild.id, msg.author.id); //console.log(goodDollReturn) if (goodDollReturn == "violation") { - dollMessageParts[i].text += `\nALERT: Protocol Violation count decremented to (${process.dolls[msg.author.id].violations}/${dollPunishThresh}). It is a Good Doll.`; + dollMessageParts[i].text += `\nALERT: Protocol Violation count decremented to (${process.dolls[msg.guild.id][msg.author.id].violations}/${dollPunishThresh}). It is a Good Doll.`; } else if (goodDollReturn == "punishlevel") { - dollMessageParts[i].text += `\nALERT: Punishment Level decremented to (${process.dolls[msg.author.id].punishmentLevel}/${DOLLMAXPUNISHMENT}). It is a Good Doll.`; + dollMessageParts[i].text += `\nALERT: Punishment Level decremented to (${process.dolls[msg.guild.id][msg.author.id].punishmentLevel}/${DOLLMAXPUNISHMENT}). It is a Good Doll.`; } } // Finish the codeblock diff --git a/functions/gagfunctions.js b/functions/gagfunctions.js index dc2ce3ff..0301361a 100644 --- a/functions/gagfunctions.js +++ b/functions/gagfunctions.js @@ -28,6 +28,7 @@ const { markForSave } = require("./other/markForSave.js"); const { setUserVar } = require("./setters/config/setUserVar.js"); const { getGags } = require("./getters/gag/getGags.js"); const { statsAddCounter } = require("./setters/config/statsAddCounter.js"); +const { traceFirstParam } = require("./other/TESTS/traceFirstParam.js"); // Grab all the command files from the commands directory const gagtypes = []; @@ -105,7 +106,7 @@ function punishDoll(serverID, userID, amount) { console.log("BAD DOLL:"); console.log(process.dolls[serverID][userID]); // Compute punishments by dividing violations by punishThresh. - let punishThresh = getOption(userID, "dollpunishthresh"); + let punishThresh = getOption(serverID, userID, "dollpunishthresh"); if (getHeadwear(serverID, userID).find((headwear) => headwear === "dollmaker_visor")) { punishThresh = 2; // Forced to 2 if dollmakers visor } diff --git a/functions/getters/headwear/getHeadwearName.js b/functions/getters/headwear/getHeadwearName.js index d458c5ff..45f3af48 100644 --- a/functions/getters/headwear/getHeadwearName.js +++ b/functions/getters/headwear/getHeadwearName.js @@ -18,7 +18,7 @@ function getHeadwearName(serverID, userID, headnname) { process.headwear = {}; } if (headnname) { - return getBaseHeadwear(headnname).name + return getBaseHeadwear(headnname)?.name } else { return undefined; diff --git a/functions/getters/toy/getToys.js b/functions/getters/toy/getToys.js index d0ed05b2..02e03dd2 100644 --- a/functions/getters/toy/getToys.js +++ b/functions/getters/toy/getToys.js @@ -14,7 +14,7 @@ const { getProcessVariable } = require("../config/getProcessVariable"); **********/ function getToys(serverID, user) { traceFirstParam(arguments[0]); - return getProcessVariable(serverID, user, "toys"); + return getProcessVariable(serverID, user, "toys") ?? []; } exports.getToys = getToys; \ No newline at end of file diff --git a/functions/interactivefunctions.js b/functions/interactivefunctions.js index 0b3a1acb..0a98fa45 100644 --- a/functions/interactivefunctions.js +++ b/functions/interactivefunctions.js @@ -74,7 +74,7 @@ const handleConsent = async (interaction, user) => { try { const confirmation = await response.resource.message.awaitMessageComponent({ filter: collectorFilter, time: 300_000 }); console.log(confirmation); - assignConsent(interaction.guildID, testusertarget); + assignConsent(interaction.guildId, testusertarget); await interaction.editReply({ content: `Consent form agreed to by <@${testusertarget}>! Please re-run the command to tie!`, components: [] }); } catch (err) { console.log(err); diff --git a/functions/keyfindingfunctions.js b/functions/keyfindingfunctions.js index c18b9614..aa2c11ea 100644 --- a/functions/keyfindingfunctions.js +++ b/functions/keyfindingfunctions.js @@ -157,6 +157,7 @@ async function handleKeyFinding(message) { chance = Math.min(chance, 0.25) } let data = { + serverID: message.guild.id, interactionuser: message.member, targetuser: weareruser } @@ -218,7 +219,7 @@ async function handleKeyFinding(message) { process[pv][message.guild.id][en[0]].temporarykeyholder = message.member.id; process[pv][message.guild.id][en[0]].temporarykeyholdertime = (Date.now() + getOption(message.guild.id, en[0], "ownrestraintfindkeymode")) } - statsAddCounter(message.member.id, "fumbledkeysrecovered") + statsAddCounter(message.guild.id, message.member.id, "fumbledkeysrecovered") markForSave("collar"); markForSave("chastity"); markForSave("chastitybra"); diff --git a/functions/messagefunctions.js b/functions/messagefunctions.js index 58a7eaf8..f41c7917 100644 --- a/functions/messagefunctions.js +++ b/functions/messagefunctions.js @@ -128,6 +128,10 @@ const messageSendImg = async (msg, str, avatarURL, username, threadId, attachs, // Please god don't send to an invalid place I can't take it anymore const messageSendChannel = async (str, channel, components = []) => { try { + if (channel == undefined) { + throw new Error; + return; + } let channeltosendto = await process.client.channels.fetch(channel); if (channeltosendto) { if (channeltosendto.isSendable() && !channeltosendto.archived && !channeltosendto.locked) { diff --git a/lists/processdatatoload.js b/lists/processdatatoload.js index e027d9e1..fe9218bc 100644 --- a/lists/processdatatoload.js +++ b/lists/processdatatoload.js @@ -18,7 +18,7 @@ const processdatatoload = [ { textname: "headwearusers.txt", processvar: "headwear", default: {}, rts: "headwear", hasusers: true }, { textname: "discardedkeys.txt", processvar: "discardedKeys", rts: "discardedKeys", default: [] }, { textname: "configs.txt", processvar: "configs", default: {}, rts: "configs", }, - { textname: "outfits.txt", processvar: "outfits", default: {}, rts: "outfits", }, + { textname: "outfits.txt", processvar: "outfits", default: {}, rts: "outfits", hasusers:true }, { textname: "dollusers.txt", processvar: "dolls", default: {}, rts: "dolls", hasusers: true }, { textname: "wearables.txt", processvar: "wearable", default: {}, rts: "wearable", hasusers: true }, { textname: "webhooks.txt", processvar: "webhookstoload", default: {}, rts: "webhooks", }, From 8ce13d962c9b715a49069f87a2e6a41f99a4822b Mon Sep 17 00:00:00 2001 From: Enraa Date: Tue, 23 Jun 2026 23:25:53 -0700 Subject: [PATCH 44/44] headpat slut --- functions/getters/config/getAlternateName.js | 1 - gags/headpatslut.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/getters/config/getAlternateName.js b/functions/getters/config/getAlternateName.js index b7ee5e3f..4e59cb2d 100644 --- a/functions/getters/config/getAlternateName.js +++ b/functions/getters/config/getAlternateName.js @@ -18,7 +18,6 @@ function getAlternateName(serverID, user) { let outname = user.displayName // We're putting a member object in here // Handle pet collar name if ((getCollar(serverID, user.id)?.collartype == "collarengraved") || (getCollar(serverID, user.id) && getCollar(serverID, user.id).additionalcollars && getCollar(serverID, user.id).additionalcollars.includes("collarengraved"))) { - console.log(getOption(serverID, user.id, "engravedcollarname")) if (getOption(serverID, user.id, "engravedcollarname") && getOption(serverID, user.id, "engravedcollarname").length > 0) { outname = getOption(serverID, user.id, "engravedcollarname"); } diff --git a/gags/headpatslut.js b/gags/headpatslut.js index 343d11c2..74f98f55 100644 --- a/gags/headpatslut.js +++ b/gags/headpatslut.js @@ -11,7 +11,7 @@ const headpatlines = [ ] const messagebegin = (msg, msgTree, msgTreeMods, intensity) => { - if (!getUserVar(msg.author.id, "headpatslutgag")) { + if (!getUserVar(msg.guild.id, msg.author.id, "headpatslutgag")) { let silenced = {"isSilenced": false, id: msg.author.id, guildid: msg.guild.id } msgTree.callFunc(garble,true,["rawText","moan"],[silenced]) // Run a function on the tree. msgTreeMods.modified = true;