Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- client.on("message", async (message) => {
- if (message.content === prefix + "pfc") {
- const authorID = message.author.id;
- const filter = (reaction, user) =>
- user.id === authorID && (
- reaction.emoji.name === "🗿" ||
- reaction.emoji.name === "📰" ||
- reaction.emoji.name === "✂"
- );
- try {
- const messagePfc = await message.channel.send("Pierre Feuille ou Ciseaux ?");
- await messagePfc.react("🗿");
- await messagePfc.react("📰");
- await messagePfc.react("✂");
- const collector = messagePfc.createReactionCollector(
- filter,
- { maxEmojis: 1 }
- );
- const nombreAleatoire = ["🗿", "📰", "✂"];
- collector.on("collect", (r) => {
- const toucoChoice = nombreAleatoire[Math.floor(Math.random() * nombreAleatoire.length)];
- if (toucoChoice === r.emoji.name) {
- message.channel.send("J'ai aussi choisi " + toucoChoice + " ! **Match nul !**");
- }
- if (toucoChoice === "🗿" && r.emoji.name === "📰"){
- message.channel.send("J'ai choisi " + toucoChoice + " et tu as choisi " + r.emoji.name + " donc **tu as gagné !** 😢");
- }
- if (toucoChoice === "🗿" && r.emoji.name === "✂"){
- message.channel.send("J'ai choisi " + toucoChoice + " et tu as choisi " + r.emoji.name + " donc tu as **perdu** ! 😝");
- }
- if (toucoChoice === "📰" && r.emoji.name === "🗿"){
- message.channel.send("J'ai choisi " + toucoChoice + " et tu as choisi " + r.emoji.name + " donc tu as **perdu** ! 😝");
- }
- if (toucoChoice === "📰" && r.emoji.name === "✂"){
- message.channel.send("J'ai choisi " + toucoChoice + " et tu as choisi " + r.emoji.name + " donc **tu as gagné !** 😢");
- if (toucoChoice === "✂" && r.emoji.name === "📰"){
- message.channel.send("J'ai choisi " + toucoChoice + " et tu as choisi " + r.emoji.name + " donc tu as **perdu** ! 😝");
- }
- if (toucoChoice === "✂" && r.emoji.name === "🗿"){
- message.channel.send("J'ai choisi " + toucoChoice + " et tu as choisi " + r.emoji.name + " donc **tu as gagné !** 😢");
- }
- }
- });
- collector.on("end", async () => {
- });
- messagePfc.delete(15000);
- }
- catch (e) {
- console.error(e);
- }
- }
- });
- function nombreAleatoire (max) {
- return Math.floor(Math.random() * max);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement