From 9e0464d9a68c5709a7ff503b680f5f7aec4d0473 Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Fri, 29 Nov 2019 22:20:33 -0600 Subject: [PATCH 1/3] refined the specification of custom static text files to ignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 86a1311..574dddf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /bot_config.yaml /.ignore -/static_text/custom/ +/static_text/custom/* From 33cf62044cbe56460ece59549c1291eb09130815 Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Sun, 30 Aug 2020 16:40:04 -0500 Subject: [PATCH 2/3] Added aliases for /status --- commands.rb | 3 ++- run.rb | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/commands.rb b/commands.rb index 2ac7f14..8356db7 100644 --- a/commands.rb +++ b/commands.rb @@ -38,7 +38,8 @@ end def process_command_start(message, command, adm) 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. I also have some pretty sweet dance moves.\n\n" + - "Commands available:\n/start or /help (Shows this message)\n/voice or /chat (Shows voice chat info)\n/srvstart (Currently non-functional)\n/srvstop\n/status\n/whoami or /chatinfo\n/whereareyou or /location\n\n" + + "Commands available:\n/start or /help (Shows this message)\n/voice or /chat (Shows voice chat info)\n/srvstart (Currently non-functional)\n/srvstop\n" + + "/status (show version and online players)\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.\n" + "You can also view the source code at the following location:\nhttps://git.skyfall.tech/skyfall/empyrion-bot" if message_from_admin?(message, adm) diff --git a/run.rb b/run.rb index 87df885..9d973f7 100755 --- a/run.rb +++ b/run.rb @@ -328,8 +328,11 @@ def handle_message(message) when '/srvstop' reply = process_command_srvstop(message, command, adm) send_message(message.chat.id, reply) - when '/status' + when '/status', '/stat', '/stats', '/list', '/check' reply = process_command_srvstatus(message, command, adm) + if command == '/check' + reply = "Hi Matt, here's the /status.\n\n" + reply + end send_message(message.chat.id, reply) when '/patch', '/patchnotes' reply = process_command_patchnotes(message, command, adm) From 75c79750d45c7fb818d59ceb88a6a03f43f6b0a6 Mon Sep 17 00:00:00 2001 From: Aaron Johnon Date: Fri, 21 Jul 2023 22:57:38 -0500 Subject: [PATCH 3/3] Added check to /srvstop to make sure server is up before sending stop command --- commands.rb | 14 ++++++++++++-- static_text/patchnotes.txt | 6 ++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/commands.rb b/commands.rb index 8356db7..f333b97 100644 --- a/commands.rb +++ b/commands.rb @@ -125,8 +125,18 @@ def process_command_srvstop(message, command, adm) return "Refusal: Although I respect your wishes, master, I am not authorized to perform this function for this group." else telnet = @conf['telnet'] - `./scripts/srvstop #{telnet['host']} #{telnet['port']} #{telnet['pass']}` - return "Affirmation: I am shutting down the Empyrion service." + print 'Checking connectivity to Empyrion service... ' + STDOUT.flush + if system("nc -zvw3 #{telnet['host']} #{telnet['port']} >/dev/null 2>&1") + print "OK\n".green.bold + "Sending shutdown message:\n" + STDOUT.flush + reply = "Affirmation: I am shutting down the Empyrion service." + `./scripts/srvstop #{telnet['host']} #{telnet['port']} #{telnet['pass']}` + else + print "Server did not respond!\nSending failure message...\n".red.bold + reply = "Exclamation: Server is not responding!" + end + return reply end end diff --git a/static_text/patchnotes.txt b/static_text/patchnotes.txt index 7717f18..44b1ea9 100644 --- a/static_text/patchnotes.txt +++ b/static_text/patchnotes.txt @@ -1,6 +1,12 @@ SkyfallTech EGS Telebot Patch Notes: +v0.5.01 ++ Added check to /srvstop to see if the server is even running first + * (Previously reported a successful shutdown even if the there was nothing running) ++ Added common aliases for /status command ++ Added an Easter egg command + v0.5.00 + Added Voicechat information feature (/voice). + Rewrite of message handling based on Skyfall Heatbot.