mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-03 23:36:35 +02:00
9bd39c69ca
sinon il y a pleins de truc comme les anti raid , des coorectif ect
27 lines
1.0 KiB
JavaScript
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] });
|
|
}
|
|
}
|
|
});
|
|
},
|
|
}; |