mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-03 23:36:35 +02:00
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
const { EmbedBuilder} = require('discord.js');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
module.exports = {
|
|
name: 'random',
|
|
aliases: ['rand'],
|
|
description: 'Affiche un nombre aléatoire entre 2 nombres donnés',
|
|
emote: '🎲',
|
|
utilisation: 'random [min] [max]',
|
|
category: 'utils',
|
|
|
|
async execute(message, args, client) {
|
|
if (!args[0] || !args[1]) {
|
|
return message.reply('Veuillez spécifier 2 nombres.');
|
|
}
|
|
if (isNaN(args[0]) || isNaN(args[1])) {
|
|
return message.reply('Veuillez spécifier des nombres valides.');
|
|
}
|
|
const min = Math.ceil(args[0]);
|
|
const max = Math.floor(args[1]);
|
|
const random = Math.floor(Math.random() * (max - min + 1)) + min;
|
|
const embed = new EmbedBuilder()
|
|
.setTitle('Nombre aléatoire')
|
|
.setDescription(`Le nombre aléatoire entre \`${min}\` et \`${max}\` est : \`\`\`${random}\`\`\``)
|
|
.setColor('#0099ff')
|
|
.setTimestamp()
|
|
.setFooter({text: `${client.user.tag} © 2024`, iconURL: client.user.displayAvatarURL({dynamic: true})})
|
|
|
|
message.reply({ embeds: [embed] });
|
|
},
|
|
}; |