Skip to content

A stream assistant optimized for live coding

License

Notifications You must be signed in to change notification settings

mafik/streambot

Repository files navigation

StreamBot

This repository contains a stream bot that I use when live coding on Twitch or YouTube.

Goals

  1. Eliminate TOIL. Normal streaming should require minimal manual intervention.
  2. Reduce risk. Streaming should be resilient to failure and recover quickly if one happens. Streaming should not depend on any external services that can fail.
  3. Increase value. Try to take the watching experience one level up.

Features

  • Automatic service management

    • Automatic startup of OBS
    • Automatic startup of VLC (for music)
    • Automatic recovery of any failed component with gradual backoff
    • Colored terminal display of logs from all components
    • TODO: automatic shutdown of OBS, VLC & AllTalk on exit
  • On-stream display of real-time gaze position using Tobii eye tracker

  • On-stream display of current VLC track

    • TODO: move VLC music to the local machine
  • On-stream display of aggregated chat from Twitch and YouTube

    • Twitch chat client with custom colors & emojis support
    • YouTube chat client with custom avatars & emojis support
    • Chat logging to a file
  • High-quality TTS for chat messages with stylized voices

    • Mindful delay of TTS messages while speaking
    • Stop TTS playback when user is muted
    • Users can change their voices using viewer panel (see below)
  • Control panel available by opening control.html (locally or through http://IP:3447/control.html)

    • Button for muting TTS for specific users
    • Button for banning users on Twitch
    • Field for changing stream title on YT and Twitch
    • Iframes with YouTube & Twitch panels: stream health, stream info, activity feed (needs CORS unblock)
    • TODO: button for deleting individual messages
    • TODO: button for timing users out
    • TODO: button for banning users on YT
    • TODO: counters with counts of viewers on YT and Twitch
    • TODO: auto-ban regexps
  • Viewer panel available by opening /

    • Current music track indicator
    • Links to Twitch and YouTube
    • Chat view
    • TODO: Animated avatars for viewers
  • TODO: automatic streaming notifications on Twitter and Mastodon

  • On-stream alerts

    • Twitch follows & raids
    • TTS narrator reads out the alerts
    • Sound played when alert starts and ends
    • TODO: YouTube subscriptions
    • TODO: GitHub sponsors
  • OBS scene transition when moving the cursor to a different screen (using Barrier's log)

Warnings

This is my personal project and isn't meant for general use. External packages have been liberally pulled in and may put your machine at risk. Documentation is non-existent (except for what you're reading right now). It's tightly coupled with my home network setup and would require changes to work anywhere else.

That being said, there is nothing stopping you from trying.

A few things to note:

  • Most secrets required for API access are stored in the secrets directory, which for obvious reasons is not included in this repository. You will have to go over error messages and create the required files.
  • TTS depends on the AllTalk TTS. Go ahead and install it. It's awesome.
  • TTS pausing requires the microphone input in OBS to be called "Mic".
  • Configure OBS by creating a full-screen browser source that points to the overlay.html file (load it from the local filesystem - not from a server).
  • Bot was written with Windows host and Linux target in mind. That being said, it should be relatively easy to adapt it to other setups.
  • Tobii gaze tracking requires compiling a C++ helper program. In OBS you should create a scene called "Main" with an image source called "Gaze".

If you're OK with that and want to try it out, you can use these commands as a starting point:

git clone https://github.com/mafik/streambot.git
cd streambot
go run .

If you manage to improve anything, please send a PR!

Attribution