JohnTomah

Untitled

Mar 13th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. client.on('message', message => {
  2. if (!points[message.author.id]) points[message.author.id] = {
  3. points: 0,
  4. };
  5. if (message.content.startsWith(prefix + 'فكك')) {
  6. if(!message.channel.guild) return message.reply('**هذا الأمر للسيرفرات فقط**').then(m => m.delete(3000));
  7.  
  8. const type = require('./fkk.json');
  9. const item = type[Math.floor(Math.random() * type.length)];
  10. const filter = response => {
  11. return item.answers.some(answer => answer.toLowerCase() === response.content.toLowerCase());
  12. };
  13. message.channel.send('**لديك 15 ثانيه لتفكيك الكلمه**').then(msg => {
  14.  
  15.  
  16. msg.channel.send(`${item.type}`).then(() => {
  17. message.channel.awaitMessages(filter, { maxMatches: 1, time: 15000, errors: ['time'] })
  18. .then((collected) => {
  19. message.channel.send(`${collected.first().author} ✅ **احسنت لقد تمكنت من تفكيك الكلمه بسرعه**`);
  20. console.log(`[Typing] ${collected.first().author} typed the word.`);
  21. let won = collected.first().author;
  22. points[won.id].points++;
  23. })
  24. .catch(collected => {
  25. message.channel.send(`:x: **لم يتمكن احد من تفكيك الكلمه في الوقت المناسب**`);
  26. console.log('[Typing] Error: No one type the word.');
  27. })
  28. })
  29. })
  30. }
  31. });
Advertisement
Add Comment
Please, Sign In to add comment