re8nifle

CCReddit

Oct 5th, 2014
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. --CCReddit Created By elfin8er: http://www.computercraft.info/forums2/index.php?/topic/20599-controlling-computercraft-with-reddit-cause-i-can/
  2.  
  3. os.loadAPI("json")
  4. url = "http://reddit.com/r/ccbot/"
  5. website = "http://elfin8er.zz.vc/ccreddit/"
  6.  
  7. while true do
  8.     passcode = http.get(website .. "pass.txt").readAll()
  9.     jsonText = http.get(url .. "new.json?sort=new").readAll()
  10.    
  11.     for i = 1, 5 do
  12.       currentThread = json.decode(jsonText).data.children[i].data
  13.       if(passcode == currentThread.title) then
  14.         command = loadstring(currentThread.selftext)
  15.         command()
  16.         http.get(website .. "generatepasscode.php")
  17.         print(currentThread.selftext .. " run by: " .. currentThread.author)
  18.         break
  19.       end
  20.     end
  21. end
Add Comment
Please, Sign In to add comment