@avatarkage/automod
v1.0.2
Published
A new and nearly unbreakable auto-moderation module.
Maintainers
Readme
A new and nearly unbreakable auto-moderation module. There are still a few bugs but its as solid as it can be currently.
It operates by removing common non-alphanumeric characters then using an advanced obfuscation map to turn the special characters back into alphanumeric characters. Using special formatting rules within the filters blacklists and whitelists, they are converted into a javascript regex which attempts to match a word within the sent text. It even uses an additional space-based regex to maintain authentic spaces but block bypassing ones.
- You can test it live here -> https://avatarka.ge/automod
I am a professional content moderator and I have created this to help people have more control over the content that reaches their applications. I'm far from a stranger when it comes to keeping safety a number one priority. If this is any helpful to you, please consider donating to me on Ko-fi!
If you have any feedback or bug reports, please reachout on my Discord server.
import automod from "@avatarkage/automod";
function checkMessage(text) {
const data = automod.test(text);
if (data.blocked) {
console.log(data);
return data
} else {
console.log("Content is not blocked and nothing happened!");
}
}
checkMessage(`your text here`)JSON ARRAY RETURN
{
"name": "Profanity Abbreviations",
"group": "Unsafe Expressions",
"severity": "low",
"message": "Your message contains profanital language. Attempting to bypass may result in action taken against your account.",
"matched": "(?w)tf",
"flagged": "wtf",
"regex": "/\\b(w)?tf\\b/i",
"regex_spaced": "/\\b(w)?t\\s*f\\s*\\b/i",
"blocked": true
}CONFIGURATIONS (please look at the existing filters inside the module script before defining your own)
// ————————————————————————————————————————————————————————————————
// ———————————————————— FILTERS CONFIGURATION —————————————————————
// ————————————————————————————————————————————————————————————————
// - "*YOUR_WORD" Makes the word catch anything before it from the last space
// - "YOUR_WORD*" Makes the word catch anything after it until the next space
// - "*YOUR_WORD*" Makes the word catch anything before and after it from the last space to the next space
// - "(?YOUR_CHARACTER)" Makes an optional statement where the letter forms a match whether inputted or not
// - "(YOUR_CHARACTER|YOUR_CHARACTER)" Makes a or statement where either letter are a match
// - "(?YOUR_CHARACTER|YOUR_CHARACTER)" Makes an optional or statement where either LETTER form a match whether inputted or not
// - "r:YOUR_REGEX" Enables the use of native JavaScript regex for this specific word entry; not compatible with the above rules
//
// automod.filters.YOUR_FILTER_ID = {
// name: "", // How the filter will be recognized and friendly identified
// group: "", // Useful for taking the same type of action or sending notifications for similar filters
// severity: "", // "none", "low", "medium", "high", "critical"; same as the group comment
// blacklist: [], // These words will be blocked when matched; refer to the rules guide
// whitelist: [], // These words will be allowed and will override the blacklist when matched; refer to the rules guide
// message: "", // The return warning to the user who attempted breach
// bypass: false, // When true, the filter will be locally disabled via requests; eg: automod.filters.YOUR_FILTER_ID.bypass = (req.permissions == 8)
// active: true // When false, the filter will be globally disabled
// };
//
// Note: You can edit any part of your or pre-defined filters anywhere using the following lines of code:
//
// - automod.filters.YOUR_FILTER_ID.KEY = ""; KEY is one of the following: "name", "group", "severity", "message", "bypass", "active"
// - automod.filters.YOUR_FILTER_ID.blacklist.push("YOUR_WORD"); Push a new word into the blacklist or whitelist
// - automod.filters.YOUR_FILTER_ID.blacklist =
// automod.filters.YOUR_FILTER_ID.blacklist.filter(word => word !== "YOUR_WORD"); Remove an existing word from the blacklist or whitelist
// ————————————————————————————————————————————————————————————————
// —————————————————— OBFUSCATION CONFIGURATION ———————————————————
// ————————————————————————————————————————————————————————————————
// - automod.obfuscation.YOUR_CHARACTER.push("YOUR_CHARACTER"); Push a new character into the map
// - automod.obfuscation.YOUR_CHARACTER =
// automod.obfuscation.YOUR_CHARACTER.filter(character => character !== "YOUR_CHARACTER"); Remove an existing character from the map
// ————————————————————————————————————————————————————————————————
// ——————————————————— SEPERATOR CONFIGURATION ————————————————————
// ————————————————————————————————————————————————————————————————
// - automod.separators.push("YOUR_CHARACTER"); Push a new character into the map
// - automod.separators =
// automod.separators.filter(character => character !== "YOUR_CHARACTER"); Remove an existing character from the map