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

Loading…
Cancel
Save