mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-15 08:13:06 +02:00
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
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
|
||||
module.exports = {
|
||||
name: 'antithread',
|
||||
description: 'Gère la protection contre les threads dans le serveur.',
|
||||
utilisation: 'antiThread <type> <action>',
|
||||
category: 'antiraid',
|
||||
emote: '#️⃣',
|
||||
async execute(message, args, client) {
|
||||
const botId = client.user.id;
|
||||
const guildId = message.guild.id;
|
||||
let type = args[0];
|
||||
let action = args[1];
|
||||
|
||||
if (!type || !action ||
|
||||
(type !== 'whitelist' && type !== 'wl' && type !== 'owner' && type !== 'buyer' && type !== 'off') ||
|
||||
(action !== 'derank' && action !== 'kick' && action !== 'ban' && action !== 'nothing' && action !== 'rien')) {
|
||||
return message.reply('Veuillez utiliser la commande correctement: `+antiThread whitelist/owner/buyer/off derank/kick/ban/nothing`.');
|
||||
}
|
||||
if (type === 'wl') {
|
||||
type = 'whitelist';
|
||||
}
|
||||
if (action === 'rien') {
|
||||
action = 'nothing';
|
||||
}
|
||||
|
||||
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) : {});
|
||||
});
|
||||
});
|
||||
|
||||
if (!data[guildId]) {
|
||||
data[guildId] = {};
|
||||
}
|
||||
|
||||
if (type === 'off') {
|
||||
data[guildId].antiThread = null;
|
||||
message.reply(`La protection contre les threads a été désactivée.`);
|
||||
} else {
|
||||
data[guildId].antiThread = {
|
||||
type: type,
|
||||
action: action
|
||||
};
|
||||
message.reply(`La protection contre les threads a été configurée pour les ${type} avec l'action ${action}.`);
|
||||
}
|
||||
|
||||
db.run('INSERT OR REPLACE INTO gestion (id, value) VALUES (?, ?)', [botId, JSON.stringify(data)], function(err) {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
return message.reply('Une erreur est survenue lors de la mise à jour de la configuration.');
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user