Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- msg.author.lastMessage.delete()
- var timeResult = tempVars('giveawayTime').content
- timeResult = timeResult.toLowerCase()
- var Discord = require('discord.js')
- var giveawayPrompt = tempVars('giveawayPrompt')
- if (timeResult.includes('d')) {
- timeResult = timeResult.split('d')
- if (!isNaN(timeResult[0])) {
- var time = parseInt(timeResult[0])
- this.storeValue(time * 1440, 1, 'giveawayTime', cache)
- var currentDate = new Date()
- currentDate.setHours(currentDate.getHours(), currentDate.getMinutes() + time * 1440)
- currentDate = currentDate.toLocaleString('en-US', { timeZone: 'UTC', hour12: true })
- var currentDateTime = currentDate.split(',')[1]
- var currentDateDate = currentDate.split(',')[0]
- var newEmbed = new Discord.RichEmbed({
- color: 0x2E7F98,
- author: {
- name: 'π Nowy Giveaway π',
- icon_url: (client || this.getDBM().Bot.bot).user.avatarURL
- },
- description: 'New giveaway for **' + tempVars('giveawayObject').content + '**\n React with π to enter the giveaway!',
- footer: {
- text: 'The giveaway will end at ' + currentDateDate + ' on ' + currentDateTime + ' UTC | ' + tempVars('numberOfMembers').toString() + ' Winners'
- }
- })
- this.storeValue(newEmbed, 1, 'giveawayMessage', cache)
- this.callNextAction(cache)
- } else {
- msg.channel.send({
- embed: {
- color: 0xff6666,
- author: {
- name: 'Error - Invalid Time',
- icon_url: (client || this.getDBM().Bot.bot).user.avatarURL
- },
- 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'
- }
- })
- giveawayPrompt.delete()
- }
- } else if (timeResult.includes('h')) {
- timeResult = timeResult.split('h')
- if (!isNaN(timeResult[0])) {
- var time = parseInt(timeResult[0])
- this.storeValue(time * 60, 1, 'giveawayTime', cache)
- var currentDate = new Date()
- currentDate.setHours(currentDate.getHours(), currentDate.getMinutes() + time * 60)
- currentDate = currentDate.toLocaleString('en-US', { timeZone: 'UTC', hour12: true })
- var currentDateTime = currentDate.split(',')[1]
- var currentDateDate = currentDate.split(',')[0]
- var newEmbed = new Discord.RichEmbed({
- color: 0x2E7F98,
- author: {
- name: 'π New Giveaway π',
- icon_url: (client || this.getDBM().Bot.bot).user.avatarURL
- },
- description: 'New giveaway for **' + tempVars('giveawayObject').content + '**\n React with π to enter the giveaway!',
- footer: {
- text: 'The giveaway will end at ' + currentDateDate + ' on ' + currentDateTime + ' UTC | ' + tempVars('numberOfMembers').toString() + ' Winners'
- }
- })
- this.storeValue(newEmbed, 1, 'giveawayMessage', cache)
- this.callNextAction(cache)
- } else {
- msg.channel.send({
- embed: {
- color: 0xff6666,
- author: {
- name: 'Error - Invalid Time',
- icon_url: (client || this.getDBM().Bot.bot).user.avatarURL
- },
- 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'
- }
- })
- giveawayPrompt.delete()
- }
- } else if (timeResult.includes('m')) {
- timeResult = timeResult.split('m')
- if (!isNaN(timeResult[0])) {
- var time = parseInt(timeResult[0])
- this.storeValue(time, 1, 'giveawayTime', cache)
- var currentDate = new Date()
- currentDate.setHours(currentDate.getHours(), currentDate.getMinutes() + time)
- currentDate = currentDate.toLocaleString('en-US', { timeZone: 'UTC', hour12: true })
- var currentDateTime = currentDate.split(',')[1]
- var currentDateDate = currentDate.split(',')[0]
- var newEmbed = new Discord.RichEmbed({
- color: 0x2E7F98,
- author: {
- name: 'π New Giveaway π',
- icon_url: (client || this.getDBM().Bot.bot).user.avatarURL
- },
- description: 'New giveaway for **' + tempVars('giveawayObject').content + '**\n Zareaguj emotkΔ π aby wziΔ c udziaΕ w giveawayu!',
- footer: {
- text: 'The giveaway will end at ' + currentDateDate + ' on ' + currentDateTime + ' UTC | ' + tempVars('numberOfMembers').toString() + ' Winners'
- }
- })
- this.storeValue(newEmbed, 1, 'giveawayMessage', cache)
- this.callNextAction(cache)
- } else {
- msg.channel.send({
- embed: {
- color: 0xff6666,
- author: {
- name: 'Error - Invalid Time',
- icon_url: (client || this.getDBM().Bot.bot).user.avatarURL
- },
- 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'
- }
- })
- giveawayPrompt.delete()
- }
- } else {
- msg.channel.send({
- embed: {
- color: 0xff6666,
- author: {
- name: 'Error - Invalid Time',
- icon_url: (client || this.getDBM().Bot.bot).user.avatarURL
- },
- 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'
- }
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement