mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Improve holidays command
This commit is contained in:
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "91.14.2",
|
||||
"version": "91.14.3",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user