Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require("discord.js");
- const moment = require("moment");
- const snekfetch = require("snekfetch");
- const isNumber = require('isnumber')
- const countdown = require("countdown")
- exports.run = async (client, message) => {
- let time = message.content.split(" ").slice(1)
- let reason = message.content.split(" ").slice(2).join(" ")
- if(!time)return message.reply(`The proper use for this command is /remind number what you want reminded.`).then(m => m.delete(5000))
- if(!reason) return message.reply(`The proper use for this command is /remind number what you want reminded.`).then(m => m.delete(5000))
- 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))
- 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))
- 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))
- 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`)
- .then(async msg => {
- const emoji = await client.prompt(msg, message.author, 30, ["🇲", "ðŸ‡", "🇩"]);
- const key = `${message.author.id}-${message.id}`
- const embed = new Discord.RichEmbed()
- embed.setAuthor(`${message.member.displayName}'s Reminder`, client.users.get(message.author.id).displayAvatarURL)
- embed.setColor(client.purple)
- embed.setTimestamp()
- embed.setFooter('Gilded Phoenix Reminders')
- if(emoji === "🇲"){
- msg.delete()
- const m = 60000
- endpoint = Number(time[0]) * m
- client.reminders.set(key, {
- expiry: Date.now() + endpoint,
- reason: reason,
- author: message.author.id,
- info: key
- })
- embed.setDescription(`Alright You will be reminded about ${reason} in ${countdown(null,Date.now() + endpoint).toString()}`)
- message.channel.send(embed)
- .then(m => m.delete(5000))
- }
- else if(emoji === "ðŸ‡"){
- msg.delete()
- const h = 3600000
- endpoint = Number(time[0]) * h
- client.reminders.set(key, {
- expiry: Date.now() + endpoint,
- reason: reason,
- author: message.author.id,
- info: key
- })
- embed.setDescription(`Alright You will be reminded about ${reason} in ${countdown(null,Date.now() + endpoint).toString()}`)
- message.channel.send(embed)
- .then(m => m.delete(5000))
- } else if(emoji === "🇩"){
- msg.delete()
- const d = 86400000
- endpoint = Number(time[0]) * d
- client.reminders.set(key, {
- expiry: Date.now() + endpoint,
- reason: reason,
- author: message.author.id,
- info: key
- })
- embed.setDescription(`Alright You will be reminded about ${reason} in ${countdown(null,Date.now() + endpoint).toString()}`)
- message.channel.send(embed)
- .then(m => m.delete(5000))
- }
- })
- }
- exports.conf = {
- enabled: true,
- guildOnly: false,
- aliases: ["reminder"]
- };
- exports.help = {
- name: "reminder",
- description: "Reminds gp staff about things.",
- usage: "/reminder 2 going to the store | the bot will figure out how long 2 is after.",
- category: "util"
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement