Hello all!
I am posting here, because I need help with tracking new Bits cheering events on a twitch channel inside my Unity C# application. So far, I have a communication with the Twitch Client and Twitch API, letting me receive information via multiple OnEvent methods (such as client.OnNewSubscriber) and GetChattersAsync via the API.
Question 1:
From what I found out, I am supposed to use the API.Helix methods, but I am unsure which is the correct method to track NEW occuring events. I only see leaderboards and such.
Question 2:
I have difficulties understanding the Invoke process when using the Twitch API. I saw mostly posts talking about sending a request to an URL via http and add information in headers. Honestly, I am not well versed in this category, so I was relying on the API.Invoke method, but aside from GetChattersAsync I cannot make anything else work.
Here is the working example:
Invoke step:
api.Invoke(api.Undocumented.GetChattersAsync(ourTwitchClient.client.JoinedChannels[0].Channel), GetChatterListCallback);
Feedback method:
private void GetChatterListCallback(List listOfChatters)
{
Debug.Log("List of " + listOfChatters.Count + " Viewers: ");
foreach (var chatterObject in listOfChatters)
{
Debug.Log(chatterObject.Username);
}
}
Here is a NOT working example of GetBitsLeaderboardAsync:
Invoke step:
api.Invoke(api.Helix.Bits.GetBitsLeaderboardAsync(), GetBitsLeaderboard);
Feedback method:
private void GetBitsLeaderboard(GetBitsLeaderboardResponse bitsLeaderboardResponse)
{
Debug.Log("Leaderboard documented: " + bitsLeaderboardResponse.ToString());
}
If relevant, here is my API setup code:
api = new Api();
api.Settings.AccessToken = Secrets.BOT_ACCESS_TOKEN;
api.Settings.ClientId = Secrets.CLIENT_ID;
So basically, as summary again, I want to react on a new bits cheer event inside my Unity project.
Thank you very much for your help in advance! I am posting this, because I really am stuck for days now on this.
Best regards.