mirror of
https://github.com/arthur-pbty/LazyBot.git
synced 2026-06-14 07:58:13 +02:00
add some utilities commands
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user