mise à jour de la fonction 8ball

This commit is contained in:
Nemo 2021-11-09 17:31:49 +01:00
parent e685700791
commit b2a377916d

View File

@ -1,4 +1,4 @@
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder, userMention, bold, italic, underscore, spoiler, quote, blockQuote } = require('@discordjs/builders');
const responses = [ const responses = [
"Pas régulièrement.", "Pas régulièrement.",
@ -42,10 +42,19 @@ const responses = [
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('8ball') .setName('8ball')
.setDescription('Replies with the right answer. Sometime.'), .setDescription('Replies with the right answer. Sometime.')
.addStringOption(option =>
option.setName('question')
.setDescription('La question que vous souhaitez poser à Billy')
.setRequired(true)
),
async execute(interaction) { async execute(interaction) {
const question = interaction.options.get('question').value;
const i = Math.floor(Math.random() * responses.length); const i = Math.floor(Math.random() * responses.length);
const reply = responses[i]; const reply = "*" + interaction.user.username + " a demandé : " + question + "*\n" + quote( responses[i] ) ;
await interaction.reply(reply); //const reply = responses[i] + "\n >>> " + question;
await interaction.reply(reply)
.then(console.log("Reply sent to 8ball command."))
.catch(console.error);
}, },
}; };