Merge branch 'dev' of skyfall/empyrion-bot into master

dev v0.3.03
Aaron Johnson 6 years ago committed by Gitea
commit afddd6c130

1
.gitignore vendored

@ -1,2 +1,3 @@
/bot_config.yaml /bot_config.yaml
/.ignore

@ -73,7 +73,7 @@ def process_command_srvstatus(message, command, adm)
telnet = @conf['telnet'] telnet = @conf['telnet']
print 'Checking connectivity to Empyrion service... ' print 'Checking connectivity to Empyrion service... '
STDOUT.flush 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... " print "Server responded!\nSending message receipt... "
STDOUT.flush STDOUT.flush
if `./scripts/srvstatus.receipt #{@conf['token']} #{message.chat.id}` if `./scripts/srvstatus.receipt #{@conf['token']} #{message.chat.id}`
@ -81,11 +81,12 @@ def process_command_srvstatus(message, command, adm)
else else
print "Receipt FAILED to send (non-zero exit code on scripts/srvstatus.receipt) !!!\nContinuing to fetch details anyway...\n" print "Receipt FAILED to send (non-zero exit code on scripts/srvstatus.receipt) !!!\nContinuing to fetch details anyway...\n"
end end
reply = `./scripts/srvstatus #{telnet['host']} #{telnet['port']} #{telnet['pass']}`
else 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 end
STDOUT.flush STDOUT.flush
reply = `./scripts/srvstatus #{telnet['host']} #{telnet['port']} #{telnet['pass']}`
else else
reply = "Refusal: I am not authorized to provide this information here." reply = "Refusal: I am not authorized to provide this information here."
end end

@ -1,10 +1,16 @@
SkyfallTech EGS Telebot SkyfallTech EGS Telebot
Patch Notes: 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 v0.3.02
+ Better server logs, round 2 + Better server logs, round 2.
+ Less ambiguous patchnotes listing + Less ambiguous patchnotes listing
(These are for the bot, not for Empyrion) --- (These are for the bot, not for Empyrion)
v0.3.01 v0.3.01
+ Better server logs, round 1. + Better server logs, round 1.

@ -100,9 +100,9 @@ def handle_message(message)
case command case command
when '/start' 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 " + 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" + "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 (Probably won't work)\n/srvstop\n/status\n/whoami\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." "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_admin?(message, adm) && ! is_chat_authorized?(message, @auth_chat)
if message.from.id == message.chat.id if message.from.id == message.chat.id
reply = reply + "\n\nWARNING: I am not authorized to work you directly. My functionality is limited." 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) reply = process_command_patchnotes(message, command, adm)
when '/location', '/whereareyou' when '/location', '/whereareyou'
if message_from_admin?(message, adm) || is_chat_authorized?(message, @auth_chat) 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 else
reply = "Refusal: I am not authorized to provide this information here." reply = "Refusal: I am not authorized to provide this information here."
end end
when '/whoami', '/chatinfo' 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 = "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' if command == '/whoami'
reply = "Answer: You are a meatbag named #{message.from.username}\n\n" + reply reply = "Answer: You are a meatbag named #{message.from.username}\n\n" + reply
end end

Loading…
Cancel
Save