UNPKG

dellusofbot

Version:

💋💖crée ton propre bot discord simplement en js 💖🤍 - package de retour en développement

50 lines (43 loc) 1.41 kB
module.exports = { name: 'rps', description: 'Joue à pierre papier ciseaux', aliases: ['shifumi', 'ppc'], usage: '[pierre/papier/ciseaux]', args: true, execute(message, args) { const choices = ['pierre', 'papier', 'ciseaux']; const playerChoice = args[0].toLowerCase(); if (!choices.includes(playerChoice)) { return message.reply('❌ Choix invalide! Utilisez: pierre, papier, ou ciseaux'); } const botChoice = choices[Math.floor(Math.random() * choices.length)]; let result; let color; if (playerChoice === botChoice) { result = "Égalité ! 🤝"; color = 0xffff00; } else if ( (playerChoice === 'pierre' && botChoice === 'ciseaux') || (playerChoice === 'papier' && botChoice === 'pierre') || (playerChoice === 'ciseaux' && botChoice === 'papier') ) { result = "Vous gagnez ! 🎉"; color = 0x00ff00; } else { result = "Vous perdez ! 😢"; color = 0xff0000; } const embed = { color: color, title: '✂️ Pierre, Papier, Ciseaux', description: result, fields: [ { name: 'Votre choix', value: playerChoice, inline: true }, { name: 'Choix du bot', value: botChoice, inline: true } ], footer: { text: 'Dellusofbot - Mini Jeux' }, timestamp: new Date() }; message.channel.send({ embed }); }, };