theo33500

Untitled

Aug 6th, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local mon = peripheral.wrap("back") -- S??lectionez le cot?? de votre ??cran :3
  2. term.redirect(mon)
  3. os.loadAPI("json")
  4. term.clear()
  5. term.setTextColor(colors.gray)
  6. print("Obtention des tweets en cours... Merci de patienter")
  7. term.setCursorPos(3,1)
  8. Incr = 0
  9. term.setBackgroundColor( colors.black )
  10.  
  11. while true do
  12.  
  13.   local contenu = http.get("https://theo33500.tech/toath/twitteroauth/test.php")
  14.   --Ici changer Bill par le pseudo a surveiller.
  15.  while contenu == nil do
  16.   if Int == nil then
  17.    Int = 0
  18.   end
  19.   term.clear()
  20.   term.setTextColor(colors.gray)
  21.   term.setCursorPos(3,1)
  22.   print("Impossible d'obtenir les tweets.. Nouvelle tentative")
  23.   Int = Int + 1
  24.   sleep(2)
  25.   contenu = http.get("http://theo33500.tech/toath/twitteroauth/test.php")
  26.   if Int == 10 then
  27.   redstone.setOutput("top", true)
  28.   error("Impossible d'obtenir les tweets")
  29.   end
  30.  end
  31.    
  32.     local data = contenu.readAll()
  33.  
  34.   decode = json.decode(data)
  35.   i = 10
  36.   ii = 0
  37.  
  38.     while ii <= 10 do
  39.       if decode.statuses[i] ~= null then
  40.          local text = decode.statuses[i].text
  41.          text = text:gsub("u00e9","e")
  42.          text = text:gsub("u00e0","a")
  43.          text = text:gsub("u00a0"," ")
  44.         local from = decode.statuses[i].user.name
  45.         local at = decode.statuses[i].user.screen_name
  46.         local long = string.len(from)
  47.         local I = 74 - long
  48.  
  49. --if from = ModFriends_
  50. --  color = colors.white
  51. --end
  52.                        
  53.       if Incr==0 then
  54.         color = colors.orange
  55.       elseif Incr == 1 then
  56.         color = colors.orange
  57.       elseif Incr == 2 then
  58.         color = colors.magenta
  59.       elseif Incr == 3 then
  60.         color = colors.yellow
  61.       elseif Incr == 4 then
  62.         color = colors.yellow
  63.       elseif Incr == 5 then
  64.         color = colors.pink
  65.       elseif Incr == 6 then
  66.         color = colors.gray
  67.       elseif Incr == 7 then
  68.         color = colors.pink
  69.        
  70.       elseif Incr == 8 then
  71.         color = colors.purple
  72.       elseif Incr == 9 then
  73.         color = colors.brown
  74.       elseif Incr == 10 then
  75.         color  = colors.brown
  76.       elseif Incr == 11 then
  77.         color = colors.brown
  78.       else
  79.         Incr = 0
  80.       end
  81.  
  82.     Incr = Incr + 1
  83.  
  84.  
  85. if at == "Mod_Friends" then
  86.   color = colors.white
  87. end
  88.  
  89. term.setTextColor(color)
  90.          print("+--------------------------------------------------------------------------------+")
  91.         print("+\n+ "..text)
  92.         write("+\n+ de : " ..from)      
  93.         print("+--------------------------------------------------------------------------------+")
  94.       end
  95.  
  96.     i = i - 1
  97.     ii = ii + 1
  98.     sleep(0.1)
  99.     end
  100.  
  101.     sleep(10)
  102.     term.clear()
  103.     term.setCursorPos(1,1)
  104. end
Advertisement
Add Comment
Please, Sign In to add comment