mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
So I'm finally getting around to breaking apart my normalizer for twitch to make it user-consumable. If you are interested you can find the project over at Hawkee.

The project is my own attempt at making Twitch's pseudo IRC interface conform to the IRC RFC as much as possible.

I'm looking for anyone willing to use, bugtest, or help with the developement of the project to eventually have a twitch interface that fits seamlessly into the mIRC enviornment


I am SReject
My Stuff
Joined: Jul 2014
Posts: 34
S
Ameglian cow
Offline
Ameglian cow
S
Joined: Jul 2014
Posts: 34
Here is something I created a while back, it uses your JSON for mIRC. I hope it can help in some way... maybe the "channelViewers", which gets the list of users in a stream chat with what type of viewer they are... of course you can edit it in any way you see fit. As soon as I have time to test your code I will and will report any bugs I find.

Code:
;$TWITCHAPIURL
alias -l TWITCHAPIURL return https://api.twitch.tv/kraken/

;/loadTwitch [stream]
alias loadTwitch {
  if (!$hget(twitch)) {
    hmake twitch 10
  }
  if ($1) {
    channelFollows $1
    streamInfo $1
    channelViewers $1
    if (!$hget(twitch,$+($1,_stream))) {
      channelInfo $1
    }
    hadd twitch $+($1,_latestFollower) $hget(twitch,$+($1,_follower_0_user))
  }
}

;/channelInfo stream
alias channelInfo {
  jsonopen -du twitch $+($TWITCHAPIURL,channels/,$1)
  if (!$json(twitch).error) {
    hadd twitch $+($1,_mature) $json(twitch,mature)
    hadd twitch $+($1,_views) $json(twitch,views)
    hadd twitch $+($1,_followers) $json(twitch,followers)
  }
  jsonclose twitch
}

;channelFollows stream
alias channelFollows {
  jsonopen -du twitch $+($TWITCHAPIURL,channels/,$1,/follows?limit=3)
  if (!$json(twitch).error) {
    var %f = 0
    while ($json(twitch,follows,%f,created_at)) {
      hadd twitch $+($1,_follower_,%f,_date) $replace($remove($json(twitch,follows,%f,created_at),Z),T,$chr(32)) 
      hadd twitch $+($1,_follower_,%f,_user) $json(twitch,follows,%f,user,name)
      inc %f
    }
  }
  jsonclose twitch
}

;streamInfo stream
alias streamInfo {
  jsonopen -du twitch $+($TWITCHAPIURL,streams/,$1)
  if (!$json(twitch).error) {
    if (!$json(twitch,stream)) {
      hadd twitch $+($1,_stream) 0
    }
    else {
      hadd twitch $+($1,_stream) 1
      hadd twitch $+($1,_game) $json(twitch,stream,game)
      hadd twitch $+($1,_viewers) $json(twitch,stream,viewers)
      hadd twitch $+($1,_mature) $json(twitch,stream,channel,mature)
      hadd twitch $+($1,_status) $json(twitch,stream,channel,status)
      hadd twitch $+($1,_views) $json(twitch,stream,channel,views)
      hadd twitch $+($1,_followers) $json(twitch,stream,channel,followers)
    }
  }
  jsonclose twitch
}

;$newFollower(stream)
alias newFollower {
  var %a = $null
  channelFollows $1
  if ($hget(twitch,$+($1,_follower_0_user)) != $hget(twitch,$+($1,_latestFollower))) {
    %a = $v1
    hadd twitch $+($1,_latestFollower) %a
  }
  return %a
}

;/channelViewers stream
alias channelViewers {
  jsonopen -du twitch $+(https://tmi.twitch.tv/group/user/,$1,/chatters)
  if (!$json(twitch).error) {
    hdel -w twitch $+($1,_viewer_*)
    hadd twitch $+($1,_chatters) $json(twitch,chatter_count)
    var %types = moderators,staff,admins,global_mods,viewers
    var %t = 1
    while ($gettok(%types,%t,44)) {
      var %type = $v1
      hdel -w twitch $+($1,_,%type,_*)
      var %v = 0
      while ($json(twitch,chatters,%type,%v)) {
        var %viewer = $v1
        if (%viewer != $me) && (%viewer != $1) {
          hadd twitch $+($1,_,%type,_,%viewer) 1
          hadd twitch $+($1,_viewer_,%viewer) 1
        }
        inc %v
      }
      inc %t
    }
  }
  jsonclose twitch
}

Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
I've moved the project to github to facilitate easier contributions, version control, etc.

It can be found HERE


I am SReject
My Stuff
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Current Files are:

mTwitch.Core.mrc - Base functionality
mTwitch.DisplayName.mrc - Uses Displayname from message tags when displaying messages
mTwitch.GroupChat.mrc - Enables sending/receiving of whispers
mTwitch.OnlinePopup.mrc - Pops up a message box when a stream goes live
mTwitch.StateToTopic.mrc - Fills the channel topic with stream's state information
mTwitch.OAuth.mrc - Generates a full-access OAuth token

--

If you are on twitch and looking for/to help, join #mirchelp's chat

Last edited by FroggieDaFrog; 29/11/15 12:28 AM.

I am SReject
My Stuff

Link Copied to Clipboard