Improve holidays command

This commit is contained in:
Daniel Odendahl Jr
2018-09-30 18:50:59 +00:00
parent 2b217321da
commit b16a6940a8
3 changed files with 9 additions and 8 deletions
+1 -1
View File
@@ -109,10 +109,10 @@ on the [home server](https://discord.gg/sbMe32W).
### Events:
* **astronomy-picture-of-the-day:** Responds with today's Astronomy Picture of the Day.
* **calendar:** Responds with today's holidays.
* **days-until:** Responds with how many days there are until a certain date.
* **doomsday-clock:** Responds with the current time of the Doomsday Clock.
* **google-doodle:** Responds with a Google Doodle, either the latest one or a random one from the past.
* **holidays:** Responds with today's holidays.
* **horoscope:** Responds with today's horoscope for a specific Zodiac sign.
* **humble-bundle:** Responds with the current Humble Bundle.
* **neko-atsume-password:** Responds with today's Neko Atsume password.
@@ -3,13 +3,13 @@ const request = require('node-superfetch');
const { list, today, tomorrow } = require('../../util/Util');
const { GOOGLE_KEY, GOOGLE_CALENDAR_ID, PERSONAL_GOOGLE_CALENDAR_ID } = process.env;
module.exports = class HolidaysCommand extends Command {
module.exports = class CalendarCommand extends Command {
constructor(client) {
super(client, {
name: 'holidays',
aliases: ['google-calendar', 'holiday', 'calendar', 'events'],
name: 'calendar',
aliases: ['google-calendar', 'holiday', 'holidays', 'events'],
group: 'events',
memberName: 'holidays',
memberName: 'calendar',
description: 'Responds with today\'s holidays.'
});
}
@@ -23,8 +23,9 @@ module.exports = class HolidaysCommand extends Command {
const personalEvents = await this.fetchHolidays(PERSONAL_GOOGLE_CALENDAR_ID);
if (personalEvents) events.push(...personalEvents);
}
if (!events.length) return msg.say('There are no events today...');
return msg.say(`Today's ${events.length === 1 ? 'event is' : `${events.length} events are`}: ${list(events)}.`);
if (!events.length) return msg.say('There are no holidays today...');
const holidays = list(events.map(event => `**${event}**`));
return msg.say(`Today${events.length === 1 ? ' is' : `'s holidays are`} ${holidays}!`);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "91.14.2",
"version": "91.14.3",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {