|
|
|
@ -95,19 +95,11 @@ def handle_message(message)
|
|
|
|
|
reply = reply + "\n\nWARNING: Although you are my master, I have not been authorized to participate in this group. My functionality is limited."
|
|
|
|
|
end
|
|
|
|
|
when '/srvstart'
|
|
|
|
|
if message_from_admin?(message, adm) || is_chat_authorized?(message, @auth_chat)
|
|
|
|
|
reply = process_command_srvstart(message, command, adm)
|
|
|
|
|
else
|
|
|
|
|
reply = "Refusal: I am not authorized to perform this operation here."
|
|
|
|
|
end
|
|
|
|
|
reply = process_command_srvstart(message, command, adm)
|
|
|
|
|
when '/srvstop'
|
|
|
|
|
if message_from_admin?(message, adm) || is_chat_authorized?(message, @auth_chat)
|
|
|
|
|
reply = process_command_srvstop(message, command, adm)
|
|
|
|
|
else
|
|
|
|
|
reply = "Refusal: I am not authorized to perform this operation here."
|
|
|
|
|
end
|
|
|
|
|
reply = process_command_srvstop(message, command, adm)
|
|
|
|
|
when '/status'
|
|
|
|
|
if message_from_admin?(message, adm) || is_chat_authorized?(message, @auth_chat)
|
|
|
|
|
if is_chat_authorized?(message, @auth_chat) || message_from_admin?(message, adm)
|
|
|
|
|
reply = `./scripts/srvstatus #{telnet['host']} #{telnet['port']} #{telnet['pass']}`
|
|
|
|
|
else
|
|
|
|
|
reply = "Refusal: I am not authorized to provide this information here."
|
|
|
|
@ -127,6 +119,12 @@ def handle_message(message)
|
|
|
|
|
when '/pp', '/debug'
|
|
|
|
|
pp message
|
|
|
|
|
reply = "Confirmation: Message debug information sent to console."
|
|
|
|
|
when '/dance'
|
|
|
|
|
if is_chat_authorized?(message, @auth_chat) || message_from_admin?(message, adm)
|
|
|
|
|
reply = "dance"
|
|
|
|
|
else
|
|
|
|
|
reply = "Refusal: I am not authorized to bust a move in this location."
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
reply = "Mockery: My name is #{message.from.username}, I am a meatbag, and I think #{command} is a valid command."
|
|
|
|
|
end
|
|
|
|
@ -138,7 +136,11 @@ end
|
|
|
|
|
Telegram::Bot::Client.run(token) do |bot|
|
|
|
|
|
bot.listen do |message|
|
|
|
|
|
reply = handle_message(message)
|
|
|
|
|
bot.api.send_message(chat_id: message.chat.id, text: "#{reply}")
|
|
|
|
|
if reply == "dance"
|
|
|
|
|
bot.api.sendVideo(chat_id: message.chat.id, video: 'https://img.skyfalltech.net/togra/dance.gif')
|
|
|
|
|
else
|
|
|
|
|
bot.api.send_message(chat_id: message.chat.id, text: "#{reply}")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|