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

This commit is contained in:
Raphael 2025-10-26 17:48:24 +01:00 committed by Raphaël
parent a4c08eaae5
commit 3571cd8bb7

View file

@ -1,4 +1,10 @@
import { Events, Guild, EmbedBuilder, channelMention, Channel } from 'discord.js'; import {
Events,
Guild,
EmbedBuilder,
channelMention,
Channel,
} from 'discord.js';
import { prisma } from '@lib/prisma'; import { prisma } from '@lib/prisma';
import { Guild as GuildPrisma } from '@prisma/client'; import { Guild as GuildPrisma } from '@prisma/client';
@ -25,11 +31,14 @@ export default {
}, },
}); });
if (guildData.logServer) { if (guildData.logServer) {
let toPrint: string = 'The update of the guild had changes theses thing\n'; let toPrint: string =
const logChannel : Channel = await newGuild.client.channels 'The update of the guild had changes theses thing\n';
const logChannel: Channel = await newGuild.client.channels
.fetch(guildData.logServer) .fetch(guildData.logServer)
.catch(() => null); .catch(() => null);
if (!logChannel.isTextBased()) {return;} if (!logChannel.isTextBased()) {
return;
}
if (oldGuild.name !== newGuild.name) { if (oldGuild.name !== newGuild.name) {
toPrint += `- Name:\n\`${oldGuild.name}\` => \`${newGuild.name}\`\n`; toPrint += `- Name:\n\`${oldGuild.name}\` => \`${newGuild.name}\`\n`;
} }
@ -61,9 +70,7 @@ export default {
}) })
.setDescription(toPrint); .setDescription(toPrint);
logChannel.send({ logChannel.send({
embeds: [ embeds: [toRep],
toRep,
],
}); });
} }
}, },