telegram-bot-ruby
telegram-bot-ruby copied to clipboard
Send file through url instead of upload
Hi there,
In my part of learn Ruby, JSON, and Telegram Bots I want to make a Pokedext, and here is what i need to send file through the url i get from the API instead of upload from the server:
bot.api.send_photo(chat_id: message.chat.id, photo: Faraday::UploadIO.new('~/Desktop/jennifer.jpg', 'image/jpeg'))
What do I need to change in order to use a url ?
Can you send url as plain text, i.e. using send_message
method?
I could do that, but how ever its more cool if just send the image :(
I am not sure but try to do this
require 'open-uri'
bot.api.send_photo(chat_id: message.chat.id, photo: open(image_url))
not working :( But thanks for trying.
@JorgeDDW try bot.api.send_message(chat_id: message.from.id, text: "<a href=\"http://fonday.ru/images/tmp/16/7/original/16710fBjLzqnJlMXhoFHAG.jpg\">Cats</a>", parse_mode: "HTML" )
, telegram client`d render image by itself
If your url is http you can post an image just like this:
telegram.api.send_photo(chat_id: <chat_id>, caption: <text>, photo: <http url>)
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.