TwitchLib / TwitchLib.PubSub

PubSub component of TwitchLib.
38 stars 51 forks source link

Pubsub event OnChannelPointsRewardRedeemed never fires #113

Closed zang227 closed 1 year ago

zang227 commented 1 year ago

psClient = new TwitchPubSub(); psClient.OnPubSubServiceConnected += OnPubSubServiceConnected; psClient.OnChannelPointsRewardRedeemed += PsClient_OnChannelPointsRewardRedeemed; psClient.ListenToChannelPoints("38802591"); psClient.Connect(); `

private void PsClient_OnChannelPointsRewardRedeemed(object? sender, TwitchLib.PubSub.Events.OnChannelPointsRewardRedeemedArgs e) { if(e.RewardRedeemed.ToString() != null) { UpdateChatBox(e.RewardRedeemed.ToString()); } }

I've got this code, and when I redeem a channel point reward it never reaches PsClient_OnChannelPointsRewardRedeemed

iProdigy commented 1 year ago
  1. You appear to be missing psClient.SendTopics() (and be sure to pass the broadcaster's access token with the channel:read:redemptions scope) - you can do this call within onPubSubServiceConnected
  2. Make sure you're testing this event with a custom reward redemption (redeeming the automatic rewards created by twitch will not trigger these pubsub events)
zang227 commented 1 year ago
        psClient = new TwitchPubSub();
        psClient.OnPubSubServiceConnected += OnPubSubServiceConnected;
        psClient.OnChannelPointsRewardRedeemed += PsClient_OnChannelPointsRewardRedeemed;
        psClient.ListenToChannelPoints("38802591");
        psClient.SendTopics(streamerAuthKey);
        psClient.Connect();

I've added it (not sure if its in the right place or correctly configured [not sure if i need to define topics to be sent?]) but I'm still not getting an event. And I can confirm both the streamer authkey has every scope enabled, and that the reward is custom.

zang227 commented 1 year ago

Actually I see from the example code that the sendtopics goes after establishing connection. Adding that has fixed my issue thank you!