TwitchLib / TwitchLib.PubSub

PubSub component of TwitchLib.
38 stars 51 forks source link

OnRewardRedeemed #75

Closed Yozhik67853 closed 3 years ago

Yozhik67853 commented 3 years ago

Hello, please tell me, I need to know the number of channel points spent by the user when using the reward. How am I trying to get this

 TwitchLib.PubSub.TwitchPubSub clientPubSub;
        internal void Connect(bool isLogging)
        {        

== dont work ==
            clientPubSub = new TwitchLib.PubSub.TwitchPubSub();
            clientPubSub.OnPubSubServiceConnected += Client_onPubSubServiceConnected;
            clientPubSub.OnListenResponse += Client_onListenResponse;
            clientPubSub.OnRewardRedeemed += Client_onChatRewardRedeemed;  // not work i not visible my message in point channel our coast point channel
            clientPubSub.ListenToVideoPlayback("MyTwitchNickName");
            clientPubSub.ListenToWhispers("MyTwitchNickNameConvertToID");
            clientPubSub.Connect();

==                       ==
==     its work      ==
            client = new TwitchClient();
            client.Initialize(creds, TwitchInfo.ChannelName);
            client.OnMessageReceived += Client_OnMessageReceived; // work i visible my message on Console
            client.OnChatCommandReceived += Client_OnChatCommandReceived; // work i visible my command on Console
            client.Connect();
            client.OnConnected += Client_OnConnected;
==                    ==
}

class new TwitchClient (); works well I can receive messages from the my channel chat using the identifier and also reply to messages from the bot channel oAuth with chat:read and chat:edit (MyChannel_Bot)

for the main channel (broadcast channel) I created oAuth with chat:read and channel:read:redemptions permissions (MyChannel)

  private void Client_onPubSubServiceConnected(object sender, EventArgs e)
        {        
            clientPubSub.SendTopics("myMainChannelOauth");
        }
        private void Client_onListenResponse(object sender, TwitchLib.PubSub.Events.OnListenResponseArgs e)
        {
            if (e.Successful)
                Console.WriteLine($"Successfully verified listening to topic: {e.Topic}");
            else
                Console.WriteLine($"Failed to listen! Error: {e.Response.Error}");
        }
        private void Client_onChatRewardRedeemed(object sender, TwitchLib.PubSub.Events.OnRewardRedeemedArgs e)
        {
            Console.WriteLine("Points redeemed");
            Console.WriteLine(e.DisplayName);
        }

After running the program, I see the following message regarding the (Client_onListenResponse) method Successfully checked listening to the video.playback theme. channelName and Whispers.ChannelNameConvertToId .

But when I use a channel reward of 100 points in chat, the (Client_onChatRewardRedeemed) method does not work, please tell me what I am doing wrong

Syzuna commented 3 years ago

What version are you using? try to use the latest prerelease as there were numerous issues fixed with channel points in the last few prereleases

Yozhik67853 commented 3 years ago

What version are you using? try to use the latest prerelease as there were numerous issues fixed with channel points in the last few prereleases

Hi, i use 3.1.4 PubSub , download in NuGet Today

JayJay1989 commented 3 years ago

you forgot clientPubSub.ListenToRewards("MyTwitchNickNameConvertToID");

Yozhik67853 commented 3 years ago

you forgot clientPubSub.ListenToRewards("MyTwitchNickNameConvertToID");

Thank you, now everything works)))) it's cool