mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
I really want to learn this so bad. I am trying to make it display recent followers of the stream but I can't get it to work. It just comes back with a value of 0. Also I am trying to get the stream status and game.(don't know where to get that) I eventually want this to be on a timer when I get it to work. I have been playing around with the https://api.twitch.tv/kraken/channels/follows link to try to better understand it, but I think I need someone to explain to me how to get these things. On to what I am trying to do....

Example !recent msg $chan recent followers are: potatoman, cloud234, 43life, lugsmasher12.

Here is the current code

Code:
on *:text:!recent:#: {
JSONOpen -ud follows https://api.twitch.tv/kraken/users?limit=3
  msg $chan Recent followers: $json(follows, followers)
}



Last edited by powerade661; 29/05/15 11:31 PM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Untested

Code:
on *:text:!recent:#:{
  var %stream = $mid(#,2-), %url = https://api.twitch.tv/kraken/channels/ $+ %stream $+ /follows?limit=3

  jsonopen -ud follows %url

  var %list, %i = 0, %count = $json(follows,follows,length)
  while (%i < %count) {
    var %display_name = $json(follows,follows,%i,user,display_name)

    %list = $addtok(%list,%display_name,32)
    inc %i
  }

  msg # Recent followers are: %list
}

Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
It's not returning any message now.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
I just forgot to /inc %i, now it's tested.

Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Is it possible to get the game and stream status as well? Also, how would I put the recent followers on a timer?

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Go read the twitch API and the mIRC help on timers. You've had enough examples to do those things yourself.

Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
I went to the game section and the only thing they have available is top 50 games. I really don't understand how to grab the information from the API. Please help. I read timers, and I understand that now.

Last edited by powerade661; 31/05/15 08:34 PM.
Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
https://api.twitch.tv/kraken/channels/STREAM_NAME

Those things are in that link. You need to copy paste the text into a JSON viewer to see what the key names are.

Then you use jsonopen on the url and you can get the values with $json(handle,key)


Link Copied to Clipboard