TwitchGetRewardUserCounters

Returns a list of Twitch Reward Counters

Signature

public List<TwitchRewardCounter> TwitchGetRewardUserCounters(string rewardId, bool persisted = true)

Parameters

rewardId
string required

Id of your reward. Available by right-clicking your reward under Platforms > Twitch > Channel Point Rewards

persisted
bool
Default:
True

If true will use the persisted user counters of the reward, if not the non-persisted.

Return Type

List<Streamer.bot.Plugin.Interface.Model.TwitchRewardCounter>

Example

using System;
using System.Collections.Generic; //needed due to List usage
public class CPHInline
{
    public bool Execute()
    {
        //Reward Id of the channel point reward you want to get your counters of
        string rewardId = "your reward id";
        //Whether or not you want to get the persisted or non persisted counters
        bool persisted = true;

        List<TwitchRewardCounter> rewardCounters = CPH.TwitchGetRewardUserCounters(rewardId, true); 
        foreach(TwitchRewardCounter userCounter in rewardCounters)
        {
            string displayName = userCounter.UserName;
            int counter = userCounter.Count;

            CPH.LogInfo($"{displayName} has Count of {counter}.");
        }
        return true;
    }
}