Guest User

Untitled

a guest
Dec 25th, 2016
81
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. -- Damit der "gelesen hacken" erscheint...
  3. if msg.text then
  4. mark_read (msg.from.print_name, ok_cb, false)
  5. end
  6.  
  7. -- ggf. nur eine Rufnummer zulassen...
  8. if msg.from.print_name ~= 'Steffen_Simmert' then
  9. os.execute("/home/pi/tg/send_script ".. msg.from.print_name .." 'Ungueltige Berechtigung...'")
  10. return
  11. end
  12. if (string.lower(msg.text) == 'uptime') then
  13. local handle = io.popen("sudo python /home/pi/tg/tg_steuerung.py uptime")
  14. local res = handle:read("*a")
  15. handle:close()
  16. os.execute("/home/pi/tg/send_script ".. msg.from.print_name .." '"..res.."' ")
  17. --Alternativ:
  18. --send_msg (msg.from.print_name, res)
  19. return
  20. elseif (string.lower(msg.text) == 'shutdown') then
  21. local handle = io.popen("sudo python /home/pi/tg/tg_steuerung.py shutdown")
  22. local res = handle:read("*a")
  23. os.execute("/home/pi/tg/send_script "..msg.from.print_name.." '"..res.."' ")
  24. handle:close()
  25. return
  26. elseif (string.lower(msg.text) == 'reboot') then
  27. local handle = io.popen("sudo python /home/pi/tg/tg_steuerung.py reboot")
  28. local res = handle:read("*a")
  29. handle:close()
  30. os.execute("/home/pi/tg/send_script ".. msg.from.print_name .." '"..res.."' ")
  31. return
  32. else
  33. os.execute("/home/pi/tg/send_script ".. msg.from.print_name .." 'Fehler' ")
  34. end
  35. end
  36.  
  37. do_notify (get_title (msg.from, msg.to), msg.text)
  38.  
  39.  
  40. if (msg.text == 'ping') then
  41. if (msg.to.id == our_id) then
  42. send_msg (msg.from.print_name, 'pong', ok_cb, false)
  43. else
  44. send_msg (msg.to.print_name, 'pong', ok_cb, false)
  45. end
  46. return
  47. end
  48. if (msg.text == 'PING') then
  49. if (msg.to.id == our_id) then
  50. fwd_msg (msg.from.print_name, msg.id, ok_cb, false)
  51. else
  52. fwd_msg (msg.to.print_name, msg.id, ok_cb, false)
  53. end
  54. return
  55. end
  56. 134 —> end
RAW Paste Data