示例#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);
        }
示例#2
0
 public bool TryGetPlayer(ulong guildId, out LavalinkPlayer player)
 => Players.TryGetValue(guildId, out player);
示例#3
0
 public Task DisconnectAsync(LavalinkPlayer player)
 => player.DisconnectAsync();
示例#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];
        }