Darking560

slack

Nov 1st, 2016
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1. os.loadAPI("slackApi")
  2.  
  3. mon=peripheral.wrap("top")
  4.  
  5. mon.setCursorPos(1,1)
  6. mon.clear()
  7. x,y=mon.getSize()
  8. mon.setCursorPos(1,y)
  9.  
  10. last=""
  11.  
  12. while true do
  13.  
  14.   m,u = slackApi.getLastMessage()
  15.  
  16.   if m~=last then
  17.     name = slackApi.getUserName(u)
  18.     if name==nil then
  19.        name=u
  20.     end
  21.     mon.scroll(1)
  22.     mon.write(name.." : "..m)
  23.     mon.setCursorPos(1,y)
  24.     last=m
  25.   else
  26.     print("Pas de message")
  27.   end
  28.  
  29.   sleep(10)
  30.  
  31. end
Add Comment
Please, Sign In to add comment