SHOW:
|
|
- or go back to the newest paste.
| 1 | - | local mon = peripheral.wrap("right") -- S??lectionez le cot?? de votre ??cran :3
|
| 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("ModFriends")
|
| 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("http://theo33500.tech/toath/twitteroauth/test.php")
|
| 13 | + | local contenu = http.get("https://theo33500.tech/toath/twitteroauth/test.php")
|
| 14 | --Ici changer Bill par le pseudo a surveiller. | |
| 15 | - | local data = contenu.readAll() |
| 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 | - | color = colors.lime |
| 45 | + | |
| 46 | local long = string.len(from) | |
| 47 | local I = 74 - long | |
| 48 | ||
| 49 | --if from = ModFriends_ | |
| 50 | -- color = colors.white | |
| 51 | - | color = colors.cyan |
| 51 | + | |
| 52 | ||
| 53 | if Incr==0 then | |
| 54 | color = colors.orange | |
| 55 | - | color = colors.blue |
| 55 | + | |
| 56 | color = colors.orange | |
| 57 | elseif Incr == 2 then | |
| 58 | color = colors.magenta | |
| 59 | - | color = colors.green |
| 59 | + | |
| 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 | - | print("----------------------------------------------------------------------------------")
|
| 69 | + | |
| 70 | - | print("\n "..text)
|
| 70 | + | |
| 71 | - | write("\n de : " ..from)
|
| 71 | + | |
| 72 | - | while I > 0 do |
| 72 | + | |
| 73 | - | write("-")
|
| 73 | + | color = colors.brown |
| 74 | - | I = I - 1 |
| 74 | + | |
| 75 | - | end |
| 75 | + | |
| 76 | - | print("\n ")
|
| 76 | + | |
| 77 | color = colors.brown | |
| 78 | else | |
| 79 | Incr = 0 | |
| 80 | end | |
| 81 | ||
| 82 | Incr = Incr + 1 | |
| 83 | if at == "theo33500" then | |
| 84 | - | sleep(2) |
| 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 |