Added full report function

pull/2/head
Aaron Johnson 6 years ago
parent 6ec2ecb4d3
commit 07b7f46dd7

@ -104,6 +104,23 @@ def process_command_check(message, command, adm)
end end
end end
def process_command_report(message, command, adm)
if is_chat_authorized?(message, @auth_chat) || message_from_admin?(message, adm)
report = "Full Report:\n\n"
@probes.each do |k,v|
zone = v["loc"].to_s
host = k
print "#{host}: #{zone} "
tdata = `ssh #{host} heatbot_gettemp`
print "[#{tdata}°#{@tunit}]\n"
report = report + "#{zone}: #{tdata}°#{@tunit}\n"
end
send_message(message.chat.id,report)
else
send_message(message.chat.id,"I am not authorized to provide this information here.")
end
end
def process_command_test(message, command, adm) def process_command_test(message, command, adm)
if is_chat_authorized?(message, @auth_chat) || message_from_admin?(message, adm) if is_chat_authorized?(message, @auth_chat) || message_from_admin?(message, adm)
#reply = `scripts/tempf.py` #reply = `scripts/tempf.py`

@ -261,6 +261,8 @@ def handle_message(message)
process_command_chatinfo(message) process_command_chatinfo(message)
when '/check', '/c' when '/check', '/c'
process_command_check(message, command, adm) process_command_check(message, command, adm)
when '/report', '/r'
process_command_report(message, command, adm)
when '/test' when '/test'
process_command_test(message, command, adm) process_command_test(message, command, adm)
when '/pp', '/debug' when '/pp', '/debug'

Loading…
Cancel
Save