mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-07 06:45:31 +02:00
Remind Command Beta
This commit is contained in:
@@ -59,7 +59,7 @@ module.exports = class InfoCommand extends commando.Command {
|
||||
.addField('Modules',
|
||||
"[cleverbot-node](https://github.com/fojas/cleverbot-node), [pirate-speak](https://github.com/mikewesthad/pirate-speak), [google-translate-api](https://github.com/matheuss/google-translate-api), [urban](https://github.com/mvrilo/urban), [zalgoize](https://github.com/clux/zalgolize), [hepburn](https://github.com/lovell/hepburn), [yahoo-weather](https://github.com/mamal72/node-yahoo-weather), [imdb-api](https://github.com/worr/node-imdb-api), [string-to-binary](https://www.npmjs.com/package/string-to-binary), [roman-numeral-converter-mmxvi](https://github.com/Cein-Markey/roman-numeral-conversion-library), [cowsay](https://github.com/piuccio/cowsay), [morse](https://github.com/ecto/morse)")
|
||||
.addField('Utility Modules',
|
||||
"[superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [opusscript](https://github.com/abalabahaha/opusscript), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/)")
|
||||
"[superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [opusscript](https://github.com/abalabahaha/opusscript), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/), [sherlockjs](https://github.com/maytis/sherlockjs)")
|
||||
.addField('APIs',
|
||||
"[Cleverbot API](https://www.cleverbot.com/api/), [Wattpad API](https://developer.wattpad.com/docs/api), [Wordnik API](http://developer.wordnik.com/docs.html), [osu! API](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices API](http://docs.yugiohprices.apiary.io/#), [YouTube Data API](https://developers.google.com/youtube/v3/), [Yoda Speak API](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots API](https://bots.discord.pw/api), [Today in History API](http://history.muffinlabs.com/#api), [jService API](http://jservice.io/)")
|
||||
.addField('Other Credit',
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
const commando = require('discord.js-commando');
|
||||
const moment = require('moment');
|
||||
const sherlock = require('Sherlock');
|
||||
|
||||
module.exports = class RemindCommand extends commando.Command {
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'remind',
|
||||
aliases: [
|
||||
'remindme'
|
||||
],
|
||||
group: 'random',
|
||||
memberName: 'remind',
|
||||
description: 'Reminds you of something at a certain time. (;remind Eat Food tomorrow)',
|
||||
examples: [';remind Eat Food tomorrow']
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log(`[Command] ${message.content}`);
|
||||
let remindMe = message.content.split(" ").slice(1).join(" ");
|
||||
let remindTime = sherlock.parse(remindMe);
|
||||
let time = remindTime.startDate.getTime() - Date.now();
|
||||
let preRemind = await message.channel.send(`I will remind you '${remindTime.eventTitle}' ${moment().add(time, 'ms').fromNow()}.`);
|
||||
const remindMessage = await new Promise(resolve => {
|
||||
setTimeout(() => resolve(message.channel.send(`${message.author} you wanted me to remind you of: '${remindTime.eventTitle}'`)), time);
|
||||
});
|
||||
return [preRemind, remindMessage];
|
||||
}
|
||||
};
|
||||
@@ -32,6 +32,7 @@
|
||||
"opusscript": "0.0.3",
|
||||
"pirate-speak": "^1.0.1",
|
||||
"roman-numeral-converter-mmxvi": "^1.0.5",
|
||||
"sherlockjs": "^0.0.9",
|
||||
"string-to-binary": "^0.1.2",
|
||||
"superagent": "^3.5.1",
|
||||
"urban": "^0.3.1",
|
||||
|
||||
Reference in New Issue
Block a user