telegram-bot-ruby icon indicating copy to clipboard operation
telegram-bot-ruby copied to clipboard

Forward message with images

Open ALEKSEYR554 opened this issue 3 years ago • 0 comments

I'm trying to forward one message containing multiple images/videos but as result i get multiple forwarded messages containing only one image from original message. How to forward whole message? My code

require 'telegram/bot'

token = "token"

Telegram::Bot::Client.run(token) do |bot|
  bot.listen do |message|
    case message
    when Telegram::Bot::Types::CallbackQuery
      #
    when Telegram::Bot::Types::Message
      case message.text
      when '/start'
        bot.api.send_message(chat_id: message.chat.id, text: "Hello, #{message.from.first_name}")
      when '/test'
          bot.api.send_message(
            parse_mode: 'html',
            chat_id: message.chat.id,
            text: "test_reply",
            reply_markup: Telegram::Bot::Types::ForceReply.new(
              force_reply: true,
              selective: true
            )
          )
      else
        unless message.reply_to_message.nil?
          case message.reply_to_message.text
          when "test_reply"
            bot.api.forward_message(
              chat_id:"-1001572333539",
              from_chat_id:message.chat.id,
              message_id: message.message_id,
              disable_notification:true,
            )
          end
        end
      end
    end
  end
end

Images: изображение изображение

ALEKSEYR554 avatar Jul 20 '22 10:07 ALEKSEYR554