GospelBG / ChatPointsTTV

Integrate your world with your Twitch stream. Minecraft in-game interactions through Twitch Channel Points, Bits, Subs and more!
https://modrinth.com/plugin/chatpointsttv
GNU General Public License v3.0
6 stars 1 forks source link

[BUG] Per streamer follow events #21

Open Verdux opened 2 weeks ago

Verdux commented 2 weeks ago

Is your feature request related to a problem? Please describe. Currently it appears you don't support per streamer follow events, I tried the format and it just throws config errors

Describe the solution you'd like Per streamer follow events, as you have with other events in the plugin

Describe alternatives you've considered N/A

Additional context I'd like to spawn a mob on the specific streamer that got a follow but currently it'd spawn a mob on every streamer each time a follow happens.

GospelBG commented 1 week ago

Could you send your config.yml alongside with your log file? Follow events have a different format than other events. Also be sure to check if you are running the latest version.

Verdux commented 1 week ago

I currently have this:

FOLLOW_REWARDS:
  - RUN CONSOLE say test follow event

Which works fine but this triggers the event no matter which streamer gets a follow. (Just been testing)

What I want is for this:

FOLLOW_REWARDS:
  Streamer1:
    - RUN CONSOLE spawnmob zombie streamer1 1
  Streamer2:
    - RUN CONSOLE spawnmob zombie streamer2 1

So events only trigger for the streamer that got a follow but when I tried following this format, I got yaml formatting errors.

GospelBG commented 1 week ago

I think it might be giving you an error because of an incorrect config as this is already a feature. Please try to use this format and check if the error persists:

FOLLOW_REWARDS:
  - Streamer1:
     - RUN CONSOLE spawnmob zombie streamer1 1
  - Streamer2:
     - RUN CONSOLE spawnmob zombie streamer2 1

You should use a hyphen before the streamer's name, just as you would do with the actions.

Let me know if it works!

Verdux commented 6 days ago

No longer threw an error but the event didn't trigger when using the following format


  - quimbly3:
    - RUN CONSOLE say test follow event
  - zytopian:
    - RUN CONSOLE say test follow event 2
  - starshipsushi:
    - RUN CONSOLE say test follow event 3

It did recognise the follow but no commands got run:

[18:35:50 INFO]: [ChatPointsTTV] Listening to starshipsushi's events...
[18:35:50 INFO]: [ChatPointsTTV] Twitch client has started successfully!
[18:38:38 INFO]: [ChatPointsTTV] verduxbot started following StarshipSushi 
GospelBG commented 6 days ago

It works for me. It may be a issue regarding your command. Try using @a as the command target like this;

RUN CONSOLE say @a follow event

You can also try some other actions as spawning or giving items

Verdux commented 5 days ago

That specific command is working fine for other events, just not the follow one. It can be a little difficult to test as I've got to wait on people to get a follow. Any chance we can get an admin debug command so I can trigger events for testing? Would speed this up a lot.

GospelBG commented 4 days ago

There is a Twitch API CLI tool for testing. It is undocummented on the java library's page although I think it works with Twitch4J. I would also have to change some of the code, but is not a problem since I have had this planned for a while now.

I've tested your issue in the latest version of the plugin (v2.3.1). Follow events work for me in both the default and specific user fields. Meanwhile until we have some API testing options, you can get another account or a friend who unfollows you and follows back again, as this seems to still trigger the api event.

If it still doesen't work for you try to give me some more details of your server: Minecraft version, server software and version, full plugin config, other plugins... This way I can try to replicate your conditions and test it out further.

Verdux commented 4 days ago

Well, first off that should be considered a bug if someone can spam follow/unfollow to trigger the event but that does infact trigger it again and no matter my formatting, I can only get commands to run on a global scale, not per streamer.

Config: https://mclo.gs/DJ7Y7xP Server: Paper 1.21.1 Chatpoints: 2.3.1

GospelBG commented 4 days ago

I think that the follow/unfollow spam may be abused too, but it's not an issue from the plugin, as all events are fired straight from the Twitch API. Your config seems to be ok at first sight. Just to check, is the account that you link with the plugin a moderator in all channels? I also see that you use a key-based authentication. Does your key have all the needed scopes?

Verdux commented 4 days ago

Not moderator in all the listed channels but it is in the ones I was testing on. I can get the follow events to work when I just put a command, no specific streamer.

It has the following:

bits:read chat:read channel:read:subscriptions channel:read:redemptions moderator:read:followers channel:bot user:bot user:read:chat user:read:moderated_channels

GospelBG commented 1 day ago

You have the correct scopes. I tried to replicate your setup, matching your versions but I am still unable to replicate your issue. Please check your console logs and search for a warning message that could have been thrown.

I've gone though the conversation and I realised that there is a mistake on the example I provided some days ago. I apologise for the confusion, as that may be the cause of the error. Please check your config, and make sure it is in this format:

FOLLOW_REWARDS:
  streamer1:
    - SPAWN COW
  streamer2:
    - SPAWN CREEPER

Make sure that there are no dashes before any line that contains a colon. Sorry once more for the confusion, let me know if this works

Verdux commented 11 hours ago

After all that, yeah. It appears to work now. Can you also look into the spam unfollow/follow triggering events? That makes the feature unusable once viewers find out.

and while I have you, can you give me an example of the format for per streamer gift rewards?

GospelBG commented 10 hours ago

Glad to hear it worked! Sorry once more for the inconvenience. I'll add your suggestion to my list and try to tinker with the issue, thanks for your feedback. Per streamer gift rewards work like any other normal reward type, here's an example:

GIFT_REWARDS:
  1:
    streamer1:
      - SPAWN COW
  5:
    streamer1:
      - SPAWN CREEPER
    streamer2:      
      - GIVE DIAMOND 1 

Feel free to ask for any doubts or issues in case you have any. Otherwise please close the issue.