Use case
AI moderation for Twitch chat that knows your channel's rules
A busy Twitch chat moves faster than any moderator can read. VigiMod checks every message with the ones before it, in 26 languages, and against the rules of your channel, so your bot can delete what breaks them and leave the jokes alone.
What makes it hard
Fast and full of in-jokes
Emotes, copypasta and banter between regulars look like insults out of context. Reading the previous messages avoids most false flags.
Rules no filter knows
“No spoilers for the game”, “No backseating”, “No self-promotion”: every channel has its own, and word lists cannot catch them.
Viewers from everywhere
Big streams get chat in many languages, and word lists must be written again for each one. VigiMod was trained on 26 languages.
How it works with VigiMod
- 1
Your bot reads the chat (IRC or EventSub) and keeps the last ten messages.
- 2
Each new message goes to VigiMod with that context, the author's id and your channel rules.
- 3
If the answer is flagged, the bot deletes the message with the Twitch API, or times out the user for repeated flags.
Rules you can copy
Send them in the rules field: each one comes back with its own score, like a built-in category.
{
"rules": {
"no-spoilers": "No spoilers about the game being played",
"no-backseating": "No telling the streamer how to play unless they ask",
"no-self-promo": "No promoting your own channel or socials",
"english-only": "Only English in chat"
}
}Example
A Node.js bot: tmi.js reads the chat, VigiMod checks each message, the Twitch API deletes it when flagged (the token needs the moderator:manage:chat_messages scope).
JavaScript (Node.js)
// npm install tmi.js (Node 18+)
// tmi.js reads the chat; the Twitch API deletes a message (token scope: moderator:manage:chat_messages)
import tmi from "tmi.js";
const { VIGIMOD_KEY, TWITCH_TOKEN, TWITCH_CLIENT_ID, BROADCASTER_ID, MODERATOR_ID } = process.env;
const RULES = { "no-spoilers": "No spoilers about the game being played" };
const recent = []; // the last messages of the chat, sent as context
const client = new tmi.Client({ channels: ["your_channel"] });
client.on("message", async (channel, tags, text, self) => {
if (self) return;
const res = await fetch("https://api.vigimod.com/moderate", {
method: "POST",
headers: { "X-API-Key": VIGIMOD_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
text: text.slice(0, 2000), context: [...recent], rules: RULES,
user_id: tags["user-id"], scope: channel,
}),
signal: AbortSignal.timeout(2000),
}).catch(() => null); // slow or down: let the message through
recent.push(text.slice(0, 2000));
if (recent.length > 10) recent.shift();
if (!res?.ok) return;
const result = await res.json();
if (result.flagged) {
const q = new URLSearchParams({ broadcaster_id: BROADCASTER_ID, moderator_id: MODERATOR_ID, message_id: tags.id });
await fetch(`https://api.twitch.tv/helix/moderation/chat?${q}`, {
method: "DELETE",
headers: { Authorization: `Bearer ${TWITCH_TOKEN}`, "Client-Id": TWITCH_CLIENT_ID },
});
}
});
client.connect();Tips
- Keep AutoMod on: it holds messages before they appear, VigiMod adds your rules, context and other languages after.
- Delete on a flag, but time out only after several flags from the same user in a short time.
- Pass user_id and the channel as scope: repeated messages and floods from one user raise the spam score.
Questions
- Does VigiMod replace Twitch AutoMod?
- No, it works alongside it. AutoMod is built into Twitch and holds messages before they are shown; VigiMod checks your own rules, reads the context and covers 26 languages.
- Is it fast enough for live chat?
- Each message is one HTTP call. Give it a short timeout (about two seconds) and, if a call fails or is slow, let the message through so chat keeps running.
- What about very busy channels?
- The free beta allows 120 messages per minute per API key. If your chat is faster, write to support with your volume and the limit can be raised.
- Can I use it for VODs or clips?
- VigiMod checks text only. You can check titles, chat replays and comments, but not the video or audio.
Keep learning
All guides- Basics · 5 min readWhy context matters in chat moderationThe same sentence can be harmless or harmful depending on what came before. How conversation context changes moderation, with real examples.
- Intermediate · 6 min readHow to choose a moderation thresholdA score of 0.7 is not a decision. How thresholds work, why the default is only a starting point and a simple method to tune them on your own messages.
- Basics · 5 min readHuman in the loop: how AI and moderators work best togetherAutomatic moderation is fast, people understand nuance. How to split the work, which actions to automate and which to leave to a person.
Try it on your community
Create a free API key in two minutes. No card, no trial period.