def [](id)
      return @rooms[id] if id.start_with? '!'

      if id.start_with? '#'
        res = @rooms.find { |_, r| r.canonical_alias == id }
        return res.last if res.respond_to? :last
      end

      res = @rooms.find { |_, r| r.name == id }
      res.last if res.respond_to? :last
    end
def [](id)
      return @rooms[id] if id.start_with? '!'

      if id.start_with? '#'
        res = @rooms.find { |_, r| r.canonical_alias == id }
        return res.last if res.respond_to? :last
      end

      res = @rooms.find { |_, r| r.name == id }
      res.last if res.respond_to? :last
    end
Initializes a new Rooms instance.

 @param users [Users] The User manager.
 @param matrix [Matrix] The Matrix API instance.
 Gets a room by its ID, alias, or name.

 @return [Room,nil] Returns the room instance if the room was found,
   otherwise `nil`.