TwitchBot
A local desktop Twitch bot — loyalty system, recurring timers, Helix-backed moderation, and event automations.
Problem
Most Twitch chatbots are either a SaaS dashboard with limited customisation or a Python script the streamer has to babysit. I wanted a real desktop application: install, sign in once, run locally, own your data, and get the breadth of features that cloud bots gate behind a tier.
Approach
An Electron app with a React + TypeScript frontend and a SQLite store on disk. The streamer's PC is the entire infrastructure — no cloud, no telemetry, no third-party servers. Twitch Helix endpoints handle every moderation and chat action; the IRC connection is used only for reading.
Five subsystems share a single event bus and a single store:
- Commands. Custom responses with a 16-variable template system
(
{user},{level},{watch_time}, …), per-command cooldowns, and set-based permissions (mix of everyone / follower / VIP / subscriber / moderator). - Timers. Recurring chat messages that wait on both elapsed time and a minimum number of chat lines since last firing — so the bot stays quiet in an empty room.
- Moderation. Seven rule types (links, caps, emote spam, repeated messages, symbol spam, blocked words, first-message screening), each with its own thresholds and start tier on a four-tier escalation ladder (warn → 10s → 10m → 24h). Subscribers and VIPs can be exempted; permitted users overridden permanently. Every action is logged and filterable.
- Automations. A rules engine fires on follows, subs, gifts, cheers,
raids, and stream online/offline. Conditions are AND-joined and read event
payload fields (
viewer_count,bits,tier,is_gift). Actions chain: chat message, sound, Discord webhook, Helix timeout, EXP bonus, ordered delay. A test button dry-runs an automation against a mock payload. - Loyalty & analytics. Every chatter accrues EXP, levels up, and builds a watch streak. A live feed mirrors chat plus every follow / sub / cheer / raid in real time; the analytics page charts the long view.
Discord output is first-class: a dedicated page for webhook URLs and a visual embed-template editor with a live Discord-style preview.
Outcome
A bot that holds its own against the established hosted competitors on feature surface, runs entirely on the streamer's machine, and stores every byte of viewer data in a single SQLite file the streamer can read, back up, or delete. Useful evidence that "local-first" still works for a non-trivial multi-system desktop app.