Advertisement
BOMBUREK

Untitled

Jul 16th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.32 KB | None | 0 0
  1. msg.author.lastMessage.delete()
  2. var timeResult = tempVars('giveawayTime').content
  3. timeResult = timeResult.toLowerCase()
  4. var Discord = require('discord.js')
  5. var giveawayPrompt = tempVars('giveawayPrompt')
  6.  
  7. if (timeResult.includes('d')) {
  8. timeResult = timeResult.split('d')
  9. if (!isNaN(timeResult[0])) {
  10. var time = parseInt(timeResult[0])
  11. this.storeValue(time * 1440, 1, 'giveawayTime', cache)
  12. var currentDate = new Date()
  13. currentDate.setHours(currentDate.getHours(), currentDate.getMinutes() + time * 1440)
  14. currentDate = currentDate.toLocaleString('en-US', { timeZone: 'UTC', hour12: true })
  15. var currentDateTime = currentDate.split(',')[1]
  16. var currentDateDate = currentDate.split(',')[0]
  17. var newEmbed = new Discord.RichEmbed({
  18. color: 0x2E7F98,
  19. author: {
  20. name: 'πŸŽ‰ Nowy Giveaway πŸŽ‰',
  21. icon_url: (client || this.getDBM().Bot.bot).user.avatarURL
  22. },
  23. description: 'New giveaway for **' + tempVars('giveawayObject').content + '**\n React with πŸŽ‰ to enter the giveaway!',
  24. footer: {
  25. text: 'The giveaway will end at ' + currentDateDate + ' on ' + currentDateTime + ' UTC | ' + tempVars('numberOfMembers').toString() + ' Winners'
  26. }
  27. })
  28. this.storeValue(newEmbed, 1, 'giveawayMessage', cache)
  29. this.callNextAction(cache)
  30. } else {
  31. msg.channel.send({
  32. embed: {
  33. color: 0xff6666,
  34. author: {
  35. name: 'Error - Invalid Time',
  36. icon_url: (client || this.getDBM().Bot.bot).user.avatarURL
  37. },
  38. description: 'You have entered a invalid time, please activate the command again to retry \n \n The format to respond with is [time][d,h,m] \n Some example responses are 12d or 3h or 4m'
  39. }
  40. })
  41. giveawayPrompt.delete()
  42. }
  43. } else if (timeResult.includes('h')) {
  44. timeResult = timeResult.split('h')
  45. if (!isNaN(timeResult[0])) {
  46. var time = parseInt(timeResult[0])
  47. this.storeValue(time * 60, 1, 'giveawayTime', cache)
  48. var currentDate = new Date()
  49. currentDate.setHours(currentDate.getHours(), currentDate.getMinutes() + time * 60)
  50. currentDate = currentDate.toLocaleString('en-US', { timeZone: 'UTC', hour12: true })
  51. var currentDateTime = currentDate.split(',')[1]
  52. var currentDateDate = currentDate.split(',')[0]
  53. var newEmbed = new Discord.RichEmbed({
  54. color: 0x2E7F98,
  55. author: {
  56. name: 'πŸŽ‰ New Giveaway πŸŽ‰',
  57. icon_url: (client || this.getDBM().Bot.bot).user.avatarURL
  58. },
  59. description: 'New giveaway for **' + tempVars('giveawayObject').content + '**\n React with πŸŽ‰ to enter the giveaway!',
  60. footer: {
  61. text: 'The giveaway will end at ' + currentDateDate + ' on ' + currentDateTime + ' UTC | ' + tempVars('numberOfMembers').toString() + ' Winners'
  62. }
  63. })
  64. this.storeValue(newEmbed, 1, 'giveawayMessage', cache)
  65. this.callNextAction(cache)
  66. } else {
  67. msg.channel.send({
  68. embed: {
  69. color: 0xff6666,
  70. author: {
  71. name: 'Error - Invalid Time',
  72. icon_url: (client || this.getDBM().Bot.bot).user.avatarURL
  73. },
  74. description: 'You have entered a invalid time, please activate the command again to retry \n \n The format to respond with is [time][d,h,m] \n Some example responses are 12d or 3h or 4m'
  75. }
  76. })
  77. giveawayPrompt.delete()
  78. }
  79. } else if (timeResult.includes('m')) {
  80. timeResult = timeResult.split('m')
  81. if (!isNaN(timeResult[0])) {
  82. var time = parseInt(timeResult[0])
  83. this.storeValue(time, 1, 'giveawayTime', cache)
  84. var currentDate = new Date()
  85. currentDate.setHours(currentDate.getHours(), currentDate.getMinutes() + time)
  86. currentDate = currentDate.toLocaleString('en-US', { timeZone: 'UTC', hour12: true })
  87. var currentDateTime = currentDate.split(',')[1]
  88. var currentDateDate = currentDate.split(',')[0]
  89. var newEmbed = new Discord.RichEmbed({
  90. color: 0x2E7F98,
  91. author: {
  92. name: 'πŸŽ‰ New Giveaway πŸŽ‰',
  93. icon_url: (client || this.getDBM().Bot.bot).user.avatarURL
  94. },
  95. description: 'New giveaway for **' + tempVars('giveawayObject').content + '**\n Zareaguj emotkΔ… πŸŽ‰ aby wziΔ…c udziaΕ‚ w giveawayu!',
  96. footer: {
  97. text: 'The giveaway will end at ' + currentDateDate + ' on ' + currentDateTime + ' UTC | ' + tempVars('numberOfMembers').toString() + ' Winners'
  98. }
  99. })
  100. this.storeValue(newEmbed, 1, 'giveawayMessage', cache)
  101. this.callNextAction(cache)
  102. } else {
  103. msg.channel.send({
  104. embed: {
  105. color: 0xff6666,
  106. author: {
  107. name: 'Error - Invalid Time',
  108. icon_url: (client || this.getDBM().Bot.bot).user.avatarURL
  109. },
  110. description: 'You have entered a invalid time, please activate the command again to retry \n \n The format to respond with is [time][d,h,m] \n Some example responses are 12d or 3h or 4m'
  111. }
  112. })
  113. giveawayPrompt.delete()
  114. }
  115. } else {
  116. msg.channel.send({
  117. embed: {
  118. color: 0xff6666,
  119. author: {
  120. name: 'Error - Invalid Time',
  121. icon_url: (client || this.getDBM().Bot.bot).user.avatarURL
  122. },
  123. description: 'You have entered a invalid time, please activate the command again to retry \n \n The format to respond with is [time][d,h,m] \n Some example responses are 12d or 3h or 4m'
  124. }
  125. })
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement