def get_updates(opts={}, &_block)
      loop do
        if opts[:fail_silently]
          @fail_silently = true
        end

        response = api_request('getUpdates', { offset: opts[:offset] || @offset, timeout: opts[:timeout] || @timeout }, nil)

        response.result.each do |raw_update|
          update = Telegrammer::DataTypes::Update.new(raw_update)
          @offset = update.update_id + 1
          yield (update.inline_query ? update.inline_query : update.message)
        end
      end
    end
def get_updates(opts={}, &_block)
      loop do
        if opts[:fail_silently]
          @fail_silently = true
        end

        response = api_request('getUpdates', { offset: opts[:offset] || @offset, timeout: opts[:timeout] || @timeout }, nil)

        response.result.each do |raw_update|
          update = Telegrammer::DataTypes::Update.new(raw_update)
          @offset = update.update_id + 1
          yield (update.inline_query ? update.inline_query : update.message)
        end
      end
    end
Returns a new instance of Telegrammer::Bot

 @param [String] api_token API Token

 @example
     bot = Telegrammer::Bot.new('[YOUR TELEGRAM TOKEN]')

 @raise [Telegrammer::Errors::BadRequestError] if something goes wrong obtaining data about your bot
 @raise [Telegrammer::Errors::ServiceUnavailableError] if Telegram servers are down
 Get incoming updates using long polling

 @param [Hash] opts Options when getting updates
 @option params [Integer] :fail_silently Optional. Ignore every Connection Error. Default: false
 @option params [Integer] :offset Optional. Sequential number of the first photo to be returned. By default, all photos are returned.
 @option params [Integer] :timeout Optional. Timeout in minutes. 0 for short polling, Default: 60.

 @example
     bot = Telegrammer::Bot.new('[YOUR TELEGRAM TOKEN]')

     bot.get_updates do |update|
       if update.is_a?(Telegrammer::DataTypes::Message)
         puts "In chat #{update.chat.id}, @#{update.from.username} said: #{update.text}"
         bot.send_message(chat_id: update.chat.id, text: "You said: #{update.text}")
       end

       # Here you can also process message text to detect user commands
       # To learn more about commands, see https://core.telegram.org/bots#commands
     end

     bot.get_updates({fail_silently:true, timeout:20}) do |message|
       if update.is_a?(Telegrammer::DataTypes::Message)
         puts "In chat #{message.chat.id}, @#{message.from.username} said: #{update.text}"
         bot.send_message(chat_id: message.chat.id, text: "You said: #{update.text}")
       end

       # Here you can also process message text to detect user commands
       # To learn more about commands, see https://core.telegram.org/bots#commands
     end

 @raise [Telegrammer::Errors::BadRequestError] if something goes wrong in the Telegram API servers with the params received by the operation
 @raise [Telegrammer::Errors::ServiceUnavailableError] if Telegram servers are down
 @raise [Telegrammer::Errors::TimeoutError] if HTTPClient connection goes timeout