boos crumble snapshot
This commit is contained in:
@@ -0,0 +1,224 @@
|
||||
const {
|
||||
EmbedBuilder,
|
||||
ActionRowBuilder,
|
||||
ButtonBuilder,
|
||||
ButtonStyle
|
||||
} = require("discord.js");
|
||||
|
||||
const {
|
||||
getCookieBalance,
|
||||
temporaryEphemeralReply
|
||||
} = require(
|
||||
"../../utils/cookieEconomy"
|
||||
);
|
||||
|
||||
|
||||
module.exports = {
|
||||
name:
|
||||
"crumbSaucerHeist",
|
||||
|
||||
|
||||
async execute(interaction) {
|
||||
const footer =
|
||||
interaction.message
|
||||
.embeds[0]
|
||||
?.footer
|
||||
?.text;
|
||||
|
||||
|
||||
const [
|
||||
type,
|
||||
ownerId
|
||||
] =
|
||||
footer
|
||||
?.split(":")
|
||||
??
|
||||
[];
|
||||
|
||||
|
||||
if (
|
||||
type !==
|
||||
"crumbSaucer" ||
|
||||
ownerId !==
|
||||
interaction.user.id
|
||||
) {
|
||||
return temporaryEphemeralReply(
|
||||
interaction,
|
||||
{
|
||||
content:
|
||||
"This isn't your Crumb Saucer session."
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const vaultId =
|
||||
interaction.client.user.id;
|
||||
|
||||
|
||||
const [
|
||||
vault,
|
||||
player
|
||||
] =
|
||||
await Promise.all([
|
||||
getCookieBalance(
|
||||
vaultId
|
||||
),
|
||||
|
||||
getCookieBalance(
|
||||
interaction.user.id
|
||||
)
|
||||
]);
|
||||
|
||||
|
||||
if (
|
||||
player < 1
|
||||
) {
|
||||
return temporaryEphemeralReply(
|
||||
interaction,
|
||||
{
|
||||
content:
|
||||
"You need at least **1 Cookie** before attempting a vault heist."
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (
|
||||
vault < 1
|
||||
) {
|
||||
return temporaryEphemeralReply(
|
||||
interaction,
|
||||
{
|
||||
content:
|
||||
"The ShaiBot Vault is currently empty."
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const embed =
|
||||
new EmbedBuilder()
|
||||
.setTitle(
|
||||
"🏦 ShaiBot Cookie Vault"
|
||||
)
|
||||
.setDescription(
|
||||
[
|
||||
`**Vault Balance:** ${vault.toLocaleString()} 🍪`,
|
||||
`**Security:** ${getSecurityLabel(vault)}`,
|
||||
"",
|
||||
"Choose your approach.",
|
||||
"",
|
||||
"🥷 **Sneak**",
|
||||
"High chance • Small haul • Small fine",
|
||||
"",
|
||||
"💻 **Hack**",
|
||||
"Medium chance • Medium haul • Medium fine",
|
||||
"",
|
||||
"💥 **Smash**",
|
||||
"Low chance • Large haul • Large fine"
|
||||
].join("\n")
|
||||
)
|
||||
.setFooter({
|
||||
text:
|
||||
`cookieHeist:${interaction.user.id}`
|
||||
});
|
||||
|
||||
|
||||
const heistButtons =
|
||||
new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(
|
||||
"cookieHeistSneak"
|
||||
)
|
||||
.setLabel(
|
||||
"Sneak"
|
||||
)
|
||||
.setEmoji(
|
||||
"🥷"
|
||||
)
|
||||
.setStyle(
|
||||
ButtonStyle.Primary
|
||||
),
|
||||
|
||||
new ButtonBuilder()
|
||||
.setCustomId(
|
||||
"cookieHeistHack"
|
||||
)
|
||||
.setLabel(
|
||||
"Hack"
|
||||
)
|
||||
.setEmoji(
|
||||
"💻"
|
||||
)
|
||||
.setStyle(
|
||||
ButtonStyle.Secondary
|
||||
),
|
||||
|
||||
new ButtonBuilder()
|
||||
.setCustomId(
|
||||
"cookieHeistSmash"
|
||||
)
|
||||
.setLabel(
|
||||
"Smash"
|
||||
)
|
||||
.setEmoji(
|
||||
"💥"
|
||||
)
|
||||
.setStyle(
|
||||
ButtonStyle.Danger
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
return interaction.update({
|
||||
embeds: [
|
||||
embed
|
||||
],
|
||||
|
||||
components: [
|
||||
heistButtons
|
||||
]
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function getSecurityLabel(
|
||||
vault
|
||||
) {
|
||||
if (
|
||||
vault <
|
||||
1000
|
||||
) {
|
||||
return "🟢 Low";
|
||||
}
|
||||
|
||||
|
||||
if (
|
||||
vault <
|
||||
10000
|
||||
) {
|
||||
return "🟡 Moderate";
|
||||
}
|
||||
|
||||
|
||||
if (
|
||||
vault <
|
||||
50000
|
||||
) {
|
||||
return "🟠 High";
|
||||
}
|
||||
|
||||
|
||||
if (
|
||||
vault <
|
||||
250000
|
||||
) {
|
||||
return "🔴 Very High";
|
||||
}
|
||||
|
||||
|
||||
return "🟣 Maximum";
|
||||
}
|
||||
Reference in New Issue
Block a user