mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
trying birthdays again
This commit is contained in:
parent
6ad65e7019
commit
4728258071
1 changed files with 45 additions and 38 deletions
|
@ -7,6 +7,9 @@ const { CronJob } = require("cron");
|
||||||
module.exports.init = async client => {
|
module.exports.init = async client => {
|
||||||
const cronjob = new CronJob("0 5 * * *", async function () {
|
const cronjob = new CronJob("0 5 * * *", async function () {
|
||||||
client.guilds.cache.forEach(async guild => {
|
client.guilds.cache.forEach(async guild => {
|
||||||
|
try {
|
||||||
|
console.log(`Checking birthdays for "${guild.name}"`);
|
||||||
|
|
||||||
const guildData = await client.getGuildData(guild.id);
|
const guildData = await client.getGuildData(guild.id);
|
||||||
const channel = guildData.plugins.birthdays ? await client.channels.fetch(guildData.plugins.birthdays) : null;
|
const channel = guildData.plugins.birthdays ? await client.channels.fetch(guildData.plugins.birthdays) : null;
|
||||||
|
|
||||||
|
@ -52,6 +55,10 @@ module.exports.init = async client => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
if (err.code === 10003) console.log("Unknown channel");
|
||||||
|
else throw err;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
|
|
Loading…
Reference in a new issue