vdeville / twitch-bot

Framework/Library to create Twitch bot using PHP and module system. Easily create your own module with your own features
https://mythevalentinus.github.io/twitch-bot-docs/en/
GNU General Public License v3.0
7 stars 0 forks source link

VIP User Check and Parameter Deprecation #12

Closed mahony0 closed 5 years ago

mahony0 commented 5 years ago

On PRIVMSG prototype, it shows parameters like @badge-info=; and badges=; but on this line: https://github.com/MyTheValentinus/twitch-bot/blob/6fe8f40813d4d27e3ab432d1cb313249cbcd7111/src/class/IrcConnect.php#L234 VIP user check handled with: @badges= I haven't tested it yet but it seems this will never catch VIP status either.

I can send PR if you can approve this issue.

Same table also has shown subscriber, turbo and user-type parameters Deprecated and will be send in badges parameter in future, so badges parameter will be very handful for all of this values and probably we need to change in near future.

mahony0 commented 5 years ago

Also if we solve this issue, I can send PR for getting Partner status check for the message user.

vdeville commented 5 years ago

Hello I need to check this from documentation and make some tests I will come back here when i have a update Thanks

mahony0 commented 5 years ago

Prototype for PRIVMSG: https://dev.twitch.tv/docs/irc/tags/#privmsg-twitch-tags

vdeville commented 5 years ago

Ok, i not have time to test now, can you test by removing the arobase ? "@badges=" change to "badges=" ?

mahony0 commented 5 years ago

Yes, I already change that part in my own library because can't get badge details while code is like @badge=

As I saw on the API document, PRIVMSG is starting with @badge-info=;badges=; so "badge=" is returning actual parameter results.

vdeville commented 5 years ago

Ok, with badge-info what type of more details you get ? It's important for a bot ? Thanks

Ragnar-Oock commented 5 years ago

the tag list begin with an @ and end with the tag "user-type" which is the message author and can be treated differently, all the stuff listed between those spots should be considered useful information, you can find the badges, the color of the display name, if the user is using turbo, if the user is a mod and much more

mahony0 commented 5 years ago

I think my issue misunderstood. I proposed to change @badges= with badges= for catching VIP status at first. @badge-info is currently only has subscriber value, a total month of subscription of user which is also an important value IMHO. It's up to you. If you think that props are valuable, I can send PR for that.

Ragnar-Oock commented 5 years ago

oh no. It's just that I forget the point of my message before getting to it 😅 And I assumed that the tags were parsed as automatically as possible, just get the tag's name and its value. If it's an array parse it as such and throw all of this in an array to be accessible by whatever use the lib. It's how we did it in the python IRC client. This way you will still parse all the tags aven if twitch decides to add a bunch more without noticing anyone (as they usually do 😄) and you don't have anything to do to maintain the lib when it occurs.

vdeville commented 5 years ago

In us case the only need is to catch badge without extra information like version... For the moment in all modules and the core the only checked badge is VIP, other roles is catch elsewhere. @mahony0 Yeah please make a PR for basic fix for the moment ;) Thanks for your work

mahony0 commented 5 years ago

I created PR with #13 In future releases, as @Ragnar-Oock noted, we should parse all PRIVMSG and other Twitch Tags parameters in IrcConnect Class for using them easily in modules.

vdeville commented 5 years ago

I think create a User object that contain all for these informations. Modules get Message object containing User object.

I need some refactor to do this, but plan this in future.

vdeville commented 5 years ago

Follow this card in project board: https://github.com/MyTheValentinus/twitch-bot/projects/1#card-26300419