public async ValueTask <LavalinkPlayer> ConnectAsync(CachedVoiceChannel channel) { if (Players.TryGetValue(channel.Guild.Id, out var player)) { if (channel.Id != player.Channel.Id) { await DiscordClient.UpdateVoiceStateAsync(channel.Guild.Id, channel.Id, isDeafened : SelfDeaf).ConfigureAwait(false); } return(player); } player = new LavalinkPlayer(this, channel); Players.TryAdd(channel.Guild.Id, player); await DiscordClient.UpdateVoiceStateAsync(channel.Guild.Id, channel.Id, isDeafened : SelfDeaf).ConfigureAwait(false); return(player); }
public bool TryGetPlayer(ulong guildId, out LavalinkPlayer player) => Players.TryGetValue(guildId, out player);
public Task DisconnectAsync(LavalinkPlayer player) => player.DisconnectAsync();
internal readonly float[] PreviousBands; // Used for not sending unnecessary JSON values. internal BandCollection(LavalinkPlayer player) { _player = player; Bands = new float[15]; PreviousBands = new float[15]; }