Advertisement
Guest User

Giveaway by shadow

a guest
Jan 19th, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. var filter = m => m.author.id === message.author.id;
  2. if(message.content.startsWith(prefix + "giveaway")) {
  3. //يمديك تغير لامر لو تبي
  4. if(!message.guild.member(message.author).hasPermission('MANAGE_GUILD')) return message.channel.send(':heavy_multiplication_x:| **يجب أن يكون لديك خاصية التعديل على السيرفر**');
  5. message.channel.send(`:eight_pointed_black_star:| **اكتب اسم روم الجيفاواي**`).then(msg => {
  6. message.channel.awaitMessages(filter, {
  7. max: 1,
  8. time: 20000,
  9. errors: ['time']
  10. }).then(collected => {
  11. let room = message.guild.channels.find('name' , collected.first().content);
  12. if(!room) return message.channel.send(':heavy_multiplication_x:| **i Found It :(**');
  13. room = collected.first().content;
  14. collected.first().delete();
  15. msg.edit(':eight_pointed_black_star:| **كم تريد وقت الجيفواي**').then(msg => {
  16. message.channel.awaitMessages(filter, {
  17. max: 1,
  18. time: 20000,
  19. errors: ['time'] //by shadow
  20. }).then(collected => {
  21. if(isNaN(collected.first().content)) return message.channel.send(':heavy_multiplication_x:| **انا لم افهم هاذا الوقت**');
  22. duration = collected.first().content * 60000;
  23. collected.first().delete();
  24. msg.edit(':eight_pointed_black_star:| **ما هي الجائزة؟**').then(msg => {
  25. message.channel.awaitMessages(filter, {
  26. max: 1,
  27. time: 20000,
  28. errors: ['time']
  29. }).then(collected => {
  30. title = collected.first().content;
  31. collected.first().delete();
  32. msg.delete();
  33. message.delete();
  34. try {
  35. let giveEmbed = new Discord.RichEmbed()
  36. .setDescription(`**${title}** \nReact With 🎉 To Enter! \nTime remaining : ${duration / 60000} **Minutes**\n **Created at :** ${hours}:${minutes}:${seconds} ${suffix}`)
  37. .setFooter(message.author.username, message.author.avatarURL);
  38. message.guild.channels.find("name" , room).send(' :heavy_check_mark: **تم صنع الجيفواي** :heavy_check_mark:' , {embed: giveEmbed}).then(m => {
  39. let re = m.react('🎉');
  40. setTimeout(() => {
  41. let users = m.reactions.get("🎉").users;
  42. let list = users.array().filter(u => u.id !== m.author.id !== client.user.id);
  43. let gFilter = list[Math.floor(Math.random() * list.length) + 0]
  44. let endEmbed = new Discord.RichEmbed()
  45. .setAuthor(message.author.username, message.author.avatarURL)
  46. .setTitle(title)
  47. .addField('Giveaway Ended !🎉',`Winners : ${gFilter} \nEnded at :`)
  48. .setTimestamp()
  49. m.edit('** 🎉 GIVEAWAY ENDED 🎉**' , {embed: endEmbed});
  50. message.guild.channels.find("name" , room).send(`**Congratulations ${gFilter}! انت ربحت الجيفواي \`${title}\`**` , {embed: {}})
  51. },duration);
  52. });
  53. } catch(e) {
  54. message.channel.send(`:heavy_multiplication_x:| **ليست لدي الصلاحيات الكافية**`);
  55. console.log(e);
  56. }
  57. });
  58. });
  59. });
  60. });
  61. });
  62. });
  63. }
  64. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement