This commit is contained in:
2025-07-14 01:01:58 +02:00
commit f16bf39250
9 changed files with 459 additions and 0 deletions

43
commands/howlucky.js Normal file
View File

@ -0,0 +1,43 @@
const { SlashCommandBuilder, SlashCommandNumberOption } = require("discord.js");
let tries = (module.exports = {
data: new SlashCommandBuilder()
.setName("howlucky")
.setDescription("How lucky are you?")
.addNumberOption(
new SlashCommandNumberOption()
.setName("tries")
.setDescription("how many tries you have")
.setRequired(true)
.setMinValue(1)
)
.addStringOption((option) =>
option
.setName("probability")
.setDescription("you can guess")
.setRequired(true)
),
async execute(interaction) {
let probabilitylowernum;
if (interaction.options.getString("probability").split("/")[1] == null) {
probabilitylowernum = parseInt(
interaction.options.getString("probability")
);
} else {
probabilitylowernum = parseInt(
interaction.options.getString("probability").split("/")[1]
);
}
let result =
(interaction.options.getNumber("tries") / probabilitylowernum) * 100;
await interaction.reply(
`With a drop chance of ${interaction.options.getString(
"probability"
)}, getting a drop within ${interaction.options.getNumber(
"tries"
)} tries has a **${
Math.round(result * 100) / 100
}%** chance of happening.`
);
},
});