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

dev
Aaron Johnson 6 years ago committed by Gitea
commit e0ccdeed43

@ -71,6 +71,9 @@ end
def process_command_srvstatus(message, command, adm) def process_command_srvstatus(message, command, adm)
if is_chat_authorized?(message, @auth_chat) || message_from_admin?(message, adm) if is_chat_authorized?(message, @auth_chat) || message_from_admin?(message, adm)
telnet = @conf['telnet'] telnet = @conf['telnet']
if `nc -zvw3 #{telnet['host']} #{telnet['port']}`
`./scripts/srvstatus.receipt #{@conf['token']} #{message.chat.id}`
end
reply = `./scripts/srvstatus #{telnet['host']} #{telnet['port']} #{telnet['pass']}` 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."
@ -78,3 +81,13 @@ def process_command_srvstatus(message, command, adm)
return reply return reply
end end
def process_command_patchnotes(message, command, adm)
if is_chat_authorized?(message, @auth_chat) || message_from_admin?(message, adm)
telnet = @conf['telnet']
reply = `cat patchnotes.txt`
else
reply = "Refusal: I am not authorized to provide this information here."
end
return reply
end

@ -0,0 +1,17 @@
[Unit]
Description=Empyrion Chat Bot by SKYFALL
After=network.target
[Service]
User=ivo
WorkingDirectory=/opt/skyfall/egs-bot
StandardOutput=file:/var/log/skyfall/egs-bot/run.log
StandardError=file:/var/log/skyfall/egs-bot/error.log
PIDFile=/var/run/skyfall/egsbot.pid
ExecStart=/usr/bin/ruby /opt/skyfall/egs-bot/run.rb
SuccessExitStatus=SIGKILL
Restart=on-failure
[Install]
WantedBy=multi-user.target

@ -0,0 +1,5 @@
New features:
+ Auto self-resurrection after random bot-suicide.
+ This `/patchnotes` command.
+ Instant message confirmation for `/status` command.

@ -123,6 +123,8 @@ def handle_message(message)
#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 '/patch', '/patchnotes'
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 myip.contegix.com 2>/dev/null`}"
@ -144,7 +146,7 @@ def handle_message(message)
else else
reply = "Refusal: I am not authorized to bust a move in this location." reply = "Refusal: I am not authorized to bust a move in this location."
end end
when '/flex' when '/flex', '/unclemike'
if is_chat_authorized?(message, @auth_chat) || message_from_admin?(message, adm) if is_chat_authorized?(message, @auth_chat) || message_from_admin?(message, adm)
reply = "flex" reply = "flex"
else else

@ -0,0 +1,13 @@
#!/usr/bin/env sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
KEY=$1
CHATID=$2
TIME="4"
URL="https://api.telegram.org/bot$KEY/sendMessage"
MESSAGE="Confirmation: The server appears online!
One moment while I collect some server information..."
curl -s --max-time $TIME -d "chat_id=${CHATID}&disable_web_page_preview=1&text=${MESSAGE}" $URL >/dev/null
Loading…
Cancel
Save