refactored and moved

This commit is contained in:
DeSqBlocki
2026-08-18 20:07:41 +02:00
parent b9a887259a
commit 0f48f09bd9
34 changed files with 3218 additions and 2943 deletions
+88 -11
View File
@@ -7,11 +7,19 @@ const {
const {
getCookieBalance,
getCooldown,
getUnixTime,
temporaryEphemeralReply
} = require(
"../../utils/cookieEconomy"
);
const {
HEIST_COOLDOWN
} = require(
"../../utils/cookieHeist"
);
module.exports = {
name:
@@ -19,6 +27,10 @@ module.exports = {
async execute(interaction) {
/*
* Verify ownership of the Crumb Saucer menu.
*/
const footer =
interaction.message
.embeds[0]
@@ -30,17 +42,13 @@ module.exports = {
type,
ownerId
] =
footer
?.split(":")
??
[];
footer?.split(":")
?? [];
if (
type !==
"crumbSaucer" ||
ownerId !==
interaction.user.id
type !== "crumbSaucer" ||
ownerId !== interaction.user.id
) {
return temporaryEphemeralReply(
interaction,
@@ -52,6 +60,43 @@ module.exports = {
}
/*
* ====================================================
* SHARED HEIST COOLDOWN PRE-CHECK
* ====================================================
*/
const now =
getUnixTime();
const cooldown =
await getCooldown(
interaction.user.id,
interaction.guildId,
"heist"
);
if (
cooldown >
now
) {
return temporaryEphemeralReply(
interaction,
{
content:
`🏦 The ShaiBot Vault is still on alert.\nYou can attempt another heist <t:${cooldown}:R>.`
},
6000
);
}
/*
* Balances
*/
const vaultId =
interaction.client.user.id;
@@ -72,7 +117,8 @@ module.exports = {
if (
player < 1
player <
1
) {
return temporaryEphemeralReply(
interaction,
@@ -85,7 +131,8 @@ module.exports = {
if (
vault < 1
vault <
1
) {
return temporaryEphemeralReply(
interaction,
@@ -97,11 +144,16 @@ module.exports = {
}
/*
* Heist menu
*/
const embed =
new EmbedBuilder()
.setTitle(
"🏦 ShaiBot Cookie Vault"
)
.setDescription(
[
`**Vault Balance:** ${vault.toLocaleString()} 🍪`,
@@ -119,6 +171,7 @@ module.exports = {
"Low chance • Large haul • Large fine"
].join("\n")
)
.setFooter({
text:
`cookieHeist:${interaction.user.id}`
@@ -172,19 +225,43 @@ module.exports = {
);
const backButton =
new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId(
"crumbSaucerBack"
)
.setLabel(
"Back to Crumb Saucer"
)
.setEmoji(
"◀️"
)
.setStyle(
ButtonStyle.Secondary
)
);
return interaction.update({
embeds: [
embed
],
components: [
heistButtons
heistButtons,
backButton
]
});
}
};
/*
* SECURITY LABEL
*/
function getSecurityLabel(
vault
) {