Scans your Twitch chat's current viewer list and flags accounts that look like follow/view-bots, so you can review and block them manually. Nothing is banned automatically.
/— dashboard: sorted table of flagged accounts with reasons. Once connected, this is also the landing page./json— same data as JSON.!botcheck— chat command that replies with just the count, e.g. "🤖 4 likely bot viewers out of 212 in chat right now."
You no longer set TWITCH_BROADCASTER_LOGIN or TWITCH_MOD_OAUTH_TOKEN by
hand. Instead, visiting /connect and authorizing on Twitch captures your
login, ID, and a refreshable moderator:read:chatters token automatically — same
OAuth pattern GuildScribe already uses (/connect → Twitch → /callback),
stored in this project's own SQLite database. The token also now refreshes
itself instead of expiring every ~4 hours.
Each chatter is scored on:
- Account age (younger = more suspicious)
- Default/missing profile picture
- Username shape (word+digits, long random strings — common bot-generator patterns)
Known legitimate bots (Nightbot, StreamElements, etc. — see botDetection.ts)
are always excluded. This is heuristic, not certain — glance at a flagged
account before blocking it.
-
Create a new Val Town project and upload
main.ts,twitch.ts,db.ts, andbotDetection.ts. Setmain.tsas the HTTP val entrypoint. -
Add these four environment variables (account-level Environment Variables page):
Key Value TWITCH_CLIENT_IDyour app's Client ID — reuse GuildScribe's TWITCH_CLIENT_SECRETyour app's Client Secret — reuse GuildScribe's TWITCH_BOT_IDyour bot account's numeric user id — reuse GuildScribe's EVENTSUB_SECRETany random string you make up — doesn't need to match GuildScribe's -
Open the val's URL — you'll land on a "Connect my channel" page. Click it, authorize on Twitch, and you're done: broadcaster login, chatters token, and EventSub subscription are all set up automatically in that one step.
-
In Twitch chat, run
/mod guildscribebot(or whichever account ownsTWITCH_BOT_ID) if it isn't already modded, so it's allowed to speak. -
Type
!botcheckin chat — you should get a reply within a few seconds. -
Reloading
/from then on shows the dashboard directly, no reconnecting needed unless Twitch revokes the authorization.
- If the stored token ever gets revoked (e.g. you remove the app's access in
your Twitch settings),
!botcheckand/will say the channel needs to reconnect — just visit/connectagain. !botcheckre-scans the whole chatter list on every call, so there's a couple seconds of delay before the reply — that's expected, not a bug.