Fixed case where message fails to send, but log suggests otherwise

pull/14/head
Aaron Johnson 6 years ago
parent ac47bcf4f3
commit 049d7041f2

@ -230,8 +230,6 @@ def handle_message(message)
else else
reply = "Mockery: My name is #{message.from.username}, I am a meatbag, and I think #{command} is a valid command." reply = "Mockery: My name is #{message.from.username}, I am a meatbag, and I think #{command} is a valid command."
end end
# Verbose output:
puts timestamp + ": Sending #{reply.inspect}\n\n"
STDOUT.flush STDOUT.flush
#puts "End of case" #puts "End of case"
return reply return reply
@ -244,10 +242,18 @@ Telegram::Bot::Client.run(token) do |bot|
#puts "DEBUG: #{validation}" #puts "DEBUG: #{validation}"
if validation if validation
reply = handle_message(message) reply = handle_message(message)
if reply == "dance" || reply == "flex" print timestamp + ": Sending ............ "
bot.api.sendVideo(chat_id: message.chat.id, video: "https://img.skyfalltech.net/togra/#{reply}.gif") if ! message.text.nil?
elsif ! message.text.nil? if reply == "dance" || reply == "flex"
bot.api.send_message(chat_id: message.chat.id, text: "#{reply}") 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}")
print "OK\n".green.bold
puts "Sent: #{reply.inspect}\n\n"
end
else
print 'FAIL'.red.bold
print " (Message is NULL)\n\n"
end end
STDOUT.flush STDOUT.flush
else else

Loading…
Cancel
Save