Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- --:: TwitchAPI Example ::
- --:: By: Kd8lvt ::
- --:: -------------------------------------------------- ::
- --:: Shows: ::
- --:: If the streamer is live: ::
- --:: Latest Follower ::
- --:: Viewer Count ::
- --:: Otherwise: ::
- --:: That they aren't live ::
- --:: -------------------------------------------------- ::
- --:: To configure: ::
- --:: Change the streamers in the 'streamers' table ::
- --:: -------------------------------------------------- ::
- --:: ::
- --:: ::
- --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- os.loadAPI("twitchapi")
- m = peripheral.find("monitor")
- m.setTextScale(2) --Getting around a CC bug
- m.setTextScale(1)
- liveX = 5
- notLiveX = 1
- startY = 1
- color = m.isColor()
- streamers = {
- "choobtastic",
- "wolftaz",
- "itanshi",
- "soraleoyfaith",
- "odduser",
- "3lementalstudios",
- "D3athB0b",
- "lokbatch",
- "kd8lvt"
- }
- function nextY()
- x,y = m.getCursorPos()
- newY = y + 1
- end
- function streamerloop(streamer)
- nextY()
- m.setCursorPos(notLiveX,newY)
- if color then
- if twitchapi.checkLive(streamer) then
- m.setTextColor(colors.green)
- m.write(streamer.." is live!")
- m.setTextColor(colors.white)
- nextY()
- m.setCursorPos(liveX,newY)
- m.write(streamer.."'s Latest Follower: "..twitchapi.lastFollower(streamer))
- nextY()
- m.setCursorPos(liveX,newY)
- m.write(streamer.."'s Viewer Count: "..twitchapi.viewerCount(streamer))
- else
- m.setTextColor(colors.red)
- m.write(streamer.." is not live!")
- m.setTextColor(colors.white)
- end
- else
- if twitchapi.checkLive(streamer) then
- m.write(streamer.." is live!")
- nextY()
- m.setCursorPos(liveX,newY)
- m.write(streamer.."'s Latest Follower: "..twitchapi.lastFollower(streamer))
- nextY()
- m.setCursorPos(liveX,newY)
- m.write(streamer.."'s Viewer Count: "..twitchapi.viewerCount(streamer))
- else
- m.write(streamer.." is not live!")
- end
- end
- function main()
- while true do
- m.clear()
- for k,v in pairs(streamers) do
- streamerloop(streamers[k])
- sleep(5)
- end
- sleep(30)
- m.setCursorPos(1,1)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement