refactor(events/messages): now using the new log system

This commit is contained in:
Raphael 2025-10-26 17:48:16 +01:00 committed by Raphaël
parent 6c3a7587e8
commit a4c08eaae5
4 changed files with 22 additions and 12 deletions

View file

@ -1,5 +1,6 @@
import { Events, EmbedBuilder, Message, Channel } from 'discord.js';
import { prisma } from '@lib/prisma';
import { log } from '@lib/log';
import { Guild as GuildPrisma } from '@prisma/client';
export default {
@ -11,7 +12,7 @@ export default {
},
});
if (guildData.logMsg) {
const log = new EmbedBuilder()
const logEmbed = new EmbedBuilder()
.setAuthor({
name: `${message.author.tag} (${message.author.id})`,
iconURL: message.author.displayAvatarURL({
@ -30,10 +31,12 @@ export default {
`);
const logChannel: Promise<Channel | null> = await message.guild.client.channels
.fetch(guildData.logMsg)
.catch((err) => { console.error(err); });
.catch((err) => {
log.error(err, 'Unable to fetch the log channel');
});
logChannel.send({
embeds: [
log,
logEmbed,
],
});
}