Quickstart
Label a live Twitch chat with Jev in five minutes, then let it moderate your own channel.
No code first?
npx jev-events watch twitch:<any live channel> prints what Jev says about each chat message in your terminal, with no Twitch account. watch gmail, watch calendar and watch slack work the same once you install the integration and sign in with auth google or auth slack. See the CLI.
Install
Jev Events needs Node.js 22 or newer. Make a folder, and install it with tsx, which runs TypeScript:
mkdir my-monitor && cd my-monitor
npm init -y && npm pkg set type=module
npm i jev-events tsxAdd your TypeSafe key
Get an API key from TypeSafe and put this line in a file called .env next to your code:
TYPESAFE_API_KEY=<your key>Write a monitor
Reading a public Twitch chat needs no Twitch account. Pick any channel that is live right now, and put its name where the code says some_live_channel.
import { monitor, recipes } from "jev-events";
import { twitchChat } from "jev-events/public";
// Reading a public chat needs no Twitch account. Pick any live channel.
const chat = monitor({
source: twitchChat("some_live_channel"),
questions: { kind: recipes.chat.kind, hateful: recipes.chat.hateful },
})
.on("kind:question", (e) => console.log(`❓ ${e.item.author.name}: ${e.item.text}`))
.on("hateful", { min: 0.9 }, (e) => console.log(`🚫 ${e.item.author.name} (${e.trigger.probability})`));
await chat.start();Run it
npx tsx --env-file=.env monitor.tsQuestions for the streamer are printed as they arrive, and so are hateful messages Jev is at least 90% sure about. Stop it with Ctrl+C.
Moderate your own channel
To act in chat, the monitor has to read it as you. Install the Twitch integration and sign in once:
npm i @jev-events/twitch
npx jev-events auth twitchThe first time, auth twitch walks you through registering your own Twitch app, then shows a code to approve on Twitch. The sign-in is saved in .jev-events/, which git ignores. Then read your own channel and add a native action:
import { monitor, recipes } from "jev-events";
import { twitch } from "@jev-events/twitch";
const mods = monitor({
source: twitch.chat(), // your own channel, as you
questions: { hateful: recipes.chat.hateful },
}).on("hateful", { min: 0.9 }, twitch.timeout({ seconds: 600 }));
await mods.start();Run it the same way. Native actions start in dry-run, so the timeout only prints what it would do:
[jev-events] [dry-run] would timeout viewer_42 for 600s (hateful p=0.97)When those lines look right, pass dryRun: false to monitor(). The Twitch guide covers every action, and its builder writes the code for the questions and actions you pick.
Next
- For your users: run the same monitor for everyone who connects an account to your product.
- Questions: write your own, and choose how sure Jev has to be.
- Safety: dry-run, protected users, budgets and the audit log.
- Recipes: ready-made questions to start from.