def resp_with_token mtd, path, form
      fail unless path.start_with? ?/
      timeout = 5
      begin
        reddit_resp mtd, "https://oauth.reddit.com" + path, form, {
          "Authorization" => "bearer #{token}",
          "User-Agent" => "bot/#{@user_agent || @name}/#{RedditBot::VERSION} by /u/nakilon",
        }
      rescue NetHTTPUtils::Error => e
        sleep timeout
        Module.nesting[1].logger.info "sleeping #{timeout} seconds because of #{e.code}"
        timeout *= 2
        raise unless e.code == 401
        @token_cached = nil
        retry
      end
    end
def resp_with_token mtd, path, form
      fail unless path.start_with? ?/
      timeout = 5
      begin
        reddit_resp mtd, "https://oauth.reddit.com" + path, form, {
          "Authorization" => "bearer #{token}",
          "User-Agent" => "bot/#{@user_agent || @name}/#{RedditBot::VERSION} by /u/nakilon",
        }
      rescue NetHTTPUtils::Error => e
        sleep timeout
        Module.nesting[1].logger.info "sleeping #{timeout} seconds because of #{e.code}"
        timeout *= 2
        raise unless e.code == 401
        @token_cached = nil
        retry
      end
    end
def update_captcha
   return if @ignore_captcha
   pp iden_json = json(:post, "/api/new_captcha")
   iden = iden_json["json"]["data"]["iden"]
   # return @iden_and_captcha = [iden, "\n"] if @ignore_captcha
   # pp resp_with_token(:get, "/captcha/#{iden_json["json"]["data"]["iden"]}", {})
   puts "CAPTCHA: https://reddit.com/captcha/#{iden}"
   @iden_and_captcha = [iden, gets.strip]
 end