JustDerb / RoR2-VsTwitch

Risk of Rain 2 Mod - Fight Twitch Chat.
https://thunderstore.io/package/JustDerb/Vs_Twitch/
6 stars 4 forks source link

[Suggestion] Integration with Streamer.bot #59

Open dbqt opened 3 months ago

dbqt commented 3 months ago

Summary: Integration with StreamerBot to enable more flexibility with custom interactions from Twitch, Youtube, Trovo, VStream, StreamElements, StreamLabs, and anything else that Streamer.bot can interact with.

Hello! This is an awesome mod, and I have a suggestion! Mainly because I'm in a community that is discovering RoR2 recently, but not all of us are streaming from Twitch. I saw that you have plans for Youtube, and this suggestion would enable that and much more for - what I believe - less work overall.

I apologize if any of this is already possible, I'm new to the modding scene of RoR2 and learning what is possible and what is not.

Why would this be useful? It adds flexibility for the user to decide what StreamerBot event triggers what in-game event. And the mod doesn't need to understand Twitch, Youtube, or any platform at all. StreamerBot would act as the abstraction layer. This would fully enable any event from any supported platforms to trigger any in-game event that this mod offers, fully configured by the user, all while being agnostic to the streaming platforms and their functionality.

StreamerBot is a bot that can be run locally on the streamer's machine. It connects to many platforms including Twitch, Youtube, Vstream, Trovo, StreamLabs, StreamElements, and many many more. It allows the user to configure their own actions, triggers, and events. It's also has the capabilities to send and receive messages via websocket. It's useful as an abstraction layer between the streaming platforms and whatever that might want to interact with the platforms while staying platform agnostic.

https://streamer.bot/

There are few ways I can imagine this integration being implemented.

1. Simplest integration

An option is to expose all the events that can be triggered to a websocket server. Users can create their own triggers and actions from Streamer.Bot to send a message to trigger the events. Basically exposing an API to trigger events.

The UI could be very similar to the existing screen to configure Channel Points with RiskOfOptions. It could be as simple as assigning a string to the events, and if a message is received with that string, trigger the event.

ie: The event for AllyBeetle could be exposed and a string configured by the user, let's say beetle. Receiving a message via websocket with the correct name (beetle) would trigger it. The user would setup some trigger in StreamerBot (maybe a twitch raid or a youtube command or a streamlabs redeem) that would trigger an action in StreamerBot that will send the message beetle to the websocket.

2. More involved integration

Another option is to implement an understanding of StreamerBot in this mod. Maybe it can connect to StreamerBot's websocket server and subscribe to events. This means there would need some new options/settings in the mod to configure what actions or trigger to listen for and select what in-game event it would trigger.

The mod would have an option to configure the websocket address to connect to. Perhaps similar to the existing Channel Points screen with RiskOfOptions, but with an additional field to enter the websocket address. The mod would use the GetEvents request to get all the possible events StreamerBot can send. Then next to each in-game event, there would be a dropdown populated with each available StreamerBot event.

More info: https://docs.streamer.bot/api/servers/websocket/requests

ie: The user loads up the game and opens the mod options menu. On navigating to the StreamerBot page, it sends a request to fetch all the possible events from StreamerBot. It then populates a dropdown for each in-game event with all the StreamerBot events. The user can set AllyBeetle to be linked to twitch.HypeTrainStart. Now whenever a hype train starts, it will trigger the AllyBeetle event.

Thanks for considering!

JustDerb commented 3 months ago

Thanks for the info! I've never heard of streamer.bot until now, so I'll look into it!

In the end if his does get integrated... I might change the name of the mod :)