Skip to content
Snippets Groups Projects
Commit 680f0a02 authored by Sofiane Lasri's avatar Sofiane Lasri
Browse files

Ajout des shadowban.

parent f59c0dc5
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,9 @@ const moment = require('moment');
// Schedule
const schedule = require('node-schedule');
// Shadow ban ids
const shadowBanIds = [config.get("SHADOW_BAN_ID")];
////////////////////////////////////////////////////////////////
// MODELES DES TABLES
////////////////////////////////////////////////////////////////
......@@ -275,12 +278,13 @@ recursiveAsyncReadLine(); //we have to actually start our recursion somehow
// BOT DISCORD
////////////////////////////////////////////////////////////////
// require the needed discord.js classes
const { Client, GatewayIntentBits, WebhookClient } = require('discord.js');
const { Client, GatewayIntentBits, WebhookClient, EmbedBuilder} = require('discord.js');
// create a new Discord client
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.DirectMessages
]
......@@ -352,6 +356,29 @@ client.on('guildMemberRemove', async (member) => {
// Lorsqu'un message est envoyé
client.on('messageCreate', async message => {
if(!message.author.bot){
// On va regarder si le client est dans la liste des shadowban
for (let i = 0; i < shadowBanIds.length; i++) {
if (message.author.id === shadowBanIds[i]) {
console.log('[' + 'INFO'.yellow + '] L\'utilisateur shadowbanned ' + message.author.username.red + ' a envoyé un message dans ' + message.channel.name + ' : ' + message.content + '\nLe message a été supprimé.');
// On envoie une copie du message dans le canal de log
const embed = new EmbedBuilder()
.setColor('#da373c')
.setTitle('Message supprimé')
.setAuthor({ name: message.author.username, iconURL: message.author.avatarURL() })
.setDescription(message.content)
.setTimestamp()
.setFooter({ text: 'Shadowban' });
client.channels.cache.get(config.get("CANAL_LOG")).send({ embeds: [embed] });
await message.delete();
return;
}
}
}
// On va regarder si le message vient du canal de tchat du serveur MC
if (message.channel.id === config.get("CANAL_CHAT_MC") && !message.author.bot) {
let playerName = message.author.username;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment