connect static method

Future<LavalinkClient> connect(
  1. Uri base, {
  2. required String password,
  3. required String userId,
  4. String clientName = defaultClientName,
})

Create a new client connected to a Lavalink server.

Implementation

static Future<LavalinkClient> connect(
  Uri base, {
  required String password,
  required String userId,
  String clientName = defaultClientName,
}) async {
  // Ensure the path will be used as a directory in resolve()
  if (!base.path.endsWith('/')) base = base.replace(path: '${base.path}/');

  final client = LavalinkClient._(
    base: base,
    password: password,
    userId: userId,
    clientName: clientName,
  );

  client._connection = await LavalinkConnection.connect(client);

  return client;
}