From b51cf825f4f2afd830f4b472a7ce418a38274f86 Mon Sep 17 00:00:00 2001 From: Alee14 Date: Thu, 17 Aug 2017 17:45:26 -0400 Subject: Added a profanities filter! --- abwelcome.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'abwelcome.js') diff --git a/abwelcome.js b/abwelcome.js index 33214a8..0a54cf1 100644 --- a/abwelcome.js +++ b/abwelcome.js @@ -1,4 +1,5 @@ const Discord = require('discord.js'); +const profanities = require('profanities'); const client = new Discord.Client(); const config = require('./absettings.json'); @@ -18,6 +19,16 @@ client.on("guildMemberRemove", function(member) { }); +client.on('message', message => { + for (x = 0; x < profanities.length; x++) { + if (message.content.toUpperCase() == profanities[x].toUpperCase()) { + message.reply('Hey! Don\'t say that word!') + message.delete(); + return; + } + } +}); + process.on('unhandledRejection', function(err, p) { console.log("[ERROR | UNCAUGHT PROMISE] " + err.stack); }); -- cgit v1.2.3