mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Add holidays from other countries
This commit is contained in:
@@ -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=
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user