From e366377175cddc22ec754d1c2d76eaf096adbc8d Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Thu, 27 Dec 2018 22:06:35 -0600 Subject: [PATCH] moved status to commands.rb --- commands.rb | 10 ++++++++++ run.rb | 12 ++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/commands.rb b/commands.rb index 918a9cc..ee7dfaf 100644 --- a/commands.rb +++ b/commands.rb @@ -59,3 +59,13 @@ def process_command_srvstop(message, command, adm) end end +def process_command_srvstatus(message, command, adm) + if is_chat_authorized?(message, @auth_chat) || message_from_admin?(message, adm) + telnet = @conf['telnet'] + reply = `./scripts/srvstatus #{telnet['host']} #{telnet['port']} #{telnet['pass']}` + else + reply = "Refusal: I am not authorized to provide this information here." + end + return reply +end + diff --git a/run.rb b/run.rb index 99a2ee7..a43ed15 100755 --- a/run.rb +++ b/run.rb @@ -99,12 +99,12 @@ def handle_message(message) when '/srvstop' reply = process_command_srvstop(message, command, adm) when '/status' - #reply = process_command_srvstatus(message, command, adm) - if is_chat_authorized?(message, @auth_chat) || message_from_admin?(message, adm) - reply = `./scripts/srvstatus #{telnet['host']} #{telnet['port']} #{telnet['pass']}` - else - reply = "Refusal: I am not authorized to provide this information here." - end + reply = process_command_srvstatus(message, command, adm) + #if is_chat_authorized?(message, @auth_chat) || message_from_admin?(message, adm) + # reply = `./scripts/srvstatus #{telnet['host']} #{telnet['port']} #{telnet['pass']}` + #else + # reply = "Refusal: I am not authorized to provide this information here." + #end when '/location', '/whereareyou' if message_from_admin?(message, adm) || is_chat_authorized?(message, @auth_chat) reply = "I am currently located at:\n\nHost: #{`echo $HOSTNAME`}ExtIP: #{`curl myip.contegix.com 2>/dev/null`}"