Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public bool TryGetPlayer(ulong guildId, out LavalinkPlayer player)
 => Players.TryGetValue(guildId, out player);
Exemplo n.º 3
0
 public Task DisconnectAsync(LavalinkPlayer player)
 => player.DisconnectAsync();
Exemplo n.º 4
0
        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];
        }