mirror of
https://github.com/arthur-pbty/LazyBot.git
synced 2026-06-03 23:36:37 +02:00
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
const addCommand = require("../../fonctions/addCommand");
|
|
const { EmbedBuilder } = require("discord.js");
|
|
|
|
module.exports = addCommand({
|
|
name: "coinflip",
|
|
description: "Lance une pièce (pile ou face).",
|
|
aliases: ["cf", "flip", "piece"],
|
|
permissions: [],
|
|
botOwnerOnly: false,
|
|
dm: true,
|
|
scope: "global",
|
|
|
|
slashOptions: [],
|
|
|
|
executePrefix: async (client, message, args) => {
|
|
const embed = createCoinflipEmbed(message.author);
|
|
await message.reply({ embeds: [embed] });
|
|
},
|
|
|
|
executeSlash: async (client, interaction) => {
|
|
const embed = createCoinflipEmbed(interaction.user);
|
|
await interaction.reply({ embeds: [embed] });
|
|
},
|
|
});
|
|
|
|
function createCoinflipEmbed(user) {
|
|
const result = Math.random() < 0.5 ? "pile" : "face";
|
|
const emoji = result === "pile" ? "🪙" : "💿";
|
|
|
|
return new EmbedBuilder()
|
|
.setColor(result === "pile" ? 0xFEE75C : 0x5865F2)
|
|
.setTitle(`${emoji} Coinflip`)
|
|
.setDescription(`La pièce est tombée sur **${result.toUpperCase()}** !`)
|
|
.setFooter({ text: `Lancé par ${user.username}`, iconURL: user.displayAvatarURL({ dynamic: true }) })
|
|
.setTimestamp();
|
|
}
|