|
|
|
@ -226,15 +226,22 @@ end
|
|
|
|
|
def send_message(chatid, message_text, imageurl = nil)
|
|
|
|
|
if imageurl != nil
|
|
|
|
|
#Send message with text as html link to image
|
|
|
|
|
print timestamp + ": Sending ............ "
|
|
|
|
|
STDOUT.flush
|
|
|
|
|
message = Telegram::Bot::Client.run(@token) {|bot| message = bot.api.send_message(chat_id: chatid, text: "#{message_text}<a href=\"#{imageurl}\">.</a>", parse_mode: "HTML") }
|
|
|
|
|
puts timestamp + ": Sent: #{message_text.inspect}\n\n"
|
|
|
|
|
print "OK\n".green.bold
|
|
|
|
|
STDOUT.flush
|
|
|
|
|
puts "Sent: #{message_text.inspect}\n\n"
|
|
|
|
|
STDOUT.flush
|
|
|
|
|
#puts timestamp + ": Sent: #{message_text.inspect}\n\n"
|
|
|
|
|
return message
|
|
|
|
|
else
|
|
|
|
|
#Send a plain-text message
|
|
|
|
|
print timestamp + ": Sending ............ "
|
|
|
|
|
STDOUT.flush
|
|
|
|
|
message = Telegram::Bot::Client.run(@token) {|bot| bot.api.send_message(chat_id: chatid, text: message_text) }
|
|
|
|
|
puts timestamp + ": Sent: #{message_text.inspect}\n\n"
|
|
|
|
|
print "OK\n".green.bold
|
|
|
|
|
puts "Sent: #{message_text.inspect}\n\n"
|
|
|
|
|
STDOUT.flush
|
|
|
|
|
#puts message
|
|
|
|
|
#message = message["results"]
|
|
|
|
@ -246,8 +253,10 @@ end
|
|
|
|
|
def send_gif(chatid, cmd)
|
|
|
|
|
#message = Telegram::Bot::Client.run(@token) {|bot| message = bot.api.send_message(chat_id: chatid, text: "#{message_text}<a href=\"#{imageurl}\">.</a>", parse_mode: "HTML") }
|
|
|
|
|
gif_url = "#{@gif_url_prefix}#{cmd}.gif"
|
|
|
|
|
print timestamp + ": Sending ............ "
|
|
|
|
|
message = Telegram::Bot::Client.run(@token) {|bot| message = bot.api.sendVideo(chat_id: chatid, video: gif_url) }
|
|
|
|
|
puts timestamp + ": Sent GIF: #{gif_url}\n\n"
|
|
|
|
|
print "OK\n".green.bold
|
|
|
|
|
puts "Sent GIF: #{gif_url}\n\n"
|
|
|
|
|
STDOUT.flush
|
|
|
|
|
return message
|
|
|
|
|
end
|
|
|
|
|