2015-04-14 20:21:23 +02:00
|
|
|
function run_sh(msg)
|
|
|
|
name = get_name(msg)
|
|
|
|
text = ''
|
|
|
|
bash = msg.text:sub(4,-1)
|
|
|
|
text = run_bash(bash)
|
|
|
|
return text
|
|
|
|
end
|
|
|
|
|
|
|
|
function run(msg, matches)
|
|
|
|
local receiver = get_receiver(msg)
|
|
|
|
if string.starts(msg.text, '/sh') then
|
|
|
|
text = run_sh(msg)
|
|
|
|
send_msg(receiver, text, ok_cb, false)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if string.starts(msg.text, '/uptime') then
|
|
|
|
text = run_bash('uptime')
|
|
|
|
send_msg(receiver, text, ok_cb, false)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2015-06-10 14:28:44 +02:00
|
|
|
if string.starts(msg.text, '/temp') then
|
|
|
|
text = run_bash('vcgencmd measure_temp')
|
|
|
|
send_msg(receiver, text, ok_cb, false)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if string.starts(msg.text, '/volt') then
|
|
|
|
text = run_bash('vcgencmd measure_volts')
|
|
|
|
send_msg(receiver, text, ok_cb, false)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if string.starts(msg.text, '/takt') then
|
|
|
|
text = run_bash('vcgencmd measure_clock arm')
|
|
|
|
send_msg(receiver, text, ok_cb, false)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2015-04-14 20:21:23 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
return {
|
|
|
|
description = "Führt Befehle in der Konsole aus",
|
2015-05-12 20:15:15 +02:00
|
|
|
usage = {"/sh kann nur Akamaru"},
|
2015-06-10 14:28:44 +02:00
|
|
|
patterns = {"^/uptime", "^/sh (.*)$","^/temp$","^/volt$","^/takt$"},
|
2015-04-14 20:21:23 +02:00
|
|
|
run = run,
|
|
|
|
privileged = true
|
2015-04-15 18:45:45 +02:00
|
|
|
}
|