Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yet Another Channel Point Redeem Issue #55

Open
derrickvi opened this issue Jun 23, 2023 · 43 comments
Open

Yet Another Channel Point Redeem Issue #55

derrickvi opened this issue Jun 23, 2023 · 43 comments
Assignees
Labels
bug Something isn't working question Further information is requested
Milestone

Comments

@derrickvi
Copy link

I read through all the instructions multiple times.
I've gone through the closed issues with similar problems.
We have made sure the oauth token includes the correct permissions using the link in the readme,
We have made sure the redeem title is exact.
Commands like !allychip (name) work fine, but the redeem AllyBeetle, or Summon Beetle, or any exact variation thereof doesn't even trigger an error in console to say it couldn't run. It just doesn't do anything, like it never happened. Yet ItemVoting spams chat just fine, and Mod/Broadcaster commands work. Pulling out our hair here. Any help would be appreciated. Let me know what screenshots or logs you need from me.

@derrickvi
Copy link
Author

com.justinderby.vstwitch.txt

Attached is the config file with the oauth clear for security.

@JustDerb
Copy link
Owner

Hi @derrickvi , thanks for the config! Can you provide screenshots of your Channel Points settings UI on Twitch? This will help me cross-reference things to help debug.

@JustDerb JustDerb self-assigned this Jun 26, 2023
@JustDerb JustDerb added the question Further information is requested label Jun 26, 2023
@JustDerb
Copy link
Owner

@derrickvi version 1.0.14 now includes Channel Point config options in the in-game setting menu. You should be able to use this to quickly test configurations out.

@sunflowerpillar
Copy link

Hey I'm having this same issue actually and even with the new update and being able to quickly test stuff, the command prompt acts like the channel points are being done. Everything works fine and the channel points are case sensitive correct, but it just doesn't register it.

let me know any info i need to send over, would love to play this mod :3

@JustDerb
Copy link
Owner

JustDerb commented Jan 3, 2024

@sunflowerpillar the update didn't really fix anything, just made fiddling with the mods settings a bit easier.

Could you upload a screenshot of the channel points config from the Risk Of Rain 2 settings page, as well as a screenshot of one of your Twitch channel points custom rewards? (As described in the help article)

@sunflowerpillar
Copy link

here are the test channel points I have and what showed up in the console command!

channel points config and the channel points being redeemed
console commands
channel points in manage channel points

@JustDerb
Copy link
Owner

JustDerb commented Jan 8, 2024

@sunflowerpillar So the config in Vs Twitch should be the name of the Twitch reward. So, you have a reward named "AllyBeetle" on Twitch, so the config for AllyBeetle in the Vs Twitch config should be "AllyBeetle" (not "1000").

Another example: If your reward name was "Spawn Beetle", the config for AllyBeetle in the Vs Twitch config should be "Spawn Beetle" (again, not "1000")

@sunflowerpillar
Copy link

channel points
mod options

more like this @JustDerb ? I tried this and got nothing as well, let me know if this isn't correct. I also made sure to apply it before doing something

@JustDerb
Copy link
Owner

JustDerb commented Jan 8, 2024

@sunflowerpillar that looks correct for the config. Do you see anything around redeems in the mod's game console? You should see something like:

Channel Points Redemption: Spawn Lemurian (Event triggered: {some data})"

@sunflowerpillar
Copy link

