connect method

Future<LavalinkPlayer> connect(
  1. NyxxGateway client,
  2. Snowflake channelId,
  3. Snowflake guildId
)

Connect to a voice channel using Lavalink.

The returned LavalinkPlayer can be used to control the player in the channel.

Implementation

Future<LavalinkPlayer> connect(NyxxGateway client, Snowflake channelId, Snowflake guildId) async {
  client.gateway.updateVoiceState(
    guildId,
    GatewayVoiceStateBuilder(
      channelId: channelId,
      isMuted: false,
      isDeafened: false,
    ),
  );

  return await onPlayerConnected.firstWhere((player) => player.guildId == guildId);
}