|
|
|
@ -13,6 +13,7 @@ token = @conf['token']
|
|
|
|
|
telnet = @conf['telnet']
|
|
|
|
|
admin = @conf['admin']
|
|
|
|
|
@auth_chat = @conf['authorized_chats']
|
|
|
|
|
@allowed_sources = @conf['allowed_sources']
|
|
|
|
|
|
|
|
|
|
# Sanity check
|
|
|
|
|
errcount = 0
|
|
|
|
@ -72,12 +73,12 @@ def handle_message(message)
|
|
|
|
|
|
|
|
|
|
#Format command
|
|
|
|
|
command = message.text.split(" ")[0].split("@")[0].downcase #Strip command from arguments and @tags
|
|
|
|
|
#command = message.text
|
|
|
|
|
|
|
|
|
|
reply = 'Empty String'
|
|
|
|
|
#conf = YAML.load_file("bot_config.yaml")
|
|
|
|
|
telnet = @conf['telnet']
|
|
|
|
|
adm = @conf['admin']
|
|
|
|
|
#case message.text.split(" ")[0].split("@")[0].downcase #Strip command from arguments and @tags
|
|
|
|
|
puts "Received command from #{message.from.username}: #{command}"
|
|
|
|
|
case command
|
|
|
|
|
when '/start'
|
|
|
|
@ -142,12 +143,20 @@ end
|
|
|
|
|
|
|
|
|
|
Telegram::Bot::Client.run(token) do |bot|
|
|
|
|
|
bot.listen do |message|
|
|
|
|
|
#pp message
|
|
|
|
|
validation = validate_incoming_data(message)
|
|
|
|
|
#puts "DEBUG: #{validation}"
|
|
|
|
|
if validation
|
|
|
|
|
reply = handle_message(message)
|
|
|
|
|
if reply == "dance" || reply == "flex"
|
|
|
|
|
bot.api.sendVideo(chat_id: message.chat.id, video: "https://img.skyfalltech.net/togra/#{reply}.gif")
|
|
|
|
|
else
|
|
|
|
|
bot.api.send_message(chat_id: message.chat.id, text: "#{reply}")
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
puts "Received bad data! [#{message.chat.type}]"
|
|
|
|
|
puts validation
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|