Skip to content

tm.profanity ​

Censors banned words in text. Shared.

lua
local cleaned = tm.profanity.check(text)
if cleaned then text = cleaned end   -- 'you *******'; check returns false when nothing matched
  • The word list is a setting, tm_lib > profanity.words in the admin panel (one word or phrase per line, or separated by commas). It is empty by default, so nothing is censored until staff add words. No word list ships with tm_lib. The list is rebuilt when the setting changes, on both the server and the client.
  • Matching ignores case and works on substrings, so Anal and anal both match, and so does a longer word that contains an entry (the usual trade-off of a plain list). Overlapping entries are merged.
  • Each censored byte becomes *, so the text keeps its length.
  • Returns false for text with no match, when no words are configured, and for nil, non-string and empty input.
  • Always validate on the server. A client can skip its own check.