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] }); } } }); }, };