mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-14 15:56:21 +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: 'antiadmin',
|
||||
description: 'Gère la protection contre les actions d\'administrateur dans le serveur.',
|
||||
utilisation: 'antiadmin <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: `+antiadmin 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].antiadmin = null;
|
||||
message.reply(`La protection contre les actions d'administrateur a été désactivée.`);
|
||||
} else {
|
||||
data[guildId].antiadmin = {
|
||||
type: type,
|
||||
action: action
|
||||
};
|
||||
message.reply(`La protection contre les actions d'administrateur 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.');
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,63 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
|
||||
module.exports = {
|
||||
name: 'antiban',
|
||||
description: 'Gère la protection contre les bans dans le serveur.',
|
||||
utilisation: 'antiban <type> <action> <nombre>',
|
||||
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];
|
||||
const args2 = args[2];
|
||||
|
||||
if (!type || !action || !args2 ||
|
||||
(type !== 'whitelist' && type !== 'wl' && type !== 'owner' && type !== 'buyer' && type !== 'off') ||
|
||||
(action !== 'derank' && action !== 'kick' && action !== 'ban' && action !== 'nothing' && action !== 'rien') ||
|
||||
isNaN(args2)) {
|
||||
return message.reply('Veuillez utiliser la commande correctement: `+antiban whitelist/owner/buyer/off derank/kick/ban/nothing <nombre>`.');
|
||||
}
|
||||
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].antiban = null;
|
||||
message.reply(`La protection contre les bans a été désactivée.`);
|
||||
} else {
|
||||
data[guildId].antiban = {
|
||||
type: type,
|
||||
action: action,
|
||||
number: args2
|
||||
};
|
||||
message.reply(`La protection contre les bans a été configurée pour les ${type} avec l'action ${action} et le max de ${args2}.`);
|
||||
}
|
||||
|
||||
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.');
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
|
||||
module.exports = {
|
||||
name: 'antibot',
|
||||
description: 'Gère la protection contre les bots dans le serveur.',
|
||||
utilisation: 'antibot <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: `+antibot 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].antibot = null;
|
||||
message.reply(`La protection contre les bots a été désactivée.`);
|
||||
} else {
|
||||
data[guildId].antibot = {
|
||||
type: type,
|
||||
action: action
|
||||
};
|
||||
message.reply(`La protection contre les bots 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.');
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
|
||||
module.exports = {
|
||||
name: 'antichannel',
|
||||
description: 'Gère la protection contre les channel dans le serveur.',
|
||||
utilisation: 'antichannel <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: `+antichannel 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].antichannel = null;
|
||||
message.reply(`La protection contre les channel a été désactivée.`);
|
||||
} else {
|
||||
data[guildId].antichannel = {
|
||||
type: type,
|
||||
action: action
|
||||
};
|
||||
message.reply(`La protection contre les channel 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.');
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -4,9 +4,9 @@ const db = new sqlite3.Database('myDatabase.db');
|
||||
module.exports = {
|
||||
name: 'antieveryone',
|
||||
description: 'Active ou désactive la protection contre les mentions de tout le monde dans le serveur.',
|
||||
utilisation: '+antieveryone on/off',
|
||||
utilisation: 'antieveryone on/off',
|
||||
category: 'antiraid',
|
||||
|
||||
emote: '📢',
|
||||
async execute(message, args, client) {
|
||||
const botId = client.user.id;
|
||||
const guildId = message.guild.id;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
|
||||
module.exports = {
|
||||
name: 'antijoin',
|
||||
description: 'Active ou désactive la protection contre les nouveaux membres rejoignant le serveur.',
|
||||
utilisation: 'antijoin on/off',
|
||||
category: 'antiraid',
|
||||
emote: '🚪',
|
||||
async execute(message, args, client) {
|
||||
const botId = client.user.id;
|
||||
const guildId = message.guild.id;
|
||||
const status = args[0];
|
||||
|
||||
if (!status || (status !== 'on' && status !== 'off')) {
|
||||
return message.reply('Veuillez utiliser la commande correctement: `+antijoin on/off`.');
|
||||
}
|
||||
|
||||
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] = {};
|
||||
}
|
||||
|
||||
data[guildId].antijoin = {
|
||||
status: status
|
||||
};
|
||||
|
||||
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.');
|
||||
}
|
||||
message.reply(`La protection contre les nouveaux membres a été ${status === 'on' ? 'activée' : 'désactivée'}.`);
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
|
||||
module.exports = {
|
||||
name: 'antileak',
|
||||
description: 'Active ou désactive la protection contre les fuites de données dans le serveur.',
|
||||
utilisation: 'antileak on/off',
|
||||
category: 'antiraid',
|
||||
emote: '🔒',
|
||||
async execute(message, args, client) {
|
||||
const botId = client.user.id;
|
||||
const guildId = message.guild.id;
|
||||
const status = args[0];
|
||||
|
||||
if (!status || (status !== 'on' && status !== 'off' && status !== 'max')) {
|
||||
return message.reply('Veuillez utiliser la commande correctement: `+antileak on/off`.');
|
||||
}
|
||||
|
||||
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] = {};
|
||||
}
|
||||
|
||||
data[guildId].antileak = {
|
||||
status: status
|
||||
};
|
||||
|
||||
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.');
|
||||
}
|
||||
message.reply(`La protection contre les fuites de données a été ${status === 'on' ? 'activée' : status === 'max' ? 'maximisée' : 'désactivée'}.`);
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -4,9 +4,9 @@ const db = new sqlite3.Database('myDatabase.db');
|
||||
module.exports = {
|
||||
name: 'antilink',
|
||||
description: 'Active ou désactive la protection contre les liens dans le serveur.',
|
||||
utilisation: '+antilink on/off all/invite',
|
||||
utilisation: 'antilink on/off all/invite',
|
||||
category: 'antiraid',
|
||||
|
||||
emote: '🔗',
|
||||
async execute(message, args, client) {
|
||||
const botId = client.user.id;
|
||||
const guildId = message.guild.id;
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
|
||||
module.exports = {
|
||||
name: 'antimention',
|
||||
description: 'Gère la protection contre les mentions dans le serveur.',
|
||||
utilisation: 'antimention <type> <nombre>',
|
||||
category: 'antiraid',
|
||||
emote: '✋',
|
||||
async execute(message, args, client) {
|
||||
const botId = client.user.id;
|
||||
const guildId = message.guild.id;
|
||||
let type = args[0];
|
||||
const nombre = args[1];
|
||||
|
||||
if (!type || !nombre ||
|
||||
(type !== 'whitelist' && type !== 'wl' && type !== 'owner' && type !== 'buyer' && type !== 'off')) {
|
||||
return message.reply('Veuillez utiliser la commande correctement: `+antimention whitelist/owner/buyer/off <nombre>`.');
|
||||
}
|
||||
if (type === 'wl') {
|
||||
type = 'whitelist';
|
||||
}
|
||||
if (isNaN(nombre)) {
|
||||
return message.reply('Le nombre fourni n\'est pas valide. Veuillez fournir un nombre.');
|
||||
}
|
||||
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].antimention = null;
|
||||
message.reply(`La protection contre les mentions a été désactivée.`);
|
||||
} else {
|
||||
data[guildId].antimention = {
|
||||
type: type,
|
||||
nombre: nombre
|
||||
};
|
||||
message.reply(`La protection contre les mentions a été configurée pour les ${type} avec un nombre de ${nombre}.`);
|
||||
}
|
||||
|
||||
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.');
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
|
||||
module.exports = {
|
||||
name: 'antirole',
|
||||
description: 'Gère la protection contre les rôles dans le serveur.',
|
||||
utilisation: 'antirole <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: `+antirole 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].antirole = null;
|
||||
message.reply(`La protection contre les rôles a été désactivée.`);
|
||||
} else {
|
||||
data[guildId].antirole = {
|
||||
type: type,
|
||||
action: action
|
||||
};
|
||||
message.reply(`La protection contre les rôles 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.');
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -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.');
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
|
||||
module.exports = {
|
||||
name: 'antiupdate',
|
||||
description: 'Gère la protection contre les mises à jour de canal dans le serveur.',
|
||||
utilisation: 'antiupdate <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: `+antiupdate 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].antiupdate = null;
|
||||
message.reply(`La protection contre les mises à jour du serveur a été désactivée.`);
|
||||
} else {
|
||||
data[guildId].antiupdate = {
|
||||
type: type,
|
||||
action: action
|
||||
};
|
||||
message.reply(`La protection contre les mises à jour du serveur 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.');
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
|
||||
module.exports = {
|
||||
name: 'antiwebhook',
|
||||
description: 'Gère la protection contre les webhooks dans le serveur.',
|
||||
utilisation: 'antiwebhook <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: `+antiwebhook 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].antiwebhook = null;
|
||||
message.reply(`La protection contre les webhooks a été désactivée.`);
|
||||
} else {
|
||||
data[guildId].antiwebhook = {
|
||||
type: type,
|
||||
action: action
|
||||
};
|
||||
message.reply(`La protection contre les webhooks 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.');
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
+27
-13
@@ -7,19 +7,32 @@ module.exports = {
|
||||
category: 'antiraid',
|
||||
async execute(message, args, client) {
|
||||
const guild = message.guild;
|
||||
const dangerousPermissions = [
|
||||
PermissionsBitField.Flags.Administrator,
|
||||
PermissionsBitField.Flags.ManageGuild,
|
||||
PermissionsBitField.Flags.ManageRoles,
|
||||
PermissionsBitField.Flags.ManageChannels,
|
||||
PermissionsBitField.Flags.KickMembers,
|
||||
PermissionsBitField.Flags.BanMembers,
|
||||
PermissionsBitField.Flags.ManageWebhooks,
|
||||
PermissionsBitField.Flags.MuteMembers,
|
||||
PermissionsBitField.Flags.MentionEveryone,
|
||||
PermissionsBitField.Flags.ManageEvents,
|
||||
PermissionsBitField.Flags.ManageThreads,
|
||||
];
|
||||
const dangerousPermissions = [
|
||||
PermissionsBitField.Flags.Administrator,
|
||||
PermissionsBitField.Flags.ManageGuild,
|
||||
PermissionsBitField.Flags.ManageRoles,
|
||||
PermissionsBitField.Flags.ManageChannels,
|
||||
PermissionsBitField.Flags.KickMembers,
|
||||
PermissionsBitField.Flags.BanMembers,
|
||||
PermissionsBitField.Flags.ManageWebhooks,
|
||||
PermissionsBitField.Flags.MuteMembers,
|
||||
PermissionsBitField.Flags.MentionEveryone,
|
||||
PermissionsBitField.Flags.ManageEvents,
|
||||
PermissionsBitField.Flags.ManageThreads,
|
||||
];
|
||||
if(args[0] === 'bot') {
|
||||
await Promise.all(guild.members.cache.filter(member => member.user.bot).map(member => member.kick()));
|
||||
return message.reply("Tous les bots ont bien été supprimés du serveur");
|
||||
}else if (args[0] === 'role') {
|
||||
await Promise.all(guild.roles.cache.filter(role => dangerousPermissions.some(permission => role.permissions.has(permission))).map(role => role.delete()));
|
||||
return message.reply("Tous les rôles dangereux ont bien été supprimés du serveur");
|
||||
}else if (args[0] === 'salon' || args[0] === 'channels') {
|
||||
await Promise.all(guild.channels.cache.map(async (channel) => {
|
||||
const permissionOverwrites = channel.permissionOverwrites.cache.filter(overwrite => dangerousPermissions.some(permission => overwrite.allow.has(permission) || overwrite.deny.has(permission)));
|
||||
await Promise.all(permissionOverwrites.map(overwrite => channel.permissionOverwrites.edit(overwrite.id, {})));
|
||||
}));
|
||||
return message.reply("Toutes les permissions dangereuses sur les salons ont bien été supprimées du serveur");
|
||||
}else {
|
||||
|
||||
// Kick all bots
|
||||
await Promise.all(guild.members.cache.filter(member => member.user.bot).map(member => member.kick()));
|
||||
@@ -34,5 +47,6 @@ module.exports = {
|
||||
}));
|
||||
|
||||
await message.reply('Le serveur a bien été sécurisé');
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
|
||||
module.exports = {
|
||||
name: 'creationlimit',
|
||||
description: 'Définit une limite de création de salon après un certain nombre de jours.',
|
||||
utilisation: 'creationlimit off/10d',
|
||||
category: 'antiraid',
|
||||
emote: '🔗',
|
||||
async execute(message, args, client) {
|
||||
const botId = client.user.id;
|
||||
const guildId = message.guild.id;
|
||||
const limit = args[0];
|
||||
|
||||
if (!limit || (limit !== 'off' && !limit.match(/^\d+(m|h|d|w)$/))) {
|
||||
return message.reply('Veuillez utiliser la commande correctement: `+creationlimit off/temps`.');
|
||||
}
|
||||
|
||||
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 (limit === 'off') {
|
||||
data[guildId].creationLimit = null;
|
||||
} else {
|
||||
data[guildId].creationLimit = limit;
|
||||
}
|
||||
|
||||
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.');
|
||||
}
|
||||
message.reply(`La limite de création de compte a été ${limit === 'off' ? 'désactivée' : `fixée à ${limit}`}.`);
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,98 @@
|
||||
const { PermissionsBitField } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'dperm',
|
||||
description: 'Supprime une permission spécifiée de tous les rôles qui l\'ont',
|
||||
async execute(message, args) {
|
||||
if (!args[0]) {
|
||||
return message.reply('Veuillez spécifier une permission à supprimer.');
|
||||
}
|
||||
switch (args[0].toLowerCase()) {
|
||||
case 'ban':
|
||||
const permissionToRemove = PermissionsBitField.Flags.BanMembers;
|
||||
if (!permissionToRemove) {
|
||||
return message.reply('Permission invalide.');
|
||||
}
|
||||
|
||||
for (const role of message.guild.roles.cache.values()) {
|
||||
console.log(role.name + '; ' + permissionToRemove + ' ;' + role.permissions);
|
||||
if (role.permissions.has(permissionToRemove)) {
|
||||
console.log(`Attempting to remove ban permission from role: ${role.name}`);
|
||||
try {
|
||||
await role.permissions.remove(PermissionsBitField.Flags.BanMembers);
|
||||
console.log(`Successfully removed ban permission from role: ${role.name}`);
|
||||
} catch (error) {
|
||||
console.log(`Failed to remove ban permission from role: ${role.name}. Error: ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
message.reply(`La permission ${args[0]} a été supprimée de tous les rôles qui l'avaient.`);
|
||||
|
||||
break;
|
||||
case 'webhook':
|
||||
let permissionToRemove1 = PermissionsBitField.Flags.ManageWebhooks
|
||||
if (!permissionToRemove1) {
|
||||
return message.reply('Permission invalide.');
|
||||
}
|
||||
|
||||
message.guild.roles.cache.forEach(role => {
|
||||
if (role.permissions.has(permissionToRemove1)) {
|
||||
role.permissions.remove(permissionToRemove1)
|
||||
.then(updatedRole => {
|
||||
console.log(`Permission ${args[0]} supprimée du rôle ${updatedRole.name}`);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(`Erreur lors de la suppression de la permission ${args[0]} du rôle ${role.name}: ${error}`);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
message.reply(`La permission ${args[0]} a été supprimée de tous les rôles qui l'avaient.`);
|
||||
break;
|
||||
case 'role':
|
||||
let permissionToRemove2 = PermissionsBitField.Flags.ManageRoles
|
||||
if (!permissionToRemove2) {
|
||||
return message.reply('Permission invalide.');
|
||||
}
|
||||
|
||||
message.guild.roles.cache.forEach(role => {
|
||||
if (role.permissions.has(permissionToRemove2)) {
|
||||
role.permissions.remove(permissionToRemove2)
|
||||
.then(updatedRole => {
|
||||
console.log(`Permission ${args[0]} supprimée du rôle ${updatedRole.name}`);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(`Erreur lors de la suppression de la permission ${args[0]} du rôle ${role.name}: ${error}`);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
message.reply(`La permission ${args[0]} a été supprimée de tous les rôles qui l'avaient.`);
|
||||
break;
|
||||
case 'servers' || 'serveur':
|
||||
let permissionToRemove3 = PermissionsBitField.Flags.ManageGuild
|
||||
if (!permissionToRemove3) {
|
||||
return message.reply('Permission invalide.');
|
||||
}
|
||||
|
||||
message.guild.roles.cache.forEach(role => {
|
||||
if (role.permissions.has(permissionToRemove3)) {
|
||||
role.permissions.remove(permissionToRemove3)
|
||||
.then(updatedRole => {
|
||||
console.log(`Permission ${args[0]} supprimée du rôle ${updatedRole.name}`);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(`Erreur lors de la suppression de la permission ${args[0]} du rôle ${role.name}: ${error}`);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
message.reply(`La permission ${args[0]} a été supprimée de tous les rôles qui l'avaient.`);
|
||||
break;
|
||||
default:
|
||||
return message.reply('Permission invalide.');
|
||||
}
|
||||
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
|
||||
module.exports = {
|
||||
name: 'raidmode',
|
||||
description: 'Active ou désactive le mode raid pour supprimer une permission spécifiée de tous les rôles qui l\'ont',
|
||||
async execute(message, args) {
|
||||
const botId = message.client.user.id;
|
||||
const guildId = message.guild.id;
|
||||
const guild = message.guild
|
||||
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 isRaidModeActive = data.guildid && data.guildid[guildId] && data.guildid[guildId].secur.raidmode;
|
||||
|
||||
const newRaidModeValue = !isRaidModeActive;
|
||||
db.run('INSERT OR REPLACE INTO gestion (id, value) VALUES (?, ?)', [`${botId}.${guildId}`, JSON.stringify({ secur: { raidmode: newRaidModeValue } })], (err) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
message.reply('Une erreur s\'est produite lors de la mise à jour du mode raid.');
|
||||
} else {
|
||||
if (newRaidModeValue) {
|
||||
guild.disableInvites(true)
|
||||
message.reply('Le mode raid est maintenant activé.');
|
||||
} else {
|
||||
guild.disableInvites(false);
|
||||
message.reply('Le mode raid n\'est plus activé.');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -9,10 +9,22 @@ module.exports = {
|
||||
utilisation: 'rolelimit',
|
||||
category: 'antiraid',
|
||||
|
||||
async execute(interaction) {
|
||||
const botId = interaction.client.user.id;
|
||||
const guildId = interaction.guild.id;
|
||||
|
||||
async execute(message, args, client) {
|
||||
const botId = message.client.user.id;
|
||||
const guildId = message.guild.id;
|
||||
const clear = args[0] === "clear"
|
||||
console.log(clear)
|
||||
if (args[0] === "clear") {
|
||||
db.run('DELETE FROM gestion WHERE id LIKE ?', [`${botId}.${guildId}.rolelimits%`], (err) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
return message.reply('Une erreur s\'est produite lors de la suppression des rôles limités.');
|
||||
} else {
|
||||
return message.reply('Tous les rôles limités ont été supprimés avec succès.');
|
||||
}
|
||||
});
|
||||
|
||||
}else {
|
||||
let limitedRoles = await new Promise((resolve, reject) => {
|
||||
db.get('SELECT value FROM gestion WHERE id = ?', [`${botId}.${guildId}.rolelimits`], (err, row) => {
|
||||
if (err) {
|
||||
@@ -27,7 +39,6 @@ module.exports = {
|
||||
limitedRoles = [];
|
||||
}
|
||||
|
||||
// Crée un embed avec les rôles limités
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Rôles limités')
|
||||
.setDescription(limitedRoles.map(role => `<@&${role.id}>: ${role.limit}`).join('\n') || 'Aucun rôle limité.')
|
||||
@@ -45,7 +56,7 @@ module.exports = {
|
||||
.setStyle(ButtonStyle.Danger);
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(addButton, removeButton);
|
||||
const sentMessage = await interaction.reply({ embeds: [embed], components: [row], fetchReply: true });
|
||||
const sentMessage = await message.reply({ embeds: [embed], components: [row], fetchReply: true });
|
||||
|
||||
|
||||
const filter = i => i.isButton() && i.customId.startsWith('rolelimit_') && i.user;
|
||||
@@ -57,7 +68,7 @@ module.exports = {
|
||||
const questionMessage = await i.reply('Mentionnez un rôle ou fournissez un ID de rôle à limiter.');
|
||||
const filter = m => m.author && m.author.id === i.user.id;
|
||||
const collected = await i.channel.awaitMessages({ filter, max: 1, time: 60000 });
|
||||
const role = collected.first().mentions.roles.first() || interaction.guild.roles.cache.get(collected.first().content);
|
||||
const role = collected.first().mentions.roles.first() || message.guild.roles.cache.get(collected.first().content);
|
||||
if (!role) {
|
||||
return i.followUp('Rôle invalide.');
|
||||
}
|
||||
@@ -103,7 +114,7 @@ module.exports = {
|
||||
const questionMessage = await i.reply('Mentionnez un rôle ou fournissez un ID de rôle à supprimer.');
|
||||
const filter = m => m.author && m.author.id === i.user.id;
|
||||
const collected = await i.channel.awaitMessages({ filter, max: 1, time: 60000 });
|
||||
const roleToRemove = collected.first().mentions.roles.first() || interaction.guild.roles.cache.get(collected.first().content);
|
||||
const roleToRemove = collected.first().mentions.roles.first() || message.guild.roles.cache.get(collected.first().content);
|
||||
if (!roleToRemove) {
|
||||
return i.followUp('Rôle invalide.');
|
||||
}
|
||||
@@ -134,5 +145,6 @@ module.exports = {
|
||||
collector.on('end', collected => {
|
||||
sentMessage.edit({ components: [] });
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,352 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
name: 'secur',
|
||||
aliases: ['antriraid'],
|
||||
description: 'Affiche les configurations des antiraid.',
|
||||
utilisation: 'secur',
|
||||
category: 'antiraid',
|
||||
|
||||
async execute(message, args, client) {
|
||||
const botId = client.user.id;
|
||||
const guildId = message.guild.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 guildData = data[guildId] || {};
|
||||
const antiupdateConfig = guildData.antiupdate || {};
|
||||
const antibotConfig = guildData.antibot || {};
|
||||
const antiroleConfig = guildData.antirole || {};
|
||||
const antichannelConfig = guildData.antichannel || {};
|
||||
const antiwebhookConfig = guildData.antiwebhook || {};
|
||||
const antibanConfig = guildData.antiban || {};
|
||||
const antithreadConfig = guildData.antiThread || {};
|
||||
|
||||
const desac = new ButtonBuilder()
|
||||
.setLabel('Désactiver tous les modules')
|
||||
.setCustomId(`off_${guildId}`)
|
||||
.setStyle(ButtonStyle.Danger);
|
||||
|
||||
const on = new ButtonBuilder()
|
||||
.setLabel('Activer tous les modules')
|
||||
.setCustomId(`on_${guildId}`)
|
||||
.setStyle(ButtonStyle.Success);
|
||||
const button1 = new ButtonBuilder()
|
||||
.setLabel("◀")
|
||||
.setCustomId('part1')
|
||||
.setStyle(ButtonStyle.Secondary);
|
||||
|
||||
const button2 = new ButtonBuilder()
|
||||
.setLabel("▶")
|
||||
.setCustomId('part2')
|
||||
.setStyle(ButtonStyle.Secondary);
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(button1, button2,on, desac);
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Configurations des antiraid - Partie 1')
|
||||
.setColor('#0099ff')
|
||||
.addFields(
|
||||
{ name: '**1・Anti-Update**', value: `**Actif**: \`${antiupdateConfig.type === 'off' || !antiupdateConfig.type ? '❌' : '✅'}\`** : **\`${antiupdateConfig.type ? antiupdateConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiupdateConfig.action || "Non Définie"}\``},
|
||||
{ name: '**2・Anti-bot**', value: `**Actif**: \`${antibotConfig.type === 'off' || !antibotConfig.type ? '❌' : '✅'}\`** : **\`${antibotConfig.type ? antibotConfig.type: "indéterminé"}\`\n **Sanction: **\`${antibotConfig.action || "Non Définie"}\``},
|
||||
{ name: '**3・Anti-Role**', value: `**Actif**: \`${antiroleConfig.type === 'off' || !antiroleConfig.type ? '❌' : '✅'}\`** : **\`${antiroleConfig.type ? antiroleConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiroleConfig.action || "Non Définie"}\``},
|
||||
{ name: '**4・Anti-Channel**', value: `**Actif**: \`${antichannelConfig.type === 'off' || !antichannelConfig.type ? '❌' : '✅'}\`** : **\`${antichannelConfig.type ? antichannelConfig.type: "indéterminé"}\`\n **Sanction: **\`${antichannelConfig.action || "Non Définie"}\``},
|
||||
{ name: '**5・Anti-Webhook**', value: `**Actif**: \`${antiwebhookConfig.type === 'off' || !antiwebhookConfig.type ? '❌' : '✅'}\`** : **\`${antiwebhookConfig.type ? antiwebhookConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiwebhookConfig.action || "Non Définie"}\``},
|
||||
{ name: '**6・Anti-Thread**', value: `**Actif**: \`${antithreadConfig.type === 'off' || !antithreadConfig.type ? '❌' : '✅'}\`** : **\`${antithreadConfig.type ? antithreadConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiwebhookConfig.action || "Non Définie"}\``},
|
||||
{ name: '**8・Anti-Ban**', value: `**Actif**: \`${antibanConfig.type === 'off' || !antibanConfig.type ? '❌' : '✅'}\`** : **\`${antibanConfig.type ? antibanConfig.type: "indéterminé"}\`\n **Sanction: **\`${antibanConfig.action || "Non Définie"}\`\n**Nombre: **\`${antibanConfig.number || 'N/A'}\``},
|
||||
);
|
||||
|
||||
|
||||
const sentMessage = await message.channel.send({ embeds: [embed], components: [row] });
|
||||
const filter = i => i.user.id === message.author.id;
|
||||
const collector = sentMessage.createMessageComponentCollector({ filter, time: 60000 });
|
||||
collector.on('collect', async i => {
|
||||
if (i.customId.startsWith('on_')) {
|
||||
const activationmessage = await i.reply({ content: "Les modules sont en train d'être activés", ephemeral: true });
|
||||
const guildId = i.customId.split('_')[1];
|
||||
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] = {};
|
||||
}
|
||||
let type = 'whitelist'
|
||||
let status = 'on'
|
||||
data[guildId].antibot = {
|
||||
type: type,
|
||||
action: data[guildId].antibot?.action || 'kick'
|
||||
};
|
||||
data[guildId].antichannel = {
|
||||
type: type,
|
||||
action: data[guildId].antichannel?.action || 'kick'
|
||||
};
|
||||
data[guildId].antiadmin = {
|
||||
type: type,
|
||||
action: data[guildId].antiadmin?.action || 'kick'
|
||||
};
|
||||
data[guildId].antieveryone = {
|
||||
status: status
|
||||
};
|
||||
data[guildId].antilink = {
|
||||
status: status,
|
||||
type: 'all'
|
||||
};
|
||||
data[guildId].antileak = {
|
||||
status: status,
|
||||
};
|
||||
data[guildId].antiThread = {
|
||||
type: type,
|
||||
action: data[guildId].antiThread?.action || 'kick'
|
||||
};
|
||||
data[guildId].antimention = {
|
||||
type: type,
|
||||
nombre: data[guildId].antimention?.nombre || 0
|
||||
};
|
||||
data[guildId].antirole = {
|
||||
type: type,
|
||||
action: data[guildId].antirole?.action || 'kick'
|
||||
};
|
||||
data[guildId].antiupdate = {
|
||||
type: type,
|
||||
action: data[guildId].antiupdate?.action || 'kick'
|
||||
};
|
||||
data[guildId].antiwebhook = {
|
||||
type: type,
|
||||
action: data[guildId].antiwebhook?.action || 'kick'
|
||||
};
|
||||
data[guildId].antiban = {
|
||||
type: type,
|
||||
action: data[guildId].antiban?.action || 'kick',
|
||||
number: data[guildId].antiban?.number || "10"
|
||||
};
|
||||
db.run('INSERT OR REPLACE INTO gestion (id, value) VALUES (?, ?)', [botId, JSON.stringify(data)], async function(err) {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
return i.reply({ content: 'Une erreur est survenue lors de la mise à jour de la configuration.', ephemeral: true });
|
||||
} else {
|
||||
activationmessage.edit({ content: "Les modules ont été activés avec succès." });
|
||||
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 guildData = data[guildId] || {};
|
||||
const antiupdateConfig = guildData.antiupdate || {};
|
||||
const antibotConfig = guildData.antibot || {};
|
||||
const antiroleConfig = guildData.antirole || {};
|
||||
const antichannelConfig = guildData.antichannel || {};
|
||||
const antiwebhookConfig = guildData.antiwebhook || {};
|
||||
const antibanConfig = guildData.antiban || {};
|
||||
const antithreadConfig = guildData.antiThread || {};
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Configurations des antiraid - Partie 1')
|
||||
.setColor('#0099ff')
|
||||
.addFields(
|
||||
{ name: '**1・Anti-Update**', value: `**Actif**: \`${antiupdateConfig.type === 'off' || !antiupdateConfig.type ? '❌' : '✅'}\`** : **\`${antiupdateConfig.type ? antiupdateConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiupdateConfig.action || "Non Définie"}\``},
|
||||
{ name: '**2・Anti-bot**', value: `**Actif**: \`${antibotConfig.type === 'off' || !antibotConfig.type ? '❌' : '✅'}\`** : **\`${antibotConfig.type ? antibotConfig.type: "indéterminé"}\`\n **Sanction: **\`${antibotConfig.action || "Non Définie"}\``},
|
||||
{ name: '**3・Anti-Role**', value: `**Actif**: \`${antiroleConfig.type === 'off' || !antiroleConfig.type ? '❌' : '✅'}\`** : **\`${antiroleConfig.type ? antiroleConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiroleConfig.action || "Non Définie"}\``},
|
||||
{ name: '**4・Anti-Channel**', value: `**Actif**: \`${antichannelConfig.type === 'off' || !antichannelConfig.type ? '❌' : '✅'}\`** : **\`${antichannelConfig.type ? antichannelConfig.type: "indéterminé"}\`\n **Sanction: **\`${antichannelConfig.action || "Non Définie"}\``},
|
||||
{ name: '**5・Anti-Webhook**', value: `**Actif**: \`${antiwebhookConfig.type === 'off' || !antiwebhookConfig.type ? '❌' : '✅'}\`** : **\`${antiwebhookConfig.type ? antiwebhookConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiwebhookConfig.action || "Non Définie"}\``},
|
||||
{ name: '**6・Anti-Thread**', value: `**Actif**: \`${antithreadConfig.type === 'off' || !antithreadConfig.type ? '❌' : '✅'}\`** : **\`${antithreadConfig.type ? antithreadConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiwebhookConfig.action || "Non Définie"}\``},
|
||||
{ name: '**8・Anti-Ban**', value: `**Actif**: \`${antibanConfig.type === 'off' || !antibanConfig.type ? '❌' : '✅'}\`** : **\`${antibanConfig.type ? antibanConfig.type: "indéterminé"}\`\n **Sanction: **\`${antibanConfig.action || "Non Définie"}\`\n**Nombre: **\`${antibanConfig.number || 'N/A'}\``},
|
||||
);
|
||||
|
||||
sentMessage.edit({ embeds: [embed], components: [row] });
|
||||
}
|
||||
});
|
||||
}else if (i.customId.startsWith('off_')) {
|
||||
const desacmessage = await i.reply({ content: "Les modules sont en train d'être désactivés", ephemeral: true });
|
||||
const guildId = i.customId.split('_')[1];
|
||||
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] = {};
|
||||
}
|
||||
let type = 'off'
|
||||
let status = 'off'
|
||||
data[guildId].antibot = {
|
||||
type: type,
|
||||
action: data[guildId].antibot?.action || 'kick'
|
||||
};
|
||||
data[guildId].antichannel = {
|
||||
type: type,
|
||||
action: data[guildId].antichannel?.action || 'kick'
|
||||
};
|
||||
data[guildId].antiadmin = {
|
||||
type: type,
|
||||
action: data[guildId].antiadmin?.action || 'kick'
|
||||
};
|
||||
data[guildId].antieveryone = {
|
||||
status: status
|
||||
};
|
||||
data[guildId].antilink = {
|
||||
status: status,
|
||||
type: 'all'
|
||||
};
|
||||
data[guildId].antileak = {
|
||||
status: status,
|
||||
};
|
||||
data[guildId].antiThread = {
|
||||
type: type,
|
||||
action: data[guildId].antiThread?.action || 'kick'
|
||||
};
|
||||
data[guildId].antimention = {
|
||||
type: type,
|
||||
nombre: data[guildId].antimention?.nombre || 0
|
||||
};
|
||||
data[guildId].antirole = {
|
||||
type: type,
|
||||
action: data[guildId].antirole?.action || 'kick'
|
||||
};
|
||||
data[guildId].antiupdate = {
|
||||
type: type,
|
||||
action: data[guildId].antiupdate?.action || 'kick'
|
||||
};
|
||||
data[guildId].antiwebhook = {
|
||||
type: type,
|
||||
action: data[guildId].antiwebhook?.action || 'kick'
|
||||
};
|
||||
data[guildId].antiban = {
|
||||
type: type,
|
||||
action: data[guildId].antiban?.action || 'kick',
|
||||
number: data[guildId].antiban?.number || "10"
|
||||
};
|
||||
db.run('INSERT OR REPLACE INTO gestion (id, value) VALUES (?, ?)', [botId, JSON.stringify(data)], async function(err) {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
return desacmessage.edit({ content: 'Une erreur est survenue lors de la mise à jour de la configuration.', ephemeral: true });
|
||||
} else {
|
||||
desacmessage.edit({ content: "Les modules ont été désactivés avec succès.", ephemeral: true });
|
||||
|
||||
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 guildData = data[guildId] || {};
|
||||
const antiupdateConfig = guildData.antiupdate || {};
|
||||
const antibotConfig = guildData.antibot || {};
|
||||
const antiroleConfig = guildData.antirole || {};
|
||||
const antichannelConfig = guildData.antichannel || {};
|
||||
const antiwebhookConfig = guildData.antiwebhook || {};
|
||||
const antibanConfig = guildData.antiban || {};
|
||||
const antithreadConfig = guildData.antiThread || {};
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Configurations des antiraid - Partie 1')
|
||||
.setColor('#0099ff')
|
||||
.addFields(
|
||||
{ name: '**1・Anti-Update**', value: `**Actif**: \`${antiupdateConfig.type === 'off' || !antiupdateConfig.type ? '❌' : '✅'}\`** : **\`${antiupdateConfig.type ? antiupdateConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiupdateConfig.action || "Non Définie"}\``},
|
||||
{ name: '**2・Anti-bot**', value: `**Actif**: \`${antibotConfig.type === 'off' || !antibotConfig.type ? '❌' : '✅'}\`** : **\`${antibotConfig.type ? antibotConfig.type: "indéterminé"}\`\n **Sanction: **\`${antibotConfig.action || "Non Définie"}\``},
|
||||
{ name: '**3・Anti-Role**', value: `**Actif**: \`${antiroleConfig.type === 'off' || !antiroleConfig.type ? '❌' : '✅'}\`** : **\`${antiroleConfig.type ? antiroleConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiroleConfig.action || "Non Définie"}\``},
|
||||
{ name: '**4・Anti-Channel**', value: `**Actif**: \`${antichannelConfig.type === 'off' || !antichannelConfig.type ? '❌' : '✅'}\`** : **\`${antichannelConfig.type ? antichannelConfig.type: "indéterminé"}\`\n **Sanction: **\`${antichannelConfig.action || "Non Définie"}\``},
|
||||
{ name: '**5・Anti-Webhook**', value: `**Actif**: \`${antiwebhookConfig.type === 'off' || !antiwebhookConfig.type ? '❌' : '✅'}\`** : **\`${antiwebhookConfig.type ? antiwebhookConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiwebhookConfig.action || "Non Définie"}\``},
|
||||
{ name: '**6・Anti-Thread**', value: `**Actif**: \`${antithreadConfig.type === 'off' || !antithreadConfig.type ? '❌' : '✅'}\`** : **\`${antithreadConfig.type ? antithreadConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiwebhookConfig.action || "Non Définie"}\``},
|
||||
{ name: '**8・Anti-Ban**', value: `**Actif**: \`${antibanConfig.type === 'off' || !antibanConfig.type ? '❌' : '✅'}\`** : **\`${antibanConfig.type ? antibanConfig.type: "indéterminé"}\`\n **Sanction: **\`${antibanConfig.action || "Non Définie"}\`\n**Nombre: **\`${antibanConfig.number || 'N/A'}\``},
|
||||
);
|
||||
sentMessage.edit({ embeds: [embed], components: [row] });
|
||||
}
|
||||
});
|
||||
|
||||
}else if (i.customId === 'part1') {
|
||||
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 guildData = data[guildId] || {};
|
||||
const antiupdateConfig = guildData.antiupdate || {};
|
||||
const antibotConfig = guildData.antibot || {};
|
||||
const antiroleConfig = guildData.antirole || {};
|
||||
const antichannelConfig = guildData.antichannel || {};
|
||||
const antiwebhookConfig = guildData.antiwebhook || {};
|
||||
const antibanConfig = guildData.antiban || {};
|
||||
const antithreadConfig = guildData.antiThread || {};
|
||||
const embed1 = new EmbedBuilder()
|
||||
.setTitle('Configurations des antiraid - Partie 1')
|
||||
.setColor('#0099ff')
|
||||
.addFields(
|
||||
{ name: '**1・Anti-Update**', value: `**Actif**: \`${antiupdateConfig.type === 'off' || !antiupdateConfig.type ? '❌' : '✅'}\`** : **\`${antiupdateConfig.type ? antiupdateConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiupdateConfig.action || "Non Définie"}\``},
|
||||
{ name: '**2・Anti-bot**', value: `**Actif**: \`${antibotConfig.type === 'off' || !antibotConfig.type ? '❌' : '✅'}\`** : **\`${antibotConfig.type ? antibotConfig.type: "indéterminé"}\`\n **Sanction: **\`${antibotConfig.action || "Non Définie"}\``},
|
||||
{ name: '**3・Anti-Role**', value: `**Actif**: \`${antiroleConfig.type === 'off' || !antiroleConfig.type ? '❌' : '✅'}\`** : **\`${antiroleConfig.type ? antiroleConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiroleConfig.action || "Non Définie"}\``},
|
||||
{ name: '**4・Anti-Channel**', value: `**Actif**: \`${antichannelConfig.type === 'off' || !antichannelConfig.type ? '❌' : '✅'}\`** : **\`${antichannelConfig.type ? antichannelConfig.type: "indéterminé"}\`\n **Sanction: **\`${antichannelConfig.action || "Non Définie"}\``},
|
||||
{ name: '**5・Anti-Webhook**', value: `**Actif**: \`${antiwebhookConfig.type === 'off' || !antiwebhookConfig.type ? '❌' : '✅'}\`** : **\`${antiwebhookConfig.type ? antiwebhookConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiwebhookConfig.action || "Non Définie"}\``},
|
||||
{ name: '**6・Anti-Thread**', value: `**Actif**: \`${antithreadConfig.type === 'off' || !antithreadConfig.type ? '❌' : '✅'}\`** : **\`${antithreadConfig.type ? antithreadConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiwebhookConfig.action || "Non Définie"}\``},
|
||||
{ name: '**8・Anti-Ban**', value: `**Actif**: \`${antibanConfig.type === 'off' || !antibanConfig.type ? '❌' : '✅'}\`** : **\`${antibanConfig.type ? antibanConfig.type: "indéterminé"}\`\n **Sanction: **\`${antibanConfig.action || "Non Définie"}\`\n**Nombre: **\`${antibanConfig.number || 'N/A'}\``},
|
||||
);
|
||||
await i.update({ embeds: [embed1], components: [row] });
|
||||
} else if (i.customId === 'part2') {
|
||||
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 guildData = data[guildId] || {};
|
||||
const antilinkConfig = guildData.antilink || {};
|
||||
const antieveryoneConfig = guildData.antieveryone || {};
|
||||
const antileakConfig = guildData.antileak || {};
|
||||
const antijoinConfig = guildData.antijoin || {};
|
||||
const antiadminConfig = guildData.antiadmin || {};
|
||||
const antimentionConfig = guildData.antimention || {};
|
||||
const RaidpingConfig = guildData.raidping || 'Non Définie';
|
||||
const embed2 = new EmbedBuilder()
|
||||
.setTitle('Configurations des antiraid - Partie 2')
|
||||
.setColor('#0099ff')
|
||||
.addFields(
|
||||
{ name: '**7・Anti-Admin**', value: `**Actif**: \`${antiadminConfig.type === 'off' || !antiadminConfig.type ? '❌' : '✅'}\`** : **\`${antiadminConfig.type ? antiadminConfig.type: "indéterminé"}\`\n **Sanction: **\`${antiadminConfig.action || "Non Définie"}\``},
|
||||
{ name: '**9・Anti-MassMention**', value: `**Actif**: \`${antimentionConfig.type === 'off' || !antimentionConfig.type ? '❌' : '✅'}\`** : **\`${antimentionConfig.type ? antimentionConfig.type: "indéterminé"}\`\n**Nombre: **\`${antimentionConfig.nombre || 'N/A'}\``},
|
||||
{ name: '**10・Anti-Link**', value: `**Actif**: \`${antilinkConfig.status === 'off' || !antilinkConfig.status ? '❌' : '✅'}\`** : **\`${antilinkConfig.status ? antilinkConfig.status: "indéterminé"}\`\n **Type: **\`${antilinkConfig.type || "Non Définie"}\``},
|
||||
{ name: '**11・Anti-Everyone**', value: `**Actif**: \`${antieveryoneConfig.status === 'off' || !antieveryoneConfig.status ? '❌' : '✅'}\`** : **\`${antieveryoneConfig.status ? antieveryoneConfig.status: "indéterminé"}\``},
|
||||
{ name: '**12・Anti-Leak**', value: `**Actif**: \`${antileakConfig.status === 'off' || !antileakConfig.status ? '❌' : '✅'}\`** : **\`${antileakConfig.status ? antileakConfig.status: "indéterminé"}\``},
|
||||
{ name: '**14・Anti-Join**', value: `**Actif**: \`${antijoinConfig.status === 'off' || !antijoinConfig.status ? '❌' : '✅'}\`** : **\`${antijoinConfig.status ? antijoinConfig.status: "indéterminé"}\``},
|
||||
{ name: '**14・Creation-Limit**', value: `**Actif**: \`${guildData.creationLimit === 'off' || !guildData.creationLimit ? '❌' : '✅'}\`\n** temps **\`${guildData.creationLimit ? guildData.creationLimit : "indéterminé"}\``},
|
||||
{ name: '**15・RaidPing**', value: `\`${RaidpingConfig || 'Non definie'}\``}
|
||||
);
|
||||
await i.update({ embeds: [embed2], components: [row] });
|
||||
}
|
||||
});
|
||||
collector.on('end', collected => {
|
||||
const disabledRow = new ActionRowBuilder()
|
||||
.addComponents(button1.setDisabled(true),button2.setDisabled(true),on.setDisabled(true), desac.setDisabled(true) );
|
||||
sentMessage.edit({ components: [disabledRow] });
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user