From d2206651be9ec2fd45c21c0785646a5916c54296 Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Wed, 24 Apr 2019 01:26:46 -0500 Subject: [PATCH 1/8] Updated /start output --- run.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run.rb b/run.rb index 9538d6b..91c7401 100755 --- a/run.rb +++ b/run.rb @@ -101,8 +101,8 @@ def handle_message(message) 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." + "Commands available:\n/start (Shows this message)\n/srvstart (Currently non-functional)\n/srvstop\n/status\n/whoami\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." From 61f587a85e0f0eba9cf3bd37f2708f3641b3cdb6 Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Tue, 30 Apr 2019 23:24:14 -0500 Subject: [PATCH 2/8] Added .ignore directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4129f9d..e85ebed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /bot_config.yaml +/.ignore From 658c3df8195920646994c5fd6886ef91bf78a8d7 Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Tue, 30 Apr 2019 23:54:06 -0500 Subject: [PATCH 3/8] Fixed 'server is up oops nevermind' condition --- commands.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 From d9d231eab87949807abeff57153cc8e1dc72752d Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Tue, 30 Apr 2019 23:58:40 -0500 Subject: [PATCH 4/8] Fixed broken Contegix myip information --- run.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.rb b/run.rb index 91c7401..a10d298 100755 --- a/run.rb +++ b/run.rb @@ -127,7 +127,7 @@ 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 From 12fdbf70e3c7da40a1980e81bc790c4e97108848 Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Wed, 1 May 2019 00:22:19 -0500 Subject: [PATCH 5/8] updated /start message --- run.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run.rb b/run.rb index a10d298..b4a8092 100755 --- a/run.rb +++ b/run.rb @@ -100,8 +100,8 @@ 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 (Currently non-functional)\n/srvstop\n/status\n/whoami\n\n" + + "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 From 8346216498a2b6690865490e76f46e821cfd0e8e Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Wed, 1 May 2019 00:29:15 -0500 Subject: [PATCH 6/8] Removed extra space in output --- run.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.rb b/run.rb index b4a8092..8148660 100755 --- a/run.rb +++ b/run.rb @@ -133,7 +133,7 @@ def handle_message(message) 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 From a014f6b26d17b6b121aeb7b6d6947eca416fcf59 Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Wed, 1 May 2019 00:39:48 -0500 Subject: [PATCH 7/8] Updated patchnotes.txt --- patchnotes.txt | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/patchnotes.txt b/patchnotes.txt index 50e56a8..87aba73 100644 --- a/patchnotes.txt +++ b/patchnotes.txt @@ -1,16 +1,22 @@ 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 -+ Less ambiguous patchnotes listing - (These are for the bot, not for Empyrion) +├ Better server logs, round 2. +└ Less ambiguous patchnotes listing + └── (These are for the bot, not for Empyrion) v0.3.01 -+ Better server logs, round 1. +└ Better server logs, round 1. v0.3.00 -+ Auto self-resurrection after random bot-suicide. -+ This `/patchnotes` command. -+ Instant message confirmation for `/status` command. +├ Auto self-resurrection after random bot-suicide. +├ This `/patchnotes` command. +└ Instant message confirmation for `/status` command. From 568e3babd07d15f792449a34cf91468cb59bd5be Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Wed, 1 May 2019 00:44:24 -0500 Subject: [PATCH 8/8] Fixed patchnotes crashing on some servers (non-ASCII characters) --- patchnotes.txt | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/patchnotes.txt b/patchnotes.txt index 87aba73..3ad3896 100644 --- a/patchnotes.txt +++ b/patchnotes.txt @@ -2,21 +2,21 @@ 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) ++ 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. -└ Less ambiguous patchnotes listing - └── (These are for the bot, not for Empyrion) ++ Better server logs, round 2. ++ Less ambiguous patchnotes listing +--- (These are for the bot, not for Empyrion) v0.3.01 -└ Better server logs, round 1. ++ Better server logs, round 1. v0.3.00 -├ Auto self-resurrection after random bot-suicide. -├ This `/patchnotes` command. -└ Instant message confirmation for `/status` command. ++ Auto self-resurrection after random bot-suicide. ++ This `/patchnotes` command. ++ Instant message confirmation for `/status` command.