mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-03 23:36:35 +02:00
32 lines
923 B
JavaScript
32 lines
923 B
JavaScript
const { EmbedBuilder } = require("discord.js");
|
|
|
|
module.exports = {
|
|
name: 'calcul',
|
|
description: 'Calcul a math problem',
|
|
emote: '🔍',
|
|
utilisation: 'calcul <math problem>',
|
|
category: 'utils',
|
|
|
|
async execute(message, args, client) {
|
|
const problem = args.join(' ');
|
|
|
|
if (!problem) {
|
|
return message.reply('Veuillez spécifier un problème mathématique');
|
|
}
|
|
|
|
let result;
|
|
try {
|
|
result = eval(problem);
|
|
} catch (error) {
|
|
return message.reply('Veuillez spécifier un problème mathématique valide');
|
|
}
|
|
|
|
const embed = new EmbedBuilder()
|
|
.setTitle('Calculateur de mathématiques')
|
|
.setDescription(`Calcul :\n\`\`\`${problem}\`\`\`\nRésultat :\`\`\`${result}\`\`\``)
|
|
.setFooter({ text: `Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() })
|
|
.setTimestamp();
|
|
|
|
message.channel.send({ embeds: [embed] });
|
|
},
|
|
}; |