refactor(events/messages): adding the tsconfig + eslint correction

This commit is contained in:
Raphael 2025-10-14 00:19:18 +02:00 committed by Raphaël
parent c807c12d01
commit 9735528b2b
4 changed files with 30 additions and 36 deletions

View file

@ -1,5 +1,5 @@
import { Events, Message } from 'discord.js';
import { prisma } from '../../lib/prisma.ts';
import { prisma } from '@lib/prisma';
import { User as UserPrisma } from '@prisma/client';
const xpCooldown: Map<string, number> = new Map<string, number>();
@ -18,7 +18,7 @@ export default {
name: Events.MessageCreate,
async execute(message: Message) {
if (message.author.bot || !message.guildId || !canGainXp(message.author.id)) return;
const Author: UserPrisma = await prisma.user.findUnique({
const Author: UserPrisma | null = await prisma.user.findUnique({
where: { id: message.author.id },
});
if (!Author) {
@ -53,7 +53,7 @@ export default {
if (newXp >= requiredXp) {
newLevel++;
await message.channel.send(
`🎉 | Félicitations ${message.author}, tu es maintenant niveau **${newLevel}** !`,
`🎉 | Félicitations <@${message.author.id}>, tu es maintenant niveau **${newLevel}** !`,
);
}
console.log(`${message.author.username} | ${newLevel} -> ${newXp} [${requiredXp}]`);