mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-09 01:01:47 +02:00
9bd39c69ca
sinon il y a pleins de truc comme les anti raid , des coorectif ect
36 lines
1.3 KiB
JavaScript
36 lines
1.3 KiB
JavaScript
const { Events , EmbedBuilder } = require('discord.js');
|
|
const sqlite3 = require('sqlite3').verbose();
|
|
const db = new sqlite3.Database('myDatabase.db');
|
|
|
|
module.exports = {
|
|
name: Events.GuildMemberAdd,
|
|
async execute(member, client) {
|
|
const botId = client.user.id;
|
|
let data = await new Promise((resolve, reject) => {
|
|
db.get('SELECT value FROM gestion WHERE id = ?', [botId], (err, row) => {
|
|
if (err) {
|
|
console.error(err.message);
|
|
reject(err);
|
|
}
|
|
resolve(row ? JSON.parse(row.value) : {});
|
|
});
|
|
});
|
|
const blacklist = data.blacklist || {};
|
|
if (blacklist[member.id]) {
|
|
try {
|
|
await member.ban({ reason: 'Blacklisted ' });
|
|
const embed = new EmbedBuilder()
|
|
.setColor('#ff0000')
|
|
.setDescription(`L'utilisateur <@${member.id}> a été banni pour être sur la blacklist.`);
|
|
const raidLogChannelId = data[member.guild.id].raidlog;
|
|
const raidLogChannel = member.guild.channels.cache.get(raidLogChannelId);
|
|
if (raidLogChannel) {
|
|
raidLogChannel.send({ embeds: [embed] });
|
|
}
|
|
} catch (error) {
|
|
}
|
|
}
|
|
},
|
|
};
|
|
|