refactor(events/messages): adding the tsconfig + eslint correction
This commit is contained in:
parent
c807c12d01
commit
9735528b2b
4 changed files with 30 additions and 36 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { Events, EmbedBuilder, Message, Channel, Collection, Snowflake, PartialMessage } from 'discord.js';
|
||||
import { prisma } from '../../lib/prisma.ts';
|
||||
import { prisma } from '@lib/prisma';
|
||||
import { Guild as GuildPrisma } from '@prisma/client';
|
||||
|
||||
export default {
|
||||
|
|
@ -40,21 +40,19 @@ export default {
|
|||
text: guildData.footer,
|
||||
})
|
||||
.setDescription(`
|
||||
__Channel:__ ${message.channel}
|
||||
__Channel:__ <#${message.channel.id}> (${message.channel.name})
|
||||
__Number:__ ${messages.size}
|
||||
__Content:__
|
||||
${description}
|
||||
`);
|
||||
const logChannel: Promise<Channel | null> = await message.guild.client.channels
|
||||
.fetch(guildData.logMsg)
|
||||
.catch((err) => console.error(err));
|
||||
if (logChannel) {
|
||||
.catch((err) => { console.error(err); });
|
||||
logChannel.send({
|
||||
embeds: [
|
||||
log,
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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}]`);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Events, EmbedBuilder, Message, Channel } from 'discord.js';
|
||||
import { prisma } from '../../lib/prisma.ts';
|
||||
import { prisma } from '@lib/prisma';
|
||||
import { Guild as GuildPrisma } from '@prisma/client';
|
||||
|
||||
export default {
|
||||
|
|
@ -25,19 +25,17 @@ export default {
|
|||
text: guildData.footer,
|
||||
})
|
||||
.setDescription(`
|
||||
Channel: ${message.channel}
|
||||
Content: ${message.content ? message.content : '*enable to load the content*'}
|
||||
__Channel:__ <#${message.channel.id}> (${message.channel.name})
|
||||
__Content:__ ${message.content ? message.content : '*enable to load the content*'}
|
||||
`);
|
||||
const logChannel: Promise<Channel | null> = await message.guild.client.channels
|
||||
.fetch(guildData.logMsg)
|
||||
.catch((err) => console.error(err));
|
||||
if (logChannel) {
|
||||
.catch((err) => { console.error(err); });
|
||||
logChannel.send({
|
||||
embeds: [
|
||||
log,
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Events, EmbedBuilder, Message, Channel } from 'discord.js';
|
||||
import { prisma } from '../../lib/prisma.ts';
|
||||
import { prisma } from '@lib/prisma';
|
||||
import { Guild as GuildPrisma } from '@prisma/client';
|
||||
|
||||
export default {
|
||||
|
|
@ -25,20 +25,18 @@ export default {
|
|||
text: guildData.footer,
|
||||
})
|
||||
.setDescription(`
|
||||
Channel: ${newMessage.channel}
|
||||
Before: ${oldMessage.content}
|
||||
After: ${newMessage.content}
|
||||
__Channel:__ <#${message.channel.id}> (${message.channel.name})
|
||||
__Before:__ ${oldMessage.content}
|
||||
__After:__ ${newMessage.content}
|
||||
`);
|
||||
const logChannel: Promise<Channel | null> = await newMessage.guild.client.channels
|
||||
.fetch(guildData.logMsg)
|
||||
.catch((err) => console.error(err));
|
||||
if (logChannel) {
|
||||
.catch((err) => { console.error(err); });
|
||||
logChannel.send({
|
||||
embeds: [
|
||||
log,
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue