From c3806fb9b212dbc06fe6a1768c879abd212c96d5 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 12 Jun 2021 18:18:57 -0400 Subject: [PATCH] Add holidays from other countries --- .env.example | 4 ---- commands/events/holidays.js | 13 ++++++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index 403f5f4f..35d04e1d 100644 --- a/.env.example +++ b/.env.example @@ -11,9 +11,6 @@ REPORT_CHANNEL_ID= JOIN_LEAVE_CHANNEL_ID= COMMAND_CHANNEL_ID= -# Events -APRIL_FOOLS= - # Bot list tokens TOP_GG_TOKEN= BOTS_GG_TOKEN= @@ -60,7 +57,6 @@ GIPHY_KEY= GITHUB_ACCESS_TOKEN= GODADDY_KEY= GODADDY_SECRET= -GOOGLE_CALENDAR_ID= GOOGLE_KEY= GOV_KEY= IMGUR_KEY= diff --git a/commands/events/holidays.js b/commands/events/holidays.js index aced1963..d3e747d7 100644 --- a/commands/events/holidays.js +++ b/commands/events/holidays.js @@ -1,7 +1,12 @@ const Command = require('../../framework/Command'); const request = require('node-superfetch'); const { list, today, tomorrow } = require('../../util/Util'); -const { GOOGLE_KEY, GOOGLE_CALENDAR_ID, PERSONAL_GOOGLE_CALENDAR_ID } = process.env; +const { GOOGLE_KEY, PERSONAL_GOOGLE_CALENDAR_ID } = process.env; +const holidayCals = [ + 'en.usa#holiday@group.v.calendar.google.com', + 'en.japanese#holiday@group.v.calendar.google.com', + 'en.uk#holiday@group.v.calendar.google.com' +]; module.exports = class HolidaysCommand extends Command { constructor(client) { @@ -25,8 +30,10 @@ module.exports = class HolidaysCommand extends Command { async run(msg) { try { const events = []; - const standardEvents = await this.fetchHolidays(GOOGLE_CALENDAR_ID); - if (standardEvents) events.push(...standardEvents); + for (const calID of holidayCals) { + const standardEvents = await this.fetchHolidays(calID); + if (standardEvents) events.push(...standardEvents); + } if (PERSONAL_GOOGLE_CALENDAR_ID) { const personalEvents = await this.fetchHolidays(PERSONAL_GOOGLE_CALENDAR_ID); if (personalEvents) events.push(...personalEvents);