Twitch bot for secondubly and his community, built in NodeJS with a React frontend using pnpm as a package manager
digittron
├── build # build files
├── data # database file and schema
├── initdb.sh # init (and seeding) script for database
└── src
├── api # API server
├── bot # twitch bot
│ └── commands # twitch bot commands
├── lib # shared core functionality
│ ├── bot # commonly used types
│ ├── db # database models
│ └── utils # utility functions
└── web # frontend
- Copy
.env.exampleto.envand fill in your credentials.- For bot access token, use the following url:
https://id.twitch.tv/oauth2/authorize?client_id=CLIENT_ID&redirect_uri=http://localhost:3000&response_type=code&scope=channel:edit:commercial+channel:moderate+chat:read+chat:edit+clips:edit+moderator:manage:announcements+moderator:manage:banned_users+moderator:manage:blocked_terms+moderator:manage:chat_messages+moderator:manage:shoutouts+moderator:manage:unban_requests+moderator:manage:warnings+moderator:read:chat_settings+moderator:read:chatters+moderator:read:followers+moderator:read:moderators+moderator:read:vips+user:bot+user:read:chat+user:write:chat&force_verify=true - For broadcaster access token, use the following url:
https://id.twitch.tv/oauth2/authorize?client_id=CLIENT_ID&redirect_uri=http://localhost:3000&response_type=code&scope=bits:read+channel:bot+channel:manage:broadcast+channel:manage:polls+channel:manage:predictions+channel:manage:raids+channel:manage:redemptions+channel:manage:schedule+channel:manage:videos+channel:read:editors+channel:read:hype_train+channel:read:polls+channel:read:predictions+channel:read:redemptions+channel:read:subscriptions+channel:read:vips+clips:edit+moderation:read+user:read:subscriptions&force_verify=true - In development mode, you will need an ngrok auth token - you can get one by signing up here: http://ngrok.com. This is used to enable the “Bot” badge for the bot, allowing extra functionality.
- The
EVENTSUB_SECRETis just a randomly generated string.
- For bot access token, use the following url:
# install depenencies
pnpm install
# run API, bot, and frontend in development mode (with hot reloading)
pnpm run dev
# Build and run with docker - will create a persistent redis service as well
# Add optional “-d” flag to run in detached mode
docker compose up
CLIENT_ID: Twitch application Client IDCLIENT_SECRET: Twitch application Client SecretBOT_ID: Twitch ID of bot accountBOT_ACCESS_TOKEN: Twitch bot account access tokenBOT_REFRESH_TOKEN: Twitch bot account refresh tokenTWITCH_ID: Twitch broadcaster/owner account IDTWITCH_ACCESS_TOKEN: Twitch broadcaser/owner access tokenTWITCH_REFRESH_TOKEN: Twitch broadcaster/owner refresh tokenCHANNELS: List of twitch channels to connect to (separated by commas)REDIS_HOST: Hostname for your redis instance (in development mode, default is localhost)REDIS_PORT: Port for your redis instance (default is 6379)NODE_ENV: Whether to run bot in production or development modeNGROK_AUTH_TOKEN: Only needed in development mode, ngrok auth token is used to create a EventSub adapterEVENTSUB_SECRET: Only needed in development mode, eventsub secret is used to validate connections to EventSub adapter
!anniversary- Prints stream anniversary message!backseat- backseating message announcement!commands- list all available commands!d20- roll a d20!detailslists a summary of the currently playing game!discord- list the discord url!game- shows the game (or change the stream game if you're a moderator)!permit- allow specified user to post links without being timed out!raidmsg- shows the outgoing raid message!roulette- I count six shots (okay maybe just one)!subgoal- subgoals for the anniversary stream!test- test command for mods/broadcaster!title- shows the stream title (or changes it if you're a moderator)!wishlist- shows throne and steam wishlist