From fb8b1d84961b3b3d64705b6071b34136b19f7a3c Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Mon, 17 Jun 2024 17:00:03 +0500 Subject: [PATCH] man.... --- helpers/birthdays.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/helpers/birthdays.js b/helpers/birthdays.js index 9f395e57..00732dc5 100644 --- a/helpers/birthdays.js +++ b/helpers/birthdays.js @@ -8,7 +8,11 @@ module.exports.init = async client => { const cronjob = new CronJob("0 5 * * *", async function () { client.guilds.cache.forEach(async guild => { const guildData = await client.getGuildData(guild.id); - const channel = guildData.plugins.birthdays ? client.channels.cache.get(guildData.plugins.birthdays) || (await client.channels.fetch(guildData.plugins.birthdays)) : null; + let channel; + + try { + channel = guildData.plugins.birthdays ? client.channels.cache.get(guildData.plugins.birthdays) || (await client.channels.fetch(guildData.plugins.birthdays)) : null; + } catch (e) { /* Nothing */ } if (guildData.plugins.birthdays && client.channels.cache.get(guildData.plugins.birthdays)) { const date = new Date(), @@ -70,7 +74,11 @@ module.exports.init = async client => { module.exports.run = async client => { client.guilds.cache.forEach(async guild => { const guildData = await client.getGuildData(guild.id); - const channel = guildData.plugins.birthdays ? client.channels.cache.get(guildData.plugins.birthdays) || (await client.channels.fetch(guildData.plugins.birthdays)) : null; + let channel; + + try { + channel = guildData.plugins.birthdays ? client.channels.cache.get(guildData.plugins.birthdays) || (await client.channels.fetch(guildData.plugins.birthdays)) : null; + } catch (e) { /* Nothing */ } if (guildData.plugins.birthdays) { const date = new Date(),