Twitch Chat Filter Cookbook
A live chat filter that asks three questions per message — category, toxicity, and spoilers — then turns the answers into show, highlight, dim, hide, or blur in plain code. The 29-message example hides seven, blurs two, and highlights six.
- Format
- Docs
- Published by
- TypeSafe AI
- Last verified
- Oct 2026
- Languages
- Python
Highlights
- One request per message holds three questions: a five-way category Choice, a toxic Noul, and a spoiler Noul, judged against the stream title and game.
- decide() maps answers to show, highlight, dim, hide, or blur; changing a rule re-runs only decide() with no new request, as 14 changed messages in the example show.
- On 29 hand-written Elden Ring messages the filter hid 7, blurred 2 spoilers, and highlighted 6 questions; requests took a median of about 0.4 seconds.
- The demo is a Jev-powered Chrome extension filtering a live Twitch chat, and messages run eight at a time with ThreadPoolExecutor.
Quickstart
RULES = {"question": "highlight", "hype": "show", "conversation": "show",
"backseat": "hide", "spam": "hide"}
TOXIC_AT, SPOILER_AT = 0.7, 0.7
def decide(result: dict, rules: dict = RULES) -> str:
if result["toxic"] >= TOXIC_AT:
return "hide (toxic)"
action = rules[result["category"]]
if action == "hide":
return f"hide ({result['category']})"
if result["spoiler"] >= SPOILER_AT:
return "blur (spoiler)"
return actionWatch out
A message waits about 0.4 seconds for its answer, so a toxic line is visible until then, and the page says one request at a time cannot keep up with a busy chat. Jev was trained mainly on English at publication, and the spoiler check has no record of the streamer's progress. Numbers come from jev-1.13.0 on 2026-09-25.
Questions about this entry
Reactions & coverage
Posts, threads, and videos about this entry from around the web.
YouTube: Building a contextual brand-safety scorer on Jev from scratch.
X: A website slop detector that checks 35 tells in 243 ms
X: Breaking, golden nugget, or slop
X: A filter for reply-guy comments
More Jev resources like this
From the Jev guides
Original write-ups on what this entry is for.
From the Jev community
Posts from builders shipping with Jev right now.