- Create an account on Twitch for your bot
- Make sure your OBS version is >= 28.0.0.
If not, install OBS Websocket here
- Install the node modules for this program.
- Provide the OAuth data from your bot account in
/twitch/client.json
and/twitch/tokens.json
- Fill in the websocket authentication details in
/twitch/auth.json
- Change the CHANNEL and REWARD to your channel and your reward ID in
/twitch/listener.js
. - Make sure the values of MIC and CAM matches the names of the two OBS audio sources you want the script to activate / deactivate.
You can edit how long the toggle should last for by changing TIMEOUT
- Now run the program
Important: OBS needs to be open in order for the script to connect to the websocket
If you don't want to launch this manually each time you start your OBS, check this out.
The system contains two main parts, one interacting with OBS and the other one interacting with Twitch Chat.
The system connects to your OBS locally using OBS Websocket.
The connection to OBS is only first established upon a call from the other part, the twitch chat listener.
The listener connects to twitch chat as a read only bot that listens for specific custom channel point rewards redeemed by chatters.
This part is active at all times when the program is running and executes the OBS part when the channel point reward has been redeemed.
A user redeems the custom channel point reward "Mute Mic for 10s".
This projects listener sees this reward in chat and tells the OBS part of the system to launch.
The OBS websocket client starts and tries to connect to your OBS Websocket.
When connected, the audio state (muted/not muted) of the two defined audio input devices gets toggled. After 10 seconds, the input devices audio state gets once again toggled and returns to it's initial state.
A user redeems the custom channel point reward "Swap to webcam mic for 10s"
This projects listener sees this reward in chat and tells the OBS part of the system to launch.
The OBS websocket client starts and tries to connect to your OBS Websocket.
When connected, the audio state (muted/not muted) of the two defined audio input devices gets toggled. Meaning that your primary microphone gets muted and your secondary microphone (webcam) gets unmuted. After 10 seconds, the input devices audio state gets once again toggled and returns to it's initial state.
You can check what the ID is by uncommenting line 37 before starting the program again. Keep in mind that the reward needs to have a text input field in twitch chat.
If you already have Node.js installed, simply navigate your command line to the root of this project where you can find package.json and run npm install
You will need to have Node.js installed to execute the program in a command line or via a .bat file or similar. The program can only be connected to OBS websockets on the same network as where the script is running.
Start by navigating your command line to the root folder of this system where you can find index.js. Now launch the program using one of the following
npm start
or
node ./index.js
Leave it open throughout your stream.
By default, no. Perhaps you can! I personally have not looked into this too much, but maybe this can be of some help?
Questions? Reach me on Twitter or Discord!