Esempio n. 1
0
 internal LavaPlayer(LavaNode lavaNode, IVoiceChannel voiceChannel, IMessageChannel textChannel)
 {
     TextChannel  = textChannel;
     VoiceChannel = voiceChannel;
     _lavaSocket  = lavaNode.LavaSocket;
     Volatile.Write(ref _isDisposed, false);
     Queue = new LavaQueue <LavaTrack>();
 }
Esempio n. 2
0
        public async Task <LavaNode> AddNodeAsync(DiscordSocketClient socketClient,
                                                  LavaNodeSettings settings)
        {
            var hash = socketClient.GetHashCode();

            if (_nodes.TryGetValue(hash, out LavaNode node))
            {
                return(node);
            }

            settings.Shards = settings.Shards is null ?
                              await socketClient.GetRecommendedShardCountAsync().ConfigureAwait(false)
                : 1;

            node = new LavaNode(settings);
            await node.InitializeAsync().ConfigureAwait(false);

            return(node);
        }