Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function on_msg_receive (msg)
- if started == 0 then
- return
- end
- if msg.out then
- return
- end
- --Damit der "Gelesen Haken" erscheint
- if msg.text then
- mark_read (msg.from.print_name, ok_cb, false)
- end
- --Ggf. nur eine Rufnummer zulassen:
- if msg.from.print_name ~= 'Fillip_iPhone' then
- os.execute("/home/pi/tg/send_script ".. msg.from.print_name .." 'Ungültige Nr.'")
- return
- end
- if (string.lower(msg.text) == 'uptime') then
- local handle = io.popen("sudo python /home/pi/tg/tg_actions.py uptime")
- local res = handle:read("*a")
- handle:close()
- os.execute("/home/pi/tg/send_script ".. msg.from.print_name .." '"..res.."' ")
- --Alternativ:
- --send_msg (msg.from.print_name, res)
- return
- elseif (string.lower(msg.text) == 'Standheizung') then
- local handle = io.popen("sudo python /home/pi/tg/tg_actions.py Standheizung")
- local res = handle:read("*a")
- os.execute("/home/pi/tg/send_script "..msg.from.print_name.." '"..res.."' ")
- handle:close()
- return
- elseif (string.lower(msg.text) == 'reboot') then
- local handle = io.popen("sudo python /home/pi/tg/tg_actions.py reboot")
- local res = handle:read("*a")
- handle:close()
- os.execute("/home/pi/tg/send_script ".. msg.from.print_name .." '"..res.."' ")
- return
- else
- os.execute("/home/pi/tg/send_script ".. msg.from.print_name .." 'Fehler' ")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement