From 7d24a47e726a383949e74aad4a43150b775b0fc2 Mon Sep 17 00:00:00 2001 From: Pannoniae <25565223+Pannoniae@users.noreply.github.com> Date: Mon, 23 Dec 2024 12:48:24 +0000 Subject: [PATCH 1/3] update NetCord to latest --- .../Lavalink4NET.Samples.NetCord.csproj | 8 ++++---- src/Lavalink4NET.NetCord/GatewayClientWrapper.cs | 12 ++++++++++-- src/Lavalink4NET.NetCord/Lavalink4NET.NetCord.csproj | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/samples/Lavalink4NET.Samples.NetCord/Lavalink4NET.Samples.NetCord.csproj b/samples/Lavalink4NET.Samples.NetCord/Lavalink4NET.Samples.NetCord.csproj index c00e168d..b717af8a 100644 --- a/samples/Lavalink4NET.Samples.NetCord/Lavalink4NET.Samples.NetCord.csproj +++ b/samples/Lavalink4NET.Samples.NetCord/Lavalink4NET.Samples.NetCord.csproj @@ -10,10 +10,10 @@ - - - - + + + + diff --git a/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs b/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs index fe6a0d80..61420ccf 100644 --- a/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs +++ b/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs @@ -11,6 +11,8 @@ internal sealed class GatewayClientWrapper : GatewayClientWrapperBase, IDiscordC { private readonly GatewayClient _client; + private readonly TaskCompletionSource _ready = new(); + public GatewayClientWrapper(GatewayClient client) { ArgumentNullException.ThrowIfNull(client); @@ -19,6 +21,12 @@ public GatewayClientWrapper(GatewayClient client) _client.VoiceStateUpdate += HandleVoiceStateUpdateAsync; _client.VoiceServerUpdate += HandleVoiceServerUpdateAsync; + _client.Ready += HandleReady; + } + + private ValueTask HandleReady(ReadyEventArgs arg) { + _ready.TrySetResult(true); + return default; } public void Dispose() @@ -31,7 +39,7 @@ public override async ValueTask WaitForReadyAsync(Cancellatio { cancellationToken.ThrowIfCancellationRequested(); - await _client.ReadyAsync + await _ready.Task .WaitAsync(cancellationToken) .ConfigureAwait(false); @@ -46,4 +54,4 @@ protected override bool TryGetGuild(ulong guildId, [MaybeNullWhen(false)] out Gu { return _client.Cache.Guilds.TryGetValue(guildId, out guild); } -} +} \ No newline at end of file diff --git a/src/Lavalink4NET.NetCord/Lavalink4NET.NetCord.csproj b/src/Lavalink4NET.NetCord/Lavalink4NET.NetCord.csproj index c8f9ed25..46897b07 100644 --- a/src/Lavalink4NET.NetCord/Lavalink4NET.NetCord.csproj +++ b/src/Lavalink4NET.NetCord/Lavalink4NET.NetCord.csproj @@ -11,8 +11,8 @@ - - + + From d480a32235297101897a5f66dbb241628363ddf3 Mon Sep 17 00:00:00 2001 From: Pannoniae <25565223+Pannoniae@users.noreply.github.com> Date: Mon, 23 Dec 2024 15:39:36 +0000 Subject: [PATCH 2/3] fix braces Co-authored-by: Kuba_Z2 <77853483+KubaZ2@users.noreply.github.com> Signed-off-by: Pannoniae <25565223+Pannoniae@users.noreply.github.com> --- src/Lavalink4NET.NetCord/GatewayClientWrapper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs b/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs index 61420ccf..61915ebf 100644 --- a/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs +++ b/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs @@ -24,7 +24,8 @@ public GatewayClientWrapper(GatewayClient client) _client.Ready += HandleReady; } - private ValueTask HandleReady(ReadyEventArgs arg) { + private ValueTask HandleReady(ReadyEventArgs arg) + { _ready.TrySetResult(true); return default; } From bd9470f6c1e61b9ff18fb47dfd19bd27c99943f6 Mon Sep 17 00:00:00 2001 From: Pannoniae <25565223+Pannoniae@users.noreply.github.com> Date: Mon, 23 Dec 2024 15:39:46 +0000 Subject: [PATCH 3/3] fix braces, mk.II Co-authored-by: Kuba_Z2 <77853483+KubaZ2@users.noreply.github.com> Signed-off-by: Pannoniae <25565223+Pannoniae@users.noreply.github.com> --- src/Lavalink4NET.NetCord/GatewayClientWrapper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs b/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs index 61915ebf..4664808f 100644 --- a/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs +++ b/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs @@ -55,4 +55,4 @@ protected override bool TryGetGuild(ulong guildId, [MaybeNullWhen(false)] out Gu { return _client.Cache.Guilds.TryGetValue(guildId, out guild); } -} \ No newline at end of file +}