Detecting Bits donated using a chatbot

Hey!

I am trying to implement a twitch chatbot into my game using C++ with TCP, which has had some success.
I can join the twitch stream, read messages from other users and even send messages.

However, what I am actually after is detecting when bits are donated to the streamers from viewers and then do stuff in my game in some way.
How do you actually do and test this?

Since activating donating bits on a twitch account can only be done if it is in the affiliate program, it is impossible for me to actually test this?
I also cannot find any sandbox or testing environment to be able to simulate a bits getting donated.

First off, Cheers are NOT Donations, they’re Tips. It’s an important distinction as it there’s a legal difference.

Secondly, you could either look at the bits tag in the cheer messages, as shown in the documentation https://dev.twitch.tv/docs/irc/tags#privmsg-tags

Alternatively rather than chat, a better option might be to use EventSubhttps://dev.twitch.tv/docs/eventsub as you can subscribe to types such as channel.cheer and receive notifications as and when cheers happen. EventSub over a Websocket transport is currently in beta so that could be ideal client-side in a game.

OK I understand, and there might be different ways to fetch the cheering event, but the most important question remained unanswered, how do I actually test this?

Since activating bits on a twitch account can only be done if it is in the affiliate program, it is impossible for me to actually test a cheering event?
I also cannot find any sandbox or testing environment to be able to simulate a cheering event.

I could do a huge code in my game for a cool cheering detection system, but if it can never be actually tested it will most likely not even work.

Say PayPal for example, you can test all events there through a sandbox, like donating money or buying an in-game item.
But I have not found such a system to generate cheering events in Twitch.

For testing in chat, you can go to literally any channel on Twitch that’s an affiliate or partner and either cheer yourself or just wait for a cheer from someone else. You don’t need to test on your own test channel. Or you could just create mock data based on the documented specifications and send that to your app to test.

For testing in EventSub, the Twitch CLI includes being able to trigger EventSub notifications https://dev.twitch.tv/docs/cli

Thank you!

I had no idea I could connect with TwitchIRC without using an oauth password.
I just used “PASS BLANK\r\n” and then “NICK justinfan23543637372\r\n” and it works to use the bot on any channel now like you said.

I waited until someone cheered and it now works perfectly, and can be tested very, very easily live and with testing code.

Thank you again! :slight_smile:

(For anyone else, I used C++ and Phantom139/PhantomBot on GitHub as a base code as a first test)