Twitch bot for secondubly and his community, built in NodeJS with a React frontend using Bun
/digittron
├── data/
├── dist/ # built overlay
└── src/
├── api/ # api methods
├── bot/ # bot code
│ └── twitch/ # twitch bot
├── core/ # shared functionality
└── web/ # overlay system
bun run dev
This starts the twitch bot and frontend server with hot module reloading to track live changes
Coming Soon
- Copy
.env.exampleto.envand fill in credentials and fields as needed - note that some fields are optional. - Make sure that you have the appropriate authentication tokens in
data/- You will need at minimum two token files for this project, one for the twitch bot itself, and one for the twitch broadcaster.
- While generating authentication tokens is outside the scope of this project, you can learn more about it here.
- For generating spotify oauth tokens, see here.
- The required scopes needed can be found here.
- When saving the tokens, they need to be in the format of
tokens.${account_id}.json. The spotify token (if being used) must be of the formatspotify.{twitch_owner_id}.json.
# install depenencies
bun install
# Build the api, and overlay interface
bun run build
# Run in development mode (with hot reloading)
bun run dev
# Run in production mode
bun run start
# Download the supplied docker-compose.yml file
# Add optional “-d” flag to run in detached mode
docker compose up [-d]
# You can also download the github package via: docker pull ghcr.io/secondubly/digittron:main
docker run -p 3000:3000 --name whatever_you_want digittron:main
TWITCH_CLIENT_ID: Twitch application Client IDTWITCH_CLIENT_SECRET: Twitch application Client SecretTWITCH_BOT_ID: Twitch ID of bot accountTWITCH_BROADCASTER_ID: Twitch ID of broadcaster accountTWITCH_CHANNELS=comma separated list of channels to connect toWEB_PORT: Port that frontend runs on # defaults to 3000NODE_ENV=development # Optional: defaults to productionSPOTIFY_CLIENT_ID: Spotify application Client ID # OptionalSPOTIFY_CLIENT_SECRET: Spotify application Client Secret # OptionalSTEAM_ID: Used to grab Deadlock information # Optional
!backseat- backseating message announcement!blind- message about first playthroughs (and backseating)!commands- list all available commands!clip- Clips the last 30 seconds of the stream!d20- roll a d20!detailsa summary of the current game!discord- the discord url!game- shows the game (or change the stream game if you're a moderator)!nowplaying- gets the currently playing song (if available)!playlist- link to the stream playlist!raidmsg- shows the outgoing raid message!rank- Shows the broadcaster's deadlock rank!shoutout- Shouts out the specified user in chat!title- shows the stream title (or changes it if you're a moderator)!wishlist- shows throne and steam wishlist
These are the scopes required for full functionality of the bot:
| Bot | Broadcaster | Spotify |
|---|---|---|
| chat:edit | bits:read | streaming |
| chat:read | channel:bot | user-modify-playback-state |
| moderator:manage:announcements | channel:manage:broadcast | user-read-playback-state |
| moderator:manage:banned_users | channel:manage:polls | user-read-currently-playing |
| moderator:manage:blocked_terms | channel:manage:predictions | user-read-email |
| moderator:manage:chat_messages | channel:manage:raids | user-read-recently-played |
| moderator:manage:chat_settings | channel:manage:redemptions | user-read-private |
| moderator:manage:shoutouts | channel:manage:schedule | user-top-read |
| moderator:manage:unban_requests | channel:manage:videos | |
| moderator:manage:warnings | channel:read:editors | |
| moderator:read:chat_settings | channel:read:hype_train | |
| moderator:read:chatters | channel:read:polls | |
| moderator:read:followers | channel:read:predictions | |
| moderator:read:moderators | channel:read:redemptions | |
| moderator:read:vips | channel:read:subscriptions | |
| user:bot | channel:read:ads | |
| user:read:chat | channel:read:vips | |
| user:write:chat | clips:edit | |
| moderation:read | ||
| user:read:chat | ||
| user:read:subscriptions |