mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-08 15:18:52 +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:
@@ -1,15 +1,16 @@
|
||||
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const { Events, ChannelType } = require("discord.js");
|
||||
const { Events, ChannelType, EmbedBuilder } = require("discord.js");
|
||||
const db = new sqlite3.Database('myDatabase.db');
|
||||
const { getPermissionLevel } = require('../../fonction/getPermissionLevel');
|
||||
|
||||
module.exports = {
|
||||
name: Events.MessageCreate,
|
||||
async execute(message, client) {
|
||||
const botId = message.client.user.id;
|
||||
const guildId = message.guild.id;
|
||||
|
||||
if (message.channel.type === ChannelType.DM) return;
|
||||
if (!message.content.includes('@everyone')) return;
|
||||
|
||||
let data = await new Promise((resolve, reject) => {
|
||||
db.get('SELECT value FROM gestion WHERE id = ?', [botId], (err, row) => {
|
||||
if (err) {
|
||||
@@ -19,28 +20,70 @@ module.exports = {
|
||||
resolve(row ? JSON.parse(row.value) : {});
|
||||
});
|
||||
});
|
||||
|
||||
const antieveryoneConfig = data[guildId]?.antieveryone;
|
||||
let status = 'off';
|
||||
|
||||
const antileakConfig = data[guildId]?.antileak;
|
||||
const antimentionConfig = data[guildId]?.antimention;
|
||||
let statusEveryone = 'off';
|
||||
let statusLeak = 'off';
|
||||
let statusMention = 'off';
|
||||
let mentionLimit = 0;
|
||||
|
||||
if (antieveryoneConfig) {
|
||||
({ status} = antieveryoneConfig);
|
||||
}
|
||||
if (status === "off") return;
|
||||
({ status: statusEveryone } = antieveryoneConfig);
|
||||
}
|
||||
|
||||
if (antileakConfig) {
|
||||
({ status: statusLeak } = antileakConfig);
|
||||
}
|
||||
if (antimentionConfig) {
|
||||
({ status: statusMention, nombre: mentionLimit } = antimentionConfig);
|
||||
}
|
||||
if (statusEveryone === "off" && statusLeak === "off") return;
|
||||
|
||||
data.whitelist = data.whitelist || {};
|
||||
data.whitelist[guildId] = data.whitelist[guildId] || {};
|
||||
const whitelist = data.whitelist[guildId];
|
||||
const user = message.member;
|
||||
if (status === "on") {
|
||||
if (await getPermissionLevel(user, client) >= 10) return;
|
||||
if (whitelist[message.author.id]) return;
|
||||
message.delete().catch(err => {;
|
||||
});
|
||||
} else if (status === "max") {
|
||||
const levelperm = await getPermissionLevel(user, client);
|
||||
if (levelperm >= 10) return;
|
||||
message.delete().catch(err => {;
|
||||
});
|
||||
|
||||
if (statusEveryone !== "off" && message.content.includes('@everyone')) {
|
||||
if(message.author.id === client.user.id)return;
|
||||
if (statusEveryone === "on") {
|
||||
if (await getPermissionLevel(user, client) >= 10) return;
|
||||
if (whitelist[message.author.id]) return;
|
||||
message.delete().catch(err => {;
|
||||
});
|
||||
} else if (statusEveryone === "max") {
|
||||
const levelperm = await getPermissionLevel(user, client);
|
||||
if (levelperm >= 10) return;
|
||||
message.delete().catch(err => {;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (statusLeak !== "off") {
|
||||
if (message.author.bot) return;
|
||||
const ipRegex = /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/;
|
||||
const phoneRegex = /\b(?:\+?(\d{1,3}))?[-. (]*(?:\d{1,4})[-. )]*(\d{1,3})[-. ]*(\d{2,4})\b/;
|
||||
const addressRegex = /\b\d{1,5} [\w\s]+(?:, [\w\s]+)*\b/;
|
||||
const cardRegex = /\b(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9]{2})[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})\b/;
|
||||
|
||||
const cardMatch = message.content.match(cardRegex);
|
||||
const ipMatch = message.content.match(ipRegex);
|
||||
const phoneMatch = message.content.match(phoneRegex);
|
||||
const addressMatch = message.content.match(addressRegex);
|
||||
|
||||
if (ipMatch || phoneMatch || addressMatch || cardMatch) {
|
||||
if (statusLeak === 'on') {
|
||||
if (await getPermissionLevel(user, client) >= 10) return;
|
||||
if (whitelist[message.author.id]) return;
|
||||
message.delete().catch(err => {});
|
||||
} else if (statusLeak === 'max') {
|
||||
const levelperm = await getPermissionLevel(user, client);
|
||||
if (levelperm >= 10) return;
|
||||
message.delete().catch(err => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user