예제 #1
0
        internal LavaNode(BaseDiscordClient baseClient, LavaSocket socket, LavaConfig config)
        {
            _config     = config;
            _baseClient = baseClient;
            LavaSocket  = socket;
            _lavalink   = LavaSocket._lavalink;
            _rest       = new HttpClient();
            _rest.DefaultRequestHeaders.Add("Authorization", _config.Authorization);
            Statistics = new LavaStats();
            _players   = new ConcurrentDictionary <ulong, LavaPlayer>();

            switch (_baseClient)
            {
            case DiscordSocketClient socketClient:
                socketClient.VoiceServerUpdated    += OnVSU;
                socketClient.UserVoiceStateUpdated += OnUVSU;
                socketClient.Disconnected          += OnSocketDisconnected;
                break;

            case DiscordShardedClient shardClient:
                shardClient.VoiceServerUpdated    += OnVSU;
                shardClient.UserVoiceStateUpdated += OnUVSU;
                shardClient.ShardDisconnected     += OnShardDisconnected;
                break;
            }
        }
예제 #2
0
 /// <summary>
 ///     Represents a <see cref="IGuild" /> voice connection.
 /// </summary>
 /// <param name="lavaSocket">
 ///     <see cref="LavaSocket" />
 /// </param>
 /// <param name="voiceChannel">Voice channel to connect to.</param>
 /// <param name="textChannel">Text channel this player is bound to.</param>
 public LavaPlayer(LavaSocket lavaSocket, IVoiceChannel voiceChannel, ITextChannel textChannel)
 {
     _lavaSocket  = lavaSocket;
     VoiceChannel = voiceChannel;
     TextChannel  = textChannel;
     Queue        = new DefaultQueue <LavaTrack>();
     _equalizer   = new Dictionary <int, EqualizerBand>(15);
 }
예제 #3
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>();
 }
예제 #4
0
 /// <summary>
 ///     Represents a <see cref="IGuild" /> voice connection.
 /// </summary>
 /// <param name="lavaSocket">
 ///     <see cref="LavaSocket" />
 /// </param>
 /// <param name="voiceChannel">Voice channel to connect to.</param>
 /// <param name="textChannel">Text channel this player is bound to.</param>
 public LavaPlayer(LavaSocket lavaSocket, IVoiceChannel voiceChannel, ITextChannel textChannel)
 {
     _lavaSocket  = lavaSocket;
     VoiceChannel = voiceChannel;
     TextChannel  = textChannel;
     Queue        = new DefaultQueue <IQueueable>(69);
     _equalizer   = new List <EqualizerBand>(15);
 }