Quick Start Bot
Spin up a simple Twitch bot that refreshes OAuth tokens with the velho CLI, connects to chat, and responds to
commands like !ping. Extend it with your own command handlers as you grow.
Get started
- Install dependencies with
npm install. -
Run
npx velho-setupand follow the prompts to authenticate both the channel and bot accounts. The CLI writes the refresh token and channel details to.env. - Confirm the required environment variables listed on this page are present. Update values manually if you prefer not to use the CLI helper.
-
Start the bot with
npx tsx examples/QUICK_START_BOT.ts. The script refreshes the chat token, joins your channel, and listens for commands. - Send
!pingin chat to verify the bot responds, then add your own branches inhandleCommand.
What you can do
- Refresh OAuth tokens on the fly using
TwitchAuth.getUserAccessToken. - Respond to chat commands with friendly logging and automatic reconnect behaviour.
- Extend the command handler to integrate with APIs, overlays, or moderation tools.
- Add structured logging or metrics around connection events for production readiness.
Ideas for growth
- Store refresh tokens in a secure secret manager instead of environment variables.
- Use the Helix client to enrich command responses with live stream or channel metadata.
- Pair with EventSub to react to follows, subscriptions, or channel point redemptions.