Skip to content

Commit

Permalink
fix: Fix initial voice server intercept
Browse files Browse the repository at this point in the history
  • Loading branch information
angelobreuer committed Apr 19, 2024
1 parent 1049f1a commit 1046709
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 0 additions & 7 deletions src/Lavalink4NET/Players/LavalinkPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class LavalinkPlayer : ILavalinkPlayer, ILavalinkPlayerListener
private readonly ISystemClock _systemClock;
private readonly bool _disconnectOnStop;
private readonly IPlayerLifecycle _playerLifecycle;
private readonly ILavalinkVoiceServerInterceptor _voiceServerInterceptor;
private int _disposed;
private DateTimeOffset _syncedAt;
private TimeSpan _unstretchedRelativePosition;
Expand Down Expand Up @@ -57,9 +56,7 @@ public LavalinkPlayer(IPlayerProperties<LavalinkPlayer, LavalinkPlayerOptions> p
_systemClock = properties.SystemClock;
_logger = properties.Logger;
_syncedAt = properties.SystemClock.UtcNow;

_playerLifecycle = properties.Lifecycle;
_voiceServerInterceptor = properties.VoiceServerInterceptor;

_unstretchedRelativePosition = default;
_connectedOnce = false;
Expand Down Expand Up @@ -658,10 +655,6 @@ protected virtual async ValueTask NotifyVoiceServerUpdatedAsync(VoiceServer voic
return;
}

voiceServer = await _voiceServerInterceptor
.InterceptAsync(GuildId, voiceServer, cancellationToken)
.ConfigureAwait(false);

VoiceServer = voiceServer;
await UpdateVoiceCredentialsAsync(cancellationToken).ConfigureAwait(false);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Lavalink4NET/Players/LavalinkPlayerHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ public async ValueTask UpdateVoiceServerAsync(VoiceServer voiceServer, Cancellat
return;
}

_voiceServer = voiceServer;
_voiceServer = await _playerContext.VoiceServerInterceptor
.InterceptAsync(_guildId, voiceServer, cancellationToken)
.ConfigureAwait(false);

if (_voiceState is not null)
{
Expand Down

0 comments on commit 1046709

Please sign in to comment.