TwitchLib / TwitchLib.PubSub

PubSub component of TwitchLib.
38 stars 51 forks source link

PubSub OnListenResponse Listening to Channel Point redemptions not working? #59

Closed artibex closed 4 years ago

artibex commented 4 years ago

I don't know what I'm doing exactly wrong but I'm not able to listen to Channel Point redemptions:

    public Bot()
    {
        pubsub = new TwitchPubSub();
        pubsub.OnPubSubServiceConnected += Pubsub_OnPubSubServiceConnected;
        pubsub.OnListenResponse += Pubsub_OnListenResponse;
        pubsub.OnRewardRedeemed += Pubsub_OnRewardRedeemed;

        pubsub.Connect();
    }

    private void Pubsub_OnPubSubServiceConnected(object sender, System.EventArgs e)
    {
        pubsub.ListenToRewards(clientID);
        pubsub.ListenToVideoPlayback(ChannelName);
        pubsub.SendTopics(accessToken);
    }

    private void Pubsub_OnListenResponse(object sender, OnListenResponseArgs e)
    {
        if (!e.Successful)
            throw new Exception($"Failed to listen! Response: {e.Topic}");
        else Console.WriteLine(e.Topic);
    }

    private void Pubsub_OnRewardRedeemed(object sender, OnRewardRedeemedArgs e)
    {
        Console.WriteLine("Points redeemed");
        Console.WriteLine(e.DisplayName);
    }

I used this website to create a custom Scope Token with everything enabled for testing but nothing happens, no response. I used the Streamer Channel to create the token. The Streamer is Affiliate. I tested everything while the stream is offline.

I don't get any error when running it.

JayJay1989 commented 4 years ago

'clientid' is not the 'channelname'

artibex commented 4 years ago

Replaced the clientID with channelname, no changes to the behavior.

        pubsub.ListenToRewards(ChannelName);
        pubsub.ListenToVideoPlayback(ChannelName);
Mahsaap commented 4 years ago

Only responds to custom point redemptions I believe

JayJay1989 commented 4 years ago

you need to convert the channelname to a numerical channelid and insert it as a string in the ListenToRewards, eg channelname: xisumavoid => 33001940 https://chrome.google.com/webstore/detail/twitch-username-and-user/laonpoebfalkjijglbjbnkfndibbcoon for the converter

artibex commented 4 years ago

HOLY MOLY THANKS! Didn't know that I have to convert the channel name to a ID! I used the Client ID from the website and thought that was right.

Syzuna commented 4 years ago

This seems fixed? If you are still seeing issues feel free to reopen.