Advertisement
X_KillerYT

لعبة عواصم

Dec 24th, 2018
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const 3awasm = [
  2.   {
  3.           "type": "عاصمة الجزائر ؟",
  4.       "answers": ["الجزائر"]
  5.   },
  6.   {
  7.     "type": "عاصمة السعودية",
  8. "answers": ["الرياض"]
  9. },
  10. {
  11.   "type": "عاصمة المغرب",
  12. "answers": ["الرباط"]
  13. },
  14. {
  15.   "type": "عاصمة مصر",
  16. "answers": ["القاهرة"]
  17. },
  18. {
  19.   "type": "عاصمة امريكا",
  20. "answers": ["واشنطن"]
  21. },
  22. {
  23.   "type": "عاصمة تركيا",
  24. "answers": ["أنقرة"]
  25. },
  26. {
  27.   "type": "عاصمة المانيا",
  28. "answers": ["برلين"]
  29. },
  30. {
  31.   "type": "عاصمة ايطاليا",
  32. "answers": ["روما"]
  33. },
  34. {
  35.   "type": "عاصمة الامارات",
  36. "answers": ["ابو ظبي"]
  37. },
  38. {
  39.   "type": "عاصمة لبنان",
  40. "answers": ["بيروت"]
  41. },
  42. {
  43.   "type": "عاصمة قطر",
  44. "answers": ["الدوحة"]
  45. },
  46. {
  47.   "type": "عاصمة سوريا",
  48. "answers": ["دمشق"]
  49. },
  50. {
  51.   "type": "عاصمة البحرين",
  52. "answers": ["المنامة"]
  53. },
  54.  
  55. ];
  56. client.on('message', message => {
  57.   if (!points[message.author.id]) points[message.author.id] = {
  58.       points: 0,
  59.     };
  60.     if(!message.guild) return;
  61.       let id = message.author.id,prefix="#";
  62.       if (spee[id] && (new Date).getTime() - spee[id] < 15*1000) {
  63.           let r = (new Date).getTime() - spee[id];
  64.           r = 15*1000 - r;
  65.       }
  66.       if ( message.content == prefix "عواصم"){
  67.          
  68.           try{
  69.   }catch(e){
  70.    
  71.   }
  72.    
  73.       if(!message.channel.guild) return message.reply('**:no_entry: , هذا الأمر للسيرفرات فقط**').then(m => m.delete(3000));
  74.    
  75.    
  76.   const item = 3awasm[Math.floor(Math.random() * 3awasm.length)];
  77.   const filter = response => {  
  78.       return item.answers.some(answer => answer.toLowerCase() === response.content.toLowerCase());
  79.   };
  80.   message.channel.send('**:loudspeaker: , لقد بدأت اللعبة الان !**').then(msg => {
  81.    
  82.    const embed = new Discord.RichEmbed()
  83.    .setColor("RANDOM")
  84.        .setAuthor(`:timer: , لديك »15« ثانية فقط لكتابة هذه الكلمة`)
  85.             .setImage(`${item.type}`)
  86.    .setFooter(`${message.author.tag}`, message.author.avatarURL)
  87.    
  88.    
  89.            
  90.   msg.channel.send(embed).then(() => {
  91.           message.channel.awaitMessages(filter, { maxMatches: 1, time: 15000, errors: ['time'] })
  92.           .then((collected) => {
  93.                     const sh = new Discord.RichEmbed()
  94.     .setColor("RANDOM")
  95.   .setDescription('**:tada: , جيد , لقد حصلت على نقطة**')
  96.   .addField('#mypoints اكتب', 'لرؤية نقاطك' , true)
  97.   .setFooter(message.author.username, message.author.avatarURL)
  98.   message.channel.sendEmbed(sh);
  99.               let won = collected.first().author;
  100.               points[won.id].points++;
  101.             })
  102.             .catch(collected => {
  103.               message.channel.send(`**:timer: , انتهئ الوقت , ولم يقم احد بتفكيك الكلمة**`);
  104.             })
  105.             fs.writeFile("./points.json", JSON.stringify(points), (err) => {
  106.       if (err) console.error(err)
  107.             })
  108.           })
  109.       })
  110.       spee[id] = (new Date).getTime()
  111.   }
  112.   });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement