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; } }
/// <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); }
internal LavaPlayer(LavaNode lavaNode, IVoiceChannel voiceChannel, IMessageChannel textChannel) { TextChannel = textChannel; VoiceChannel = voiceChannel; _lavaSocket = lavaNode.LavaSocket; Volatile.Write(ref _isDisposed, false); Queue = new LavaQueue <LavaTrack>(); }
/// <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); }