@JustDerb nothing sadly gets triggered in the game console, acts like nothing happens :(

@JustDerb
Copy link
Owner

@sunflowerpillar Okay, so that points to your OAuth token not having the correct scopes. Can you follow the instructions in the Readme under ImplicitOAuth to remove the token and re-create it (using the link, which will give you the correct scopes):

The "password" to access Twitch APIs. Please visit twitchapps.com to get the password to put here. Note that this password is not sent to any servers other than Twitch to authenticate. DO NOT GIVE THIS TO ANYONE. To revoke this password, go to Twitch Connections Settings and Disconnect the app named "Twitch Chat OAuth Token Generator".

Then update the mod config to use that new token?

@sunflowerpillar
Copy link

sunflowerpillar commented Jan 11, 2024

@JustDerb so I did that and this is all that showed up with these redeems
console + redeems

would there be a chance a minimal amount of mods are getting in the way? I don't know if any of these things showing up in the console go with my commands.

I do want to say it's like the person said above. Everything else works and shows up when I load up a run. Folks can vote and all that, it's just channel point redeems act like they don't exist as far as I can tell, even after changing my OAuth

@JustDerb
Copy link
Owner

Hmm, thanks for all the info! There might be a weird bug in the mod as you've done all the right things at this point. It's hard to see what's going on because of Channel Points being locked behind being a Twitch Affiliate. I might need to start streaming a bit to get it so I can test it myself 😬

@JustDerb
Copy link
Owner

Curious, I see forbiddenFlags=NoCharacterSpawn - when you redeemed, were you spawned into the map? I'm wondering if that might do something about it.

Also, you can enable Twitch debug logging in the mod config. It's under Twitch > DebugLogs. You should see activity in the console when you redeem something....

@meburningslime
Copy link

meburningslime commented Oct 21, 2024

@sunflowerpillar Okay, so that points to your OAuth token not having the correct scopes. Can you follow the instructions in the Readme under ImplicitOAuth to remove the token and re-create it (using the link, which will give you the correct scopes):

The "password" to access Twitch APIs. Please visit twitchapps.com to get the password to put here. Note that this password is not sent to any servers other than Twitch to authenticate. DO NOT GIVE THIS TO ANYONE. To revoke this password, go to Twitch Connections Settings and Disconnect the app named "Twitch Chat OAuth Token Generator".

Then update the mod config to use that new token?

Would I need to do anything special to give the auth full permissions or should it just work without me modifying anything?

Also, should the "oAuth:" stay or be cut out? I have been deleting it before using the code.

@JustDerb
Copy link
Owner

Also, should the "oAuth:" stay or be cut out? I have been deleting it before using the code.

The "password" should include that. You shouldn't delete it.

@meburningslime
Copy link

Okay, I did that with channel point reward names and a new auth token that can read the points and everything else you've seen a dozen times. It still doesn't work. What should I do? Also, thank you for the help, you're more dedicated than the devs!

@meburningslime
Copy link

I saw someone else say they tried !roll in chat and so I tried it and it spawned an Umbra. It seems everything is working except the points redemption

@JustDerb
Copy link
Owner

Hmm... @meburningslime Can you send a screenshot of your channel points config in R2Modman, and a screenshot of one of your channel point rewards from Twitch (the page where you are editting one, showing all the details)

@meburningslime
Copy link

meburningslime commented Oct 25, 2024

image
image
These commands are enabled when I test them.

@JustDerb
Copy link
Owner

Okay that all looks right. Now I'm wondering if the underlying Twitch client is breaking. This becomes hard to test as I don't have a Twitch account that has Channel Points enabled so it'll be a lot of blind guessing (which is also why I cannot provide great support here and why it's been a long lasting issue).

@meburningslime
Copy link

If you ever need someone to help test, I'd be willing to assist!

@JustDerb
Copy link
Owner

JustDerb commented Nov 5, 2024

Checking in: I think there is an update Twitch did that broke the library I'm using (TwitchLib) so I'm trying to update that library to see if it fixes it. Sadly, the upgrade is causing a heep of other troubles so it'll be a bit before I have a potential fix working.

@JustDerb JustDerb added the bug Something isn't working label Nov 10, 2024
@JustDerb
Copy link
Owner

Hey folks; I've compiled a new version of the TwitchLib library and tested a bit on my own machine and it looks everything works (that I can test). Can someone download this Zip file, and extract it over the current plugin files?

JustDerb-Vs_Twitch.zip

To find the current plugin files:

  1. Launch r2modman
  2. Open your profile
  3. Click "Settings"
  4. Click "Browse profile folder"
  5. Open the BepInEx folder
  6. Open the plugins folder
  7. Open the JustDerb-Vs_Twitch folder
  8. Overwrite all contents inside with the downloaded Zip file

Please let me know if the Channel Points are working now. If not, please go into the mod settings (via the config editor) and turn on the Twitch.DebugLogs setting, run the game again to grab more logs and then upload them here! Thanks!

@meburningslime
Copy link

It keeps saying that I have invalid permissions. I made a new auth multiple times. I cannot even use item voting with that for some reason

@JustDerb
Copy link
Owner

@meburningslime can you upload your logs so I can see the error?

@meburningslime
Copy link

image
Console says same thing. I could send you the full log if you want. This has happened no matter how many times I disconnect and reconnect the auth.

@JustDerb
Copy link
Owner

@meburningslime yeah, send me the full logs please!

You can find a more detailed log file for debugging in either :
C:\Users\<UserName>\AppData\LocalLow\Hopoo Games, LLC\Risk of Rain 2\ folder,
or
C:\Users\<UserName>\AppData\Local\Temp\Hopoo Games, LLC\Risk of Rain 2\
the file is called Player.log.

@meburningslime
Copy link

Sorry for the long wait time!
That folder was completely empty, I will instead copy the console log, maybe that will help?
LogOutput.log

@JustDerb
Copy link
Owner

[Debug  :  VsTwitch] [Twitch API] Trying to find channel ID...
[Error  :  VsTwitch] System.AggregateException: One or more errors occurred. (Your request was blocked due to bad credentials (Do you have the right scope for your access token?).) ---> TwitchLib.Api.Core.Exceptions.BadScopeException: Your request was blocked due to bad credentials (Do you have the right scope for your access token?).
  at TwitchLib.Api.Core.HttpCallHandlers.TwitchHttpClient.HandleWebException (System.Net.Http.HttpResponseMessage errorResp) [0x00096] in <cbc0290a15a04bbd88001632a4a627c5>:IL_0096 
  at TwitchLib.Api.Core.HttpCallHandlers.TwitchHttpClient.GeneralRequestAsync (System.String url, System.String method, System.String payload, TwitchLib.Api.Core.Enums.ApiVersion api, System.String clientId, System.String accessToken) [0x002d0] in <cbc0290a15a04bbd88001632a4a627c5>:IL_02D0 
  at TwitchLib.Api.Core.ApiBase+<>c__DisplayClass13_0`1[T].<TwitchGetGenericAsync>b__0 () [0x000b1] in <cbc0290a15a04bbd88001632a4a627c5>:IL_00B1 
  at TwitchLib.Api.Core.ApiBase.TwitchGetGenericAsync[T] (System.String resource, TwitchLib.Api.Core.Enums.ApiVersion api, System.Collections.Generic.List`1[T] getParams, System.String accessToken, System.String clientId, System.String customBase) [0x00232] in <cbc0290a15a04bbd88001632a4a627c5>:IL_0232 

So yeah, looks like the Oauth token being passed in isn't valid (or doesn't have enough scopes). This is hard to help simply because commenting the Oauth is enough for anyone to "use" your account. As a last ditch effort I'd try to detach (de credential) the TwitchApp connection and redo the linking process again... If that doesn't work we might need to get a bit more creative.

@meburningslime
Copy link

Disconnected and reconnected:
image
Used the auth code with the "oauth:" prefix in ImplicitOAuth and ClientID...

Got this error in chat:
image
LogOutput.log

@JustDerb
Copy link
Owner

JustDerb commented Dec 7, 2024

@meburningslime so I think I might have a hunch of whats going wrong. The "Twitch Chat OAuth Token Generator" moved to a new Client ID and the original site seems to have disappeared. My testing has been using a super old non-expiring OAuth token, so that's why I never saw anything break. I've reset the login flow and started seeing errors similar to yours. So, let's do this to try and fix it (temporarily):

  1. Go to https://www.twitch.tv/settings/connections and disconnect the "Twitch Chat OAuth Token Generator" connection
  2. Go to https://twitchtokengenerator.com/quick/Bt3H1fq9dl
  3. Authorize the connection (this is the new app, called "Twitch Token Generator by swiftyspiffy")
  4. Finish authorization by completing the CAPTCHA
  5. On the website, copy the Client ID (should be gp762nuuoqcoxypju8c569th9wz7q5) and overwrite the ClientID VsTwitch setting in r2modman to it
  6. On the website, copy the Access Token and overwrite the ImplicitOAuth VsTwitch setting in r2modman to it
  7. Launch the game and see if it's connected

If it does work, let me know! Sadly the code doesn't know how to grab and use the Refresh Token, so the Access Token will expire and stop working after a while. To fix it temporarily you need to start at step 2 above to grab a new access token. If this really solves the problem, I'll work on an overhaul to get this Twitch login flow to work seamlessly (and refresh as well).

@meburningslime
Copy link

@JustDerb thanks a ton, I will work on testing this soon. Finals in college have unfortunately taken a lot of my time recently but I will work on testing it as quickly as is feasible. I should have plenty more time to assist if more debugging is needed too.

@meburningslime
Copy link

@JustDerb I followed all of the steps but I was using Thunderstore, not R2. The old features work now, that being item voting, but the channel point redemptions do not. I am currently installing r2modman to see if that will fix it.

@meburningslime
Copy link

LogOutput.log
Alright, no good. It works on both Thunderstore and R2 for votes but not channel points. Here is the log. Hope it helps!

@JustDerb
Copy link
Owner

@meburningslime so I see these relevant things, which doesn't look wrong in any way...

[Info   :   BepInEx] Loading [VsTwitch 1.0.16]
[Warning:  VsTwitch] Could not register Channel Points event: Ally Beetle
[Info   :  VsTwitch] Successfully registered Channel Points event: Ally Lemurian (lizardvoid)
[Info   :  VsTwitch] Successfully registered Channel Points event: Ally Elder Lemurian (chunkylizardvoid)
[Info   :  VsTwitch] Successfully registered Channel Points event: Rusted Key (weirdpotato)
[Info   :  VsTwitch] Successfully registered Channel Points event: Bit Storm (ITSRAININGTACOS)
[Warning:  VsTwitch] Could not register Channel Points event: Bounty
[Warning:  VsTwitch] Could not register Channel Points event: Shrine Of Order
[Warning:  VsTwitch] Could not register Channel Points event: Shrine Of The Mountain
[Warning:  VsTwitch] Could not register Channel Points event: Aurelionite
[Warning:  VsTwitch] Could not register Channel Points event: Lunar Chimera (Wisp)
[Warning:  VsTwitch] Could not register Channel Points event: Mithrix
[Warning:  VsTwitch] Could not register Channel Points event: Elder Lemurian
...
[Info   :  VsTwitch] Connecting to Twitch...
[Info   :  VsTwitch] [Twitch API] Channel ID for meburningslime = 756204203
[Info   :  VsTwitch] [Twitch PubSub] Connecting...
...
[Info   :  VsTwitch] [Twitch PubSub] Sending topics to listen too...
...
[Info   :  VsTwitch] [Twitch PubSub] Listening to channel-points-channel-v1.756204203 - {"Error":"","Nonce":"0J35phXx","Successful":true}
[Info   :  VsTwitch] [Twitch PubSub] Listening to channel-bits-events-v2.756204203 - {"Error":"","Nonce":"0J35phXx","Successful":true}
...
[Info   :  VsTwitch] Connected to Twitch! Watching meburningslime...

Would you be okay with jumping on a Discord call in the next week or two to test things out while I "backseat program"? I'm at a loss of what's going on here 🙃

@JustDerb
Copy link
Owner

I've attached another version of VsTwitch with the old deprecated method for monitoring Channel Point events. You can also try this as well and let me know if it works. (If it doesn't please set the "Twitch.DebugLogs" setting to true, run through it again, and then send me the logs!)

JustDerb-Vs_Twitch-DeprecatedPubSub.zip

Note: You may need to generate a new Twitch Access Token since it's expired (will fix this once we figure out what's happening here)

@JustDerb
Copy link
Owner

JustDerb commented Dec 22, 2024

And I just looked through the code again... and I realized the two events (ListenToChannelPoints and ListenToRewards) don't funnel to the same underlying event. So I had a bug! I listened to the new PubSub event, but the code was only processing the old one!!!

So, I've fix that and this new uploaded version should work with the new event and process correctly! (If it doesn't please set the "Twitch.DebugLogs" setting to true, run through it again, and then send me the logs!)

JustDerb-Vs_Twitch-ActuallyProcessNewChannelPointsEvent.zip

🚀 Please try this one! This should fully fix things!!

Note: You may need to generate a new Twitch Access Token since it's expired (will fix this once we figure out what's happening here)

@JustDerb
Copy link
Owner

(@meburningslime - since I didn't ping you on the other messages. I think this latest version will fix things!)

@meburningslime
Copy link

@JustDerb it works! All the channel point redemptions can be activated now! However, it still has yet to be fixed entirely... if you spawn any ally in, the in-game director gets permanent max credits. This continually spawns elite enemies until the spawn amount is capped. What is stranger still though is that if you quit the run then rejoin, the director still has max credits. I have some footage if you need it. We are so close!

@JustDerb
Copy link
Owner

@meburningslime awesome, glad to hear we're making forward progress! To confirm did you try the JustDerb-Vs_Twitch-ActuallyProcessNewChannelPointsEvent.zip file for this?

Would love to see the footage - but I can also see if I can repro by forcing the channel point event. I'm guessing one of the major updates changed something....

@meburningslime
Copy link

For the sake of timeliness I chose not to edit it, sorry. Here is an uncut full view of what I played.
https://youtu.be/VtwTqhKcl08
@JustDerb

@JustDerb
Copy link
Owner

@meburningslime well that's a fun bug! Turns out the update made the SpawnCard cached, so I previously set the cost to zero to ensure the director can spawn it:

card.directorCreditCost = 0;

This is no longer needed!

Here's an updated ZIP while I get all this wrapped into a new mod update: JustDerb-Vs_Twitch-1-0-17-RC1.zip

@JustDerb JustDerb added this to the 1.0.17 milestone Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants