mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-06 14:20:38 +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,53 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const { Events, ChannelType } = 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;
|
||||
const user = message.member;
|
||||
if (message.channel.type === ChannelType.DM) return;
|
||||
|
||||
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 antimentionConfig = data[guildId]?.antimention;
|
||||
let statusMention = 'off';
|
||||
let mentionLimit = 0;
|
||||
|
||||
if (antimentionConfig) {
|
||||
({ type: statusMention, nombre: mentionLimit } = antimentionConfig);
|
||||
}
|
||||
|
||||
if (statusMention !== "off") {
|
||||
const mentionCount = message.mentions.users.size;
|
||||
if (mentionLimit === 0) return;
|
||||
if (mentionCount > mentionLimit) {
|
||||
if (statusMention === "wl" || statusMention === "whitelist") {
|
||||
if (await getPermissionLevel(user, client) >= 10) return;
|
||||
if (whitelist[message.author.id]) return;
|
||||
message.delete().catch(err => {});
|
||||
}else if (statusMention === "owner") {
|
||||
const userlevelsawait = await getPermissionLevel(user, client)
|
||||
if (userlevelsawait >= 10) return;
|
||||
message.delete().catch(err => {});
|
||||
}else if (statusMention === "buyer") {
|
||||
if (await getPermissionLevel(user, client) === 11) return;
|
||||
if (whitelist[message.author.id]) return;
|
||||
message.delete().catch(err => {});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user