SHARE
TWEET

Untitled

a guest Sep 23rd, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require("discord.js");
  2. const moment = require("moment");
  3. const snekfetch = require("snekfetch");
  4. const isNumber = require('isnumber')
  5. const countdown = require("countdown")
  6. exports.run = async (client, message) => {
  7. let time = message.content.split(" ").slice(1)
  8. let reason = message.content.split(" ").slice(2).join(" ")
  9.  
  10.  
  11. if(!time)return message.reply(`The proper use for this command is /remind number what you want reminded.`).then(m => m.delete(5000))
  12. if(!reason) return message.reply(`The proper use for this command is /remind number what you want reminded.`).then(m => m.delete(5000))
  13. if(!isNumber(time[0]))return message.reply(`The proper use for this command is /remind number what you want reminded.`).then(m => m.delete(5000))
  14. if(time[0].includes("."))return message.reply("Please use just a number to say when. We can figure out the duration later.").then(m => m.delete(5000))
  15. if(time[0].includes("-"))return message.reply("Please use just a number to say when. We can figure out the duration later.").then(m => m.delete(5000))
  16. message.channel.send(`Alright I'll remind you about ${reason}. but first let's figure out how much time this is.\nReact with 🇲 for ${time[0]} minutes\nReact with 🇭 for ${time[0]} Hours\nReact with 🇩 for ${time[0]} Days`)
  17. .then(async msg => {
  18.   const emoji = await client.prompt(msg, message.author, 30, ["🇲", "🇭", "🇩"]);
  19.   const key = `${message.author.id}-${message.id}`
  20.   const embed = new Discord.RichEmbed()
  21.   embed.setAuthor(`${message.member.displayName}'s Reminder`, client.users.get(message.author.id).displayAvatarURL)
  22.   embed.setColor(client.purple)
  23.   embed.setTimestamp()
  24.   embed.setFooter('Gilded Phoenix Reminders')
  25.   if(emoji === "🇲"){
  26.     msg.delete()
  27.   const m =  60000
  28.   endpoint = Number(time[0]) * m
  29.   client.reminders.set(key, {
  30.   expiry: Date.now() + endpoint,
  31.   reason: reason,
  32.   author: message.author.id,
  33.   info: key
  34.   })
  35.   embed.setDescription(`Alright You will be reminded about ${reason} in ${countdown(null,Date.now() + endpoint).toString()}`)
  36.   message.channel.send(embed)
  37.   .then(m => m.delete(5000))
  38.   }
  39.  
  40.   else if(emoji === "🇭"){
  41.     msg.delete()
  42.     const h = 3600000
  43.     endpoint = Number(time[0]) * h
  44.   client.reminders.set(key, {
  45.   expiry: Date.now() + endpoint,
  46.   reason: reason,
  47.   author: message.author.id,
  48.   info: key
  49.   })
  50.   embed.setDescription(`Alright You will be reminded about ${reason} in ${countdown(null,Date.now() + endpoint).toString()}`)
  51.   message.channel.send(embed)
  52.   .then(m => m.delete(5000))
  53.  
  54.   } else if(emoji === "🇩"){
  55.     msg.delete()
  56.     const d = 86400000
  57.     endpoint = Number(time[0]) * d
  58.   client.reminders.set(key, {
  59.   expiry: Date.now() + endpoint,
  60.   reason: reason,
  61.   author: message.author.id,
  62.   info: key
  63.   })
  64.   embed.setDescription(`Alright You will be reminded about ${reason} in ${countdown(null,Date.now() + endpoint).toString()}`)
  65.   message.channel.send(embed)
  66.   .then(m => m.delete(5000))
  67.   }
  68. })
  69.  
  70. }
  71. exports.conf = {
  72.   enabled: true,
  73.   guildOnly: false,
  74.   aliases: ["reminder"]
  75. };
  76.  
  77. exports.help = {
  78.   name: "reminder",
  79.   description: "Reminds gp staff about things.",
  80.   usage: "/reminder 2 going to the store | the bot will figure out how long 2 is after.",
  81.   category: "util"
  82. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top