theo33500

Ecran Mod_Friends

Sep 25th, 2016
44
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. if at == "theo33500" then
  84.   color = colors.blue
  85. end
  86.  
  87. if at == "NLC_FR" then
  88.   color = colors.green
  89. end
  90.  
  91. if at == "leonekmi" then
  92.   color = colors.green
  93. end
  94.  
  95. if at == "HugoKreitz" then
  96.   color = colors.blue
  97. end
  98.  
  99. if at == "_Elosanne_" then
  100.   color = colors.blue
  101. end
  102.  
  103. if at == "Luclu7Gaming" then
  104.   color = colors.green
  105. end
  106.  
  107. if at == "ajen003" then
  108.   color = colors.green
  109. end
  110.  
  111. if at == "Mod_Friends" then
  112.   color = colors.white
  113. end
  114.  
  115. term.setTextColor(color)
  116.          print("+--------------------------------------------------------------------------------+")
  117.         print("+\n+ "..text)
  118.         write("+\n+ de : " ..from)      
  119.         print("+--------------------------------------------------------------------------------+")
  120.       end
  121.  
  122.     i = i - 1
  123.     ii = ii + 1
  124.     sleep(0.1)
  125.     end
  126.  
  127.     sleep(10)
  128.     term.clear()
  129.     term.setCursorPos(1,1)
  130. end
Add Comment
Please, Sign In to add comment