Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.64 KB | None | 0 0
  1. client.on("message", async (message) => {
  2.  
  3.     if (message.content === prefix + "pfc") {
  4.  
  5.         const authorID = message.author.id;
  6.  
  7.         const filter = (reaction, user) =>
  8.  
  9.             user.id === authorID && (
  10.  
  11.                 reaction.emoji.name === "🗿" ||
  12.  
  13.                 reaction.emoji.name === "📰" ||
  14.  
  15.                 reaction.emoji.name === "✂"
  16.  
  17.             );
  18.  
  19.     
  20.  
  21.         try {
  22.  
  23.             const messagePfc = await message.channel.send("Pierre Feuille ou Ciseaux ?");
  24.  
  25.             await messagePfc.react("🗿");
  26.  
  27.             await messagePfc.react("📰");
  28.  
  29.             await messagePfc.react("✂");
  30.  
  31.             const collector = messagePfc.createReactionCollector(
  32.  
  33.                 filter,
  34.  
  35.                 { maxEmojis: 1 }
  36.  
  37.             );
  38.  
  39.             const nombreAleatoire = ["🗿", "📰", "✂"];
  40.  
  41.             collector.on("collect", (r) => {
  42.  
  43.                 const toucoChoice = nombreAleatoire[Math.floor(Math.random() * nombreAleatoire.length)];
  44.  
  45.                 if (toucoChoice === r.emoji.name) {
  46.  
  47.                     message.channel.send("J'ai aussi choisi " + toucoChoice + " ! **Match nul !**");
  48.  
  49.                 }
  50.  
  51.                 if (toucoChoice === "🗿" && r.emoji.name === "📰"){
  52.  
  53.                     message.channel.send("J'ai choisi " + toucoChoice + " et tu as choisi " + r.emoji.name + " donc **tu as gagné !** 😢");
  54.  
  55.                 }
  56.  
  57.                 if (toucoChoice === "🗿" && r.emoji.name === "✂"){
  58.  
  59.                     message.channel.send("J'ai choisi " + toucoChoice + " et tu as choisi " + r.emoji.name + " donc tu as **perdu** ! 😝");
  60.  
  61.                 }
  62.  
  63.                 if (toucoChoice === "📰" && r.emoji.name === "🗿"){
  64.  
  65.                     message.channel.send("J'ai choisi " + toucoChoice + " et tu as choisi " + r.emoji.name + " donc tu as **perdu** ! 😝");
  66.  
  67.                 }
  68.  
  69.                 if (toucoChoice === "📰" && r.emoji.name === "✂"){
  70.  
  71.                     message.channel.send("J'ai choisi " + toucoChoice + " et tu as choisi " + r.emoji.name + " donc **tu as gagné !** 😢");
  72.  
  73.                     if (toucoChoice === "✂" && r.emoji.name === "📰"){
  74.  
  75.                         message.channel.send("J'ai choisi " + toucoChoice + " et tu as choisi " + r.emoji.name + " donc tu as **perdu** ! 😝");
  76.  
  77.                     }
  78.  
  79.                     if (toucoChoice === "✂" && r.emoji.name === "🗿"){
  80.  
  81.                         message.channel.send("J'ai choisi " + toucoChoice + " et tu as choisi " + r.emoji.name + " donc **tu as gagné !** 😢");
  82.  
  83.                     }
  84.  
  85.                 }
  86.  
  87.             });
  88.  
  89.  
  90.             collector.on("end", async () => {
  91.  
  92.             });
  93.  
  94.             messagePfc.delete(15000);
  95.  
  96.  
  97.  
  98.         }
  99.  
  100.         catch (e) {
  101.  
  102.             console.error(e);
  103.  
  104.         }
  105.  
  106.     }
  107.  
  108. });
  109.  
  110.  
  111. function nombreAleatoire (max) {
  112.  
  113.     return Math.floor(Math.random() * max);
  114.  
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement