Skip to content

Instantly share code, notes, and snippets.

@KeyWhiteRBCY
Created June 24, 2026 04:53
Show Gist options
  • Select an option

  • Save KeyWhiteRBCY/46057dfb3e55c55418f1ca0e6f780ad8 to your computer and use it in GitHub Desktop.

Select an option

Save KeyWhiteRBCY/46057dfb3e55c55418f1ca0e6f780ad8 to your computer and use it in GitHub Desktop.
experimental adaptive chat filter made in Skript
options:
cooldown-after-mute: 240 seconds
kick-window: 240 seconds
slur-mute-time: 10 minutes
spam-mute-time: 15 seconds
max-warnings: 3
# NORMALIZATION
function normalize(t: text, stripSpaces: boolean) :: text:
set {_res} to {_t} in lowercase
replace all "4" with "a" in {_res}
replace all "@" with "a" in {_res}
replace all "3" with "e" in {_res}
replace all "0" with "o" in {_res}
replace all "1" with "i" in {_res}
replace all "!" with "i" in {_res}
replace all "$" with "s" in {_res}
replace all "5" with "s" in {_res}
replace all "7" with "t" in {_res}
replace all "8" with "b" in {_res}
set {_chars::*} to {_res} split at ""
set {_clean} to ""
set {_prev1} to ""
set {_prev2} to ""
loop {_chars::*}:
set {_c} to loop-value
set {_isValid} to false
if "abcdefghijklmnopqrstuvwxyz0123456789" contains {_c}:
set {_isValid} to true
else if {_c} is " ":
if {_stripSpaces} is false:
set {_isValid} to true
if {_isValid} is true:
if {_c} is {_prev1}:
if {_c} is {_prev2}:
continue loop
set {_clean} to "%{_clean}%%{_c}%"
set {_prev2} to {_prev1}
set {_prev1} to {_c}
return {_clean}
# BACKGROUND MAINTENANCE TASKS
every 1 minute:
if {server.chat.stress} is set:
set {_decay} to 5 + (amount of all players / 10)
subtract {_decay} from {server.chat.stress}
if {server.chat.stress} <= 0:
delete {server.chat.stress}
delete {server.chat.strict_lock}
else if {server.chat.stress} < 40:
delete {server.chat.strict_lock}
loop all players:
if {toxicity::%loop-player%} is set:
set {_decayAmt} to rounded down ({toxicity::%loop-player%} * 0.08) + 1
subtract {_decayAmt} from {toxicity::%loop-player%}
if {toxicity::%loop-player%} <= 0:
delete {toxicity::%loop-player%}
every 10 minutes:
if {global.sensitivity} is not set:
set {global.sensitivity} to 1.0
if {server.chat.stress} is not set:
set {server.chat.stress} to 0
if {server.chat.stress} < 30:
subtract 0.1 from {global.sensitivity}
if {global.sensitivity} < 0.6:
set {global.sensitivity} to 0.6
else if {server.chat.stress} > 60:
add 0.1 to {global.sensitivity}
if {global.sensitivity} > 1.4:
set {global.sensitivity} to 1.4
on chat:
# BYPASS CHECK
if name of player is "Kaulai": # if you are staff put ur name here
stop
if {mute::%player%} is set:
if {mute::%player%} > now:
cancel event
send "&cYou are muted." to player
stop
else:
delete {mute::%player%}
if {toxicity::%player%} is not set:
set {toxicity::%player%} to 0
if {server.chat.stress} is not set:
set {server.chat.stress} to 0
if {global.sensitivity} is not set:
set {global.sensitivity} to 1.0
set {_raw} to message
# RISK ASSESSMENT
if {server.chat.stress} > 70:
set {server.chat.strict_lock} to true
if {server.chat.stress} > 80:
set {_filterMode} to "emergency"
else if {server.chat.strict_lock} is set:
set {_filterMode} to "strict"
else if {server.chat.stress} > 60:
set {_filterMode} to "strict"
else:
set {_filterMode} to "standard"
# SCAN & THREAT CLASSIFICATION
set {_threatClass} to "NONE"
set {_swearCount} to 0
if {_filterMode} is "emergency":
# Global Token Burst Bucket Core Logic
if {emchat.last_regen} is not set:
set {emchat.last_regen} to now
set {emchat.tokens} to 5
set {_elapsed} to difference between {emchat.last_regen} and now
if {_elapsed} >= 0.5 seconds:
set {emchat.tokens} to 5
set {emchat.last_regen} to now
if {emchat.tokens} <= 0:
cancel event
stop
subtract 1 from {emchat.tokens}
if {emchat.cooldown::%player%} is set:
if {emchat.cooldown::%player%} > now:
cancel event
send "&c[Emergency Mode] Please wait." to player
stop
if length of {_raw} > 45:
cancel event
send "&c[Emergency Mode] Message too long." to player
stop
set {emchat.cooldown::%player%} to now + 2.5 seconds
set {_msg} to normalize({_raw}, false)
set {_padded} to " %{_msg}% "
# -------------------------------------------------------------
# EMERGENCY SEVERE SLURS (No spaces, exact match padding)
# -------------------------------------------------------------
loop "nigga", "nigger" and "faggot":
if {_padded} contains " %loop-value% ":
set {_threatClass} to "SLUR_SEV"
exit loop
else if {_filterMode} is "strict":
set {_msg} to normalize({_raw}, true)
# -------------------------------------------------------------
# STRICT SEVERE SLURS (Highly aggressive compressed check)
# -------------------------------------------------------------
loop "nigga", "nigger" and "faggot":
if {_msg} contains loop-value:
set {_threatClass} to "SLUR_SEV"
exit loop
if {_threatClass} is "NONE":
# -------------------------------------------------------------
# STRICT MODERATE SLURS
# -------------------------------------------------------------
loop "retarded" and "cunt":
if {_msg} contains loop-value:
set {_threatClass} to "SLUR_MOD"
exit loop
# -------------------------------------------------------------
# STRICT SWEARS
# -------------------------------------------------------------
loop "fuck", "shit", "bitch", "dick" and "ass":
if {_msg} contains loop-value:
add 1 to {_swearCount}
else:
set {_msg} to normalize({_raw}, false)
set {_padded} to " %{_msg}% "
# -------------------------------------------------------------
# STANDARD SEVERE SLURS (Checks with word boundary spaces)
# -------------------------------------------------------------
loop "nigga", "nigger" and "faggot":
if {_padded} contains " %loop-value% ":
set {_threatClass} to "SLUR_SEV"
exit loop
if {_threatClass} is "NONE":
# -------------------------------------------------------------
# STANDARD MODERATE SLURS
# -------------------------------------------------------------
loop "retarded" and "cunt":
if {_padded} contains " %loop-value% ":
set {_threatClass} to "SLUR_MOD"
exit loop
# -------------------------------------------------------------
# STANDARD SWEARS
# -------------------------------------------------------------
loop "fuck", "shit", "bitch", "dick" and "ass":
if {_padded} contains " %loop-value% ":
add 1 to {_swearCount}
# Assign structural tokens
set {_score} to 0
if {_swearCount} > 0:
set {_score} to (45 * {_swearCount})
if {_threatClass} is "NONE":
set {_threatClass} to "SWEAR"
# POLICY TRANSLATION ENGINE
set {_policyDirective} to "ALLOW"
set {_sensShift} to ({global.sensitivity} - 1.0) * 15
set {_dynamicReduction} to ({toxicity::%player%} * 0.15) + ({server.chat.stress} * 0.15)
if {_dynamicReduction} > 15:
set {_dynamicReduction} to 15
set {_warnThresh} to 30 - {_sensShift} - {_dynamicReduction}
set {_swearThresh} to 60 - {_sensShift} - {_dynamicReduction}
if {_threatClass} is "SLUR_SEV":
set {_policyDirective} to "DISPATCH_SEVERE"
set {_score} to 100
else if {_threatClass} is "SLUR_MOD":
set {_policyDirective} to "DISPATCH_STANDARD"
if {_score} < 75:
set {_score} to 75
else if {_score} >= {_swearThresh}:
set {_policyDirective} to "DISPATCH_STANDARD"
else if {_score} >= {_warnThresh}:
set {_policyDirective} to "DISPATCH_WARN"
# STATE MACHINE MUTATION
if {_score} > 0:
add {_score} to {toxicity::%player%}
if {toxicity::%player%} > 100:
set {toxicity::%player%} to 100
else:
if {toxicity::%player%} > 0:
subtract 1 from {toxicity::%player%}
# SYSTEM ACTION DISPATCHERS
if {_raw} contains "67": # tee hee funny heheeheheheehehyEHHEEEHEH
cancel event
strike lightning at player
kill player
broadcast "&c&lThe gods are displeased, %player%."
stop
if {_policyDirective} is "DISPATCH_SEVERE":
cancel event
add 15 to {server.chat.stress}
set {mute::%player%} to now + {@slur-mute-time}
send "&cYou have been muted for severe language violations." to player
stop
else if {_policyDirective} is "DISPATCH_STANDARD":
cancel event
add 10 to {server.chat.stress}
if {probation::%player%} is set:
if {probation::%player%} > now:
kick player due to "&cYou continued inappropriate language after punishment."
stop
if {_threatClass} is "SLUR_MOD":
send "&cWatch your language. That type of vocabulary is restricted." to player
else:
send "&cSTOP IT!!!!!!" to player
set {mute::%player%} to now + {@spam-mute-time}
set {probation::%player%} to now + {@kick-window}
stop
else if {_policyDirective} is "DISPATCH_WARN":
cancel event
send random element out of "Do not.", "Cease." and "No." to player
stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment