Skhmt / tapic

Twitch API & Chat. A javascript library for doing things with twitch chat, APIs, and pubsub. Can be used to make a HTML or Node.js bot. Or something.
MIT License
18 stars 5 forks source link

isFollowing always returning true #5

Closed vagneralbino closed 7 years ago

vagneralbino commented 7 years ago

Thanks for such a useful application! I'm an aspiring web developer, and so far your code has been extremly helpful.

Are you still maintaining this code? I've run into a problem that the function isFollowing always returns true. I noticed that Twitch now requires requests to be made with user ID (as opposed to usernames), but even when I use the ids, the function returns true, even when Twitch returns with the error that the user is not following. I've looked into the code, but unfortunately I can't figure out what is going on by myself.

Is there any chance you could look into this issue? Thanks a lot!

Skhmt commented 7 years ago

I'll do tests later today when I get a chance, but did you properly use the callback and not the return of the function itself?

For example:

let channel = "vagneralbino";
let user = "skhmt";
TAPIC.isFollowing(channel, user, res => {
    if ( res.isFollowing ) console.log( 'Following since: ' + res.dateFollowed );
    else console.log( 'Not following.');
});
vagneralbino commented 7 years ago

Instead of res => I used function( res ), but I believe both work the same way? The rest looks pretty much the same.

Either way, just to make sure, I tried your suggestion and it also had the same results. Thanks again!

Skhmt commented 7 years ago

Oops, they're supposed to be user ids, not usernames, you're right. I'll look in to it more later!

Skhmt commented 7 years ago

I think I fixed it, but I can't re-build until tonight. Changes were added to git, so feel free to try it out. Download the repo and navigate to it in your terminal/command line, then run:

npm install

npm run build

Skhmt commented 7 years ago

Fixed in 5.0.1