Files
gestion/loaders/events/logs/channelCreate.js
T
VALOU3336 9bd39c69ca grand commit que tutur attend ( marche pas le raidmode en dev)
sinon il y a pleins de truc comme les anti raid , des coorectif ect
2024-04-22 18:30:33 +02:00

27 lines
1.0 KiB
JavaScript

const { EmbedBuilder, Events } = require('discord.js');
const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database('myDatabase.db');
module.exports = {
name: Events.ChannelCreate,
execute(channel) {
db.get('SELECT value FROM gestion WHERE id = ?', [channel.client.user.id], (err, row) => {
if (err) {
console.error(err.message);
return;
}
const data = row ? JSON.parse(row.value) : {};
const logChannelId = data[channel.guild.id]?.channelog;
if (logChannelId) {
const logChannel = channel.guild.channels.cache.get(logChannelId);
if (logChannel) {
const embed = new EmbedBuilder()
.setColor('#0099ff')
.setDescription(`Un nouveau salon a été créé : ${channel.name}`)
.setTimestamp();
logChannel.send({ embeds: [embed] });
}
}
});
},
};