Compare commits

...

2 commits

Author SHA1 Message Date
4728258071
trying birthdays again 2024-07-09 21:56:10 +05:00
6ad65e7019
more readable logs 2024-07-09 21:50:35 +05:00
2 changed files with 48 additions and 41 deletions

View file

@ -58,13 +58,13 @@ class CommandHandler extends BaseEvent {
}
client.logger.cmd(
`User ${interaction.user.getUsername()} used ${command.command.name} in ${interaction.guild ? interaction.guild.name : "DM"} with arguments: ${
`[${interaction.guild ? interaction.guild.name : "DM"}]: [${interaction.user.getUsername()}] => /${command.command.name}${
interaction.options.data.length > 0
? interaction.options.data
? ", args: " + interaction.options.data
.map(arg => {
return `${arg.name}: ${arg.value}`;
}).join(", ")
: "no args"
: ""
}`,
);

View file

@ -7,6 +7,9 @@ const { CronJob } = require("cron");
module.exports.init = async client => {
const cronjob = new CronJob("0 5 * * *", async function () {
client.guilds.cache.forEach(async guild => {
try {
console.log(`Checking birthdays for "${guild.name}"`);
const guildData = await client.getGuildData(guild.id);
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,