Advertisement
mja00

Untitled

Oct 7th, 2016
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -----CONFIG-----
  2. streamer = "camoduck" --This variable is REQUIRED!
  3. --streamer2 = "mja00" --Uncomment this line to add a second streamer! Requires a 2 high monitor!
  4. -----CONFIG-----
  5. -----MAIN CODE! DO NOT EDIT!-----
  6. --Checking for my twitch api
  7. if fs.exists("beamapi") == false then
  8.   shell.run("pastebin get wbPC0Zv7 beamapi")
  9. end
  10. if not fs.exists('json') then
  11.     write("JSON API not found - Downloading")
  12.     shell.run("pastebin get 4nRg9CHU json")
  13. end
  14. --Loading my twitch api
  15. os.loadAPI("beamapi")
  16. --Is there a monitor?
  17. if peripheral.find("monitor") then
  18.   mon = peripheral.find("monitor")
  19.   monitor = true
  20. end
  21. --Is there a second streamer specified? If so, is the monitor large enough to support it?
  22. if streamer2 then
  23.   if monitor then
  24.     x, y = mon.getSize()
  25.     if y > 5 then
  26.       --Good to go!
  27.     else
  28.       error("You need a two tall monitor to allow two streamers!")
  29.     end
  30.   end
  31. end
  32. --Main loop. Does all the visible stuff!
  33. while true do
  34.   if monitor then --Do we have a monitor?
  35.     if beamapi.checkLive(streamer) then --Is the main streamer live?
  36.       mon.clear()
  37.       mon.setCursorPos(1,1)
  38.       mon.write("LATEST FOLLOWER: "..beamapi.lastFollower(streamer))
  39.       mon.setCursorPos(1,2)
  40.       mon.write("FOLLOWER COUNT: "..beamapi.followerCount(streamer))
  41.       mon.setCursorPos(1,3)
  42.       mon.write("LIVE VIEWERS: "..beamapi.viewerCount(streamer))
  43.     else --The main streamer isn't live.
  44.       mon.clear()
  45.       mon.setCursorPos(1,1)
  46.       mon.write(streamer.." is not live!")
  47.       mon.setCursorPos(1,2)
  48.       mon.write("Written by mja00 for his streamer friends in the Minecraft Twitch Community!")
  49.       mon.setCursorPos(1,3)
  50.       mon.write("-----------------")
  51.     end
  52.     if streamer2 then --Is the secondary streamer specified?
  53.       mon.setCursorPos(1,5)
  54.       mon.write("-----------------")
  55.       if twitchapi.checkLive(streamer2) then --Is the secondary streamer live?
  56.         term.setCursorPos(1,6)
  57.         term.write("LATEST FOLLOWER: "..beamapi.lastFollower(streamer2))
  58.         term.setCursorPos(1,7)
  59.         term.write("FOLLOWER COUNT: "..beamapi.followerCount(streamer2))
  60.         term.setCursorPos(1,8)
  61.         term.write("LIVE VIEWERS: "..beamapi.viewerCount(streamer2))
  62.       else --The secondary streamer isn't live.
  63.             if twitchapi.checkLive(streamer) then
  64.           term.setCursorPos(1,6)
  65.           term.write(streamer2.." is not live!")
  66.         else
  67.           term.setCursorPos(1,4)
  68.           term.write(streamer2.." is not live!")
  69.         end
  70.       end --For some reason all this code got derped up when I put it on pastebin... just looks messy. Still works!
  71.     else
  72.     mon.setCursorPos(1,5)
  73.     mon.write("Written by mja00 for his streamer friends in the Minecraft Twitch community!")
  74.   end
  75.   end
  76.   if monitor == null then --There isn't a monitor!
  77.     if twitchapi.checkLive(streamer) then --Is the main streamer live?
  78.       shell.run("clear")
  79.           print("LATEST FOLLOWER: "..beamapi.lastFollower(streamer))
  80.       print("FOLLOWER COUNT: "..beamapi.followerCount(streamer))
  81.       print("LIVE VIEWERS: "..beamapi.viewerCount(streamer))
  82.     else
  83.       shell.run("clear")
  84.       print(streamer.." is not live!")
  85.       print("Written by mja00 for his streamer friends in the Minecraft Twitch community!")
  86.     end
  87.     if streamer2 then --Is the secondary streamer specified?
  88.       print("-----------------")
  89.       if twitchapi.checkLive(streamer2) then --Is the secondary streamer live?
  90.         print("LATEST FOLLOWER: "..beampi.lastFollower(streamer2))
  91.             print("FOLLOWER COUNT: "..beamapi.followerCount(streamer2))
  92.         print("LIVE VIEWERS: "..beamapi.viewerCount(streamer2))
  93.       else --Thye secondary streamer isn't live... :(
  94.         print(streamer2.." is not live!")
  95.       end
  96.     else --There is no secondary streamer specified!
  97.       print("Written by mja00 for his streamer friends in the Minecraft Twitch community!")
  98.     end
  99.   end
  100.   sleep(5)
  101. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement