|
|
|
@ -71,11 +71,20 @@ end
|
|
|
|
|
def process_command_srvstatus(message, command, adm)
|
|
|
|
|
if is_chat_authorized?(message, @auth_chat) || message_from_admin?(message, adm)
|
|
|
|
|
telnet = @conf['telnet']
|
|
|
|
|
if `nc -zvw3 #{telnet['host']} #{telnet['port']}`
|
|
|
|
|
puts 'Server responded. Fetching details...'
|
|
|
|
|
`./scripts/srvstatus.receipt #{@conf['token']} #{message.chat.id}`
|
|
|
|
|
print 'Checking connectivity to Empyrion service... '
|
|
|
|
|
STDOUT.flush
|
|
|
|
|
if `nc -zvw3 #{telnet['host']} #{telnet['port']} >/dev/null 2>&1`
|
|
|
|
|
print "Server responded!\nSending message receipt... "
|
|
|
|
|
STDOUT.flush
|
|
|
|
|
if `./scripts/srvstatus.receipt #{@conf['token']} #{message.chat.id}`
|
|
|
|
|
print "Receipt sent!\nFetching details...\n"
|
|
|
|
|
else
|
|
|
|
|
print "Receipt FAILED to send (non-zero exit code on scripts/srvstatus.receipt) !!!\nContinuing to fetch details anyway...\n"
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
print "Server did not respond! Passing to scripts/srvstatus for sending the failure message (revisit this for code efficiency review\n)"
|
|
|
|
|
end
|
|
|
|
|
STDOUT.flush
|
|
|
|
|
reply = `./scripts/srvstatus #{telnet['host']} #{telnet['port']} #{telnet['pass']}`
|
|
|
|
|
else
|
|
|
|
|
reply = "Refusal: I am not authorized to provide this information here."
|
|
|
|
|