mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-05 08:12:04 +02:00
Change holidays format
This commit is contained in:
@@ -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!`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user