diff --git a/.gitignore b/.gitignore index 4129f9d..e85ebed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /bot_config.yaml +/.ignore diff --git a/commands.rb b/commands.rb index f5b71b1..a2f54a9 100644 --- a/commands.rb +++ b/commands.rb @@ -73,7 +73,7 @@ def process_command_srvstatus(message, command, adm) telnet = @conf['telnet'] print 'Checking connectivity to Empyrion service... ' STDOUT.flush - if `nc -zvw3 #{telnet['host']} #{telnet['port']} >/dev/null 2>&1` + if system("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}` @@ -81,11 +81,12 @@ def process_command_srvstatus(message, command, adm) else print "Receipt FAILED to send (non-zero exit code on scripts/srvstatus.receipt) !!!\nContinuing to fetch details anyway...\n" end + reply = `./scripts/srvstatus #{telnet['host']} #{telnet['port']} #{telnet['pass']}` else - print "Server did not respond! Passing to scripts/srvstatus for sending the failure message (revisit this for code efficiency review\n)" + print "Server did not respond!\nSending failure message...\n" + reply = "Server is not responding!" end STDOUT.flush - reply = `./scripts/srvstatus #{telnet['host']} #{telnet['port']} #{telnet['pass']}` else reply = "Refusal: I am not authorized to provide this information here." end diff --git a/patchnotes.txt b/patchnotes.txt index 50e56a8..3ad3896 100644 --- a/patchnotes.txt +++ b/patchnotes.txt @@ -1,10 +1,16 @@ SkyfallTech EGS Telebot Patch Notes: +v0.3.03 ++ Fixed 'server is up oops nevermind' condition in /status. ++ Fixed /whoami output formatting. ++ Fixed /whereareyou command. +--- (previously relied on a now-broken Contegix service) + v0.3.02 -+ Better server logs, round 2 ++ Better server logs, round 2. + Less ambiguous patchnotes listing - (These are for the bot, not for Empyrion) +--- (These are for the bot, not for Empyrion) v0.3.01 + Better server logs, round 1. diff --git a/run.rb b/run.rb index 9538d6b..8148660 100755 --- a/run.rb +++ b/run.rb @@ -100,9 +100,9 @@ def handle_message(message) case command when '/start' reply = "Introduction: I am #{@botname}, and I am here to make life easier for meatbag admins like you. Currently I can retrieve information " + - "from an Empyrion server as well as kill the server process.\n\n" + - "Commands available:\n/start (Shows this message)\n/srvstart (Probably won't work)\n/srvstop\n/status\n/whoami\n\n" + - "Check again later to see if any new functions have been added." + "from an Empyrion server as well as kill the server process. I also have some pretty sweet dance moves.\n\n" + + "Commands available:\n/start (Shows this message)\n/srvstart (Currently non-functional)\n/srvstop\n/status\n/whoami or /chatinfo\n/whereareyou or /location\n\n" + + "Check again later to see if any new functions have been added, or use /patchnotes to learn about recent updates." if ! message_from_admin?(message, adm) && ! is_chat_authorized?(message, @auth_chat) if message.from.id == message.chat.id reply = reply + "\n\nWARNING: I am not authorized to work you directly. My functionality is limited." @@ -127,13 +127,13 @@ def handle_message(message) reply = process_command_patchnotes(message, command, adm) when '/location', '/whereareyou' if message_from_admin?(message, adm) || is_chat_authorized?(message, @auth_chat) - reply = "I am currently located at:\n\nHost: #{`head -n1 /etc/hostname`}ExtIP: #{`curl myip.contegix.com 2>/dev/null`}" + reply = "I am currently located at:\n\nHost: #{`head -n1 /etc/hostname`}ExtIP: #{`curl icanhazip.com 2>/dev/null`}" else reply = "Refusal: I am not authorized to provide this information here." end when '/whoami', '/chatinfo' #reply = "Answer: You are a meatbag named #{message.from.username}\n\nUser ID: #{message.from.id}\n\nChat ID: #{message.chat.id}" - reply = "User ID: #{message.from.id}\nChat ID: #{message.chat.id}" + reply = "User ID: #{message.from.id}\nChat ID: #{message.chat.id}" if command == '/whoami' reply = "Answer: You are a meatbag named #{message.from.username}\n\n" + reply end