Introduction
A couple of days ago, I saw someone post in #platform-feedback:engine-features a feature request for Twitch integration. This made me remember an old hacky project of mine that simulated this type of thing and was based on the Twitch integration of Clustertruck. I dug up my old code - and surprise! it kinda works! (Which is shocking since it was from what I would consider the beginnings of my career)
Video
How It Works
-
When the user joins the game, they are prompted to enter their channel name. This is their
twitch.tv/<channelname>
. -
The server then fetches the channel and a bot gets added to their stream watching for the verification command. The code is sent to the client and the user copy and pastes the command into their chat. Only the broadcaster can use the command - this allows us to verify that the user has access to the broadcaster’s account. Clustertruck (which was what inspired this project) requires the user to input their API key. Whether or not that is allowed by Roblox’s rules, I am doubtful so I believe this is a good workaround.
-
The user clicks verify again to send one last request to the external server to make sure everything went through. The channel then gets added to a list in the game.
-
Every ~30 seconds, the game chooses a random stream for voting. It will prompt the user with 3 randomly selected options that the users vote for. They only have to say the number (i.e.
1
,2
, etc). In the video, you see me as the broadcaster vote for the option. This was just for testing purposes - in an actual setting you would not be able to vote for an option as that would be cheaty. The twitch bot then watches chat and collects the votes - only 1 vote per viewer. -
After the votes are collected, the external server sorts them and sends them to the game server. The game server then fires a function accordingly.
I am in no way an expert at the Twitch API or external server communication. This method of Twitch Integration is very hacky and requires an external server to work. AFAIK there is no official way to do this straight from Roblox. This is just a proof of concept and it technically works, however, I doubt that at a large scale it would run efficiently.
Test it for yourself here: