Created
September 19, 2018 13:38
-
-
Save jpbberry/2434454e5404f61f9c9d06adef6fba81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(bot, connection, stuff, auth) { | |
var SelfReloadJSON = require('self-reload-json'); | |
const modulename = "swearfilter" | |
const swears = new SelfReloadJSON("./swears.json") | |
var statuslog = bot.channels.get("450444337357258772") | |
var logchannel = bot.channels.get("399688995283533824") | |
var serverlistchannel = bot.channels.get("413831069117186078") | |
var botowner = bot.users.get("142408079177285632") | |
var byp = new SelfReloadJSON('./byp.json'); | |
bot.on('message', async(message) => { | |
if (!message.guild) return; | |
if (message.channel.nsfw) return; | |
if (message.guild.id == "264445053596991498") return; | |
if (message.guild.id == "110373943822540800") return; | |
if (message.author.bot) return; | |
if (message.channel.id == "463137032177451008") return; | |
if (message.channel.id == "362693179033649152" || message.channel.id == "410475762257494016" || message.channel.id == "362689481586901002" || message.channel.id == "467069321768730624") return; | |
if (message.guild.id == "446519010935439371") { | |
if (message.content.match(/slut/)) return; | |
} | |
if (message.guild.id == "468235532497977355") { | |
if (message.content.match(/porn/)) return; | |
} | |
if (message.guild.id == "430410558681120768") { | |
if (message.content.match(/frigger/)) stopped(); | |
if (message.content.match(/twat/)) stopped(); | |
} | |
delete require.cache[require.resolve('./byp.json')] | |
async function stopped() { | |
connection.query("SELECT * FROM censorbot WHERE serverid = " + message.guild.id, async function(err, rows) { | |
if (rows && rows[0] && rows[0].censor == 0) { | |
return; | |
} else { | |
connection.query("SELECT * FROM roleandlog WHERE serverid = " + message.guild.id, async function(err, rows) { | |
if (rows && rows[0]) { | |
let roleid = rows[0].roleid | |
let roleobject = message.guild.roles.get(roleid) | |
if (roleobject) { | |
if (message.guild.member(message.author.id).roles.has(roleid)) return; | |
} | |
} | |
message.delete().catch(err => { | |
console.log(`${message.guild.name} ${message.guild.id} Missing perms`) | |
}) | |
const popnomsg = await message.reply("You're not allowed to say that... | Mistake? Do: +ticket word") | |
setTimeout(function() { | |
popnomsg.delete() | |
}, 3000); | |
console.log(`Deleted message from ${message.author} ${message.author.username}: ${message.content}`) | |
const logchannel = bot.channels.get("399688995283533824") | |
let oml = { | |
"embed": { | |
"title": message.content + "", | |
"footer": {}, | |
"fields": [{ | |
"name": "User", | |
"value": message.author + "" | |
}] | |
} | |
} | |
logchannel.send(`Deleted message from ${message.author.tag} ${message.author.username}: | Server: ${message.guild.name} ${message.guild.id} | Channel: ${message.channel.name} ${message.channel.id}`) | |
logchannel.send(oml) | |
const logchannelxd = message.guild.channels.find("name", "log"); | |
if (!logchannelxd) { | |
message.channel.send("error! no log channel found! Be sure to create a #log chat so I can log the curses!") | |
} | |
if (logchannelxd) { | |
let yas = { | |
"embed": { | |
"title": "Deleted Message", | |
"color": 16452296, | |
"timestamp": "", | |
"footer": { | |
"icon_url": bot.user.avatarURL + "", | |
"text": "If you believe this was a mistake run +ticket word" | |
}, | |
"thumbnail": { | |
"url": message.author.avatarURL | |
}, | |
"fields": [{ | |
"name": "User", | |
"value": message.author + "", | |
"inline": true | |
}, { | |
"name": "Channel", | |
"value": message.channel + "", | |
"inline": true | |
}, { | |
"name": "Time", | |
"value": Date() + "" | |
}, { | |
"name": "Message", | |
"value": message.content + "" | |
}] | |
} | |
} | |
logchannelxd.send(yas) | |
} | |
}) | |
}; | |
}); | |
return isstop = 1 | |
} | |
if (message.content.match(/(f uck|fu ck|penis|Pu.ssy|P.ussy|Puss.y|d l c|dlck|c u n t|n l g|n!g|fa g|f4g|f 4 g|f a g |f @ g|f u c k|f u k|🇫🇺🇨|🇫.+🇨|🇫 🇺 🇨|🇦🇸🇸|🇦 🇸 🇸|🇧🇮🇹🇨|🇧 🇮 🇹 🇨|🇩🇮🇨|🇩 🇮 🇨|🇨🇺🇳🇹|🇨 🇺 🇳 🇹|🇳🇮🇬|🇳 🇮 🇬|🇸ðŸ‡ðŸ‡®ðŸ‡¹|🇸 🇠🇮 🇹|🇫🇦🇬|🇫 🇦 🇬|🇵🇴🇷🇳|🇵 🇴 🇷 🇳|🇹🇮🇹|🇹 🇮 🇹|🇨🇴🇨|🇨 🇴 🇨|🇧🇦🇸🇹|🇧 🇦 🇸 🇹|🇸🇱🇺🇹|🇸 🇱 🇺 🇹|🇷🇪🇹🇦🇷🇩|🇷 🇪 🇹 🇦 🇷 🇩|🇵🇺🇸🇸🇾|🇵 🇺 🇸 🇸 🇾|🇨🇺🇲|🇨 🇺 🇲)/gi)) { | |
stopped(); | |
console.log(crash) | |
} | |
function RemoveAccents(str) { | |
var accents = 'ÀÃÂÃÄÅà áâãäåßÒÓÔÕÕÖØÅòóôőõöøĎÄDŽdžÈÉÊËèéêëðÇçČÄÃÃŒÃÃŽÃìÃîïÙÚÛÜŰùűúûüĽĹľĺÑŇňñŔ੹ŤťŸÃÿýŽž'; | |
var accentsOut = "AAAAAAaaaaaabOOOOOOOOoooooooDdDZdzEEEEeeeeeCcCcDIIIIiiiiUUUUUuuuuuLLllNNnnRrSsTtYYyyZz"; | |
str = str.split(''); | |
var strLen = str.length; | |
var i, x; | |
for (i = 0; i < strLen; i++) { | |
if ((x = accents.indexOf(str[i])) != -1) { | |
str[i] = accentsOut[x]; | |
} | |
} | |
return str.join(''); | |
} | |
const arg = RemoveAccents(message.content.replace(/[.]/g, '').replace(/\u200b/g, '')).slice().trim().split(/ +/g) | |
const words = swears.var | |
const arrays = byp | |
for (i = 0; i < arg.length; i++) { | |
let argo = arg[i] | |
for (z = 0; z < words.length; z++) { | |
let word = new RegExp(words[z], 'gi') | |
if (argo.match(word)) { | |
const array = arrays[words[z].toLowerCase()] | |
for (b = 0; b < array.length; b++) { | |
let sio = [] | |
sio = new RegExp(array[b], 'gi') | |
console.log(sio) | |
if (argo.match(sio)) return; | |
stopped(); | |
if (isstop) break; | |
} | |
} | |
} | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment