Change holidays format

This commit is contained in:
Daniel Odendahl Jr
2018-07-07 20:20:48 +00:00
parent 43a678dc3a
commit d60e3a5e00
+3 -7
View File
@@ -1,6 +1,5 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const { stripIndents } = require('common-tags');
const { list, today, tomorrow } = require('../../util/Util');
const { GOOGLE_KEY, GOOGLE_CALENDAR_ID, PERSONAL_GOOGLE_CALENDAR_ID } = process.env;
@@ -8,7 +7,7 @@ module.exports = class HolidaysCommand extends Command {
constructor(client) {
super(client, {
name: 'holidays',
aliases: ['google-calendar', 'holiday', 'calendar'],
aliases: ['google-calendar', 'holiday', 'calendar', 'events'],
group: 'events',
memberName: 'holidays',
description: 'Responds with today\'s holidays.'
@@ -22,11 +21,8 @@ module.exports = class HolidaysCommand extends Command {
if (standardEvents) events.push(...standardEvents);
const personalEvents = await this.fetchHolidays(PERSONAL_GOOGLE_CALENDAR_ID);
if (personalEvents) events.push(...personalEvents);
if (!events.length) return msg.say('There are no holidays today...');
return msg.say(stripIndents`
There are **${events.length}** holidays today:
${list(events)}.
`);
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)}.`);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}