From 29db63d4d18d152006df554b1e41297a74f4d2d8 Mon Sep 17 00:00:00 2001 From: Devoxin Date: Fri, 16 Mar 2018 23:47:49 +0000 Subject: [PATCH] Amend based on feedback --- src/Discord.Net.WebSocket/DiscordSocketClient.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Discord.Net.WebSocket/DiscordSocketClient.cs b/src/Discord.Net.WebSocket/DiscordSocketClient.cs index 96b9e07b3..0c3677f99 100644 --- a/src/Discord.Net.WebSocket/DiscordSocketClient.cs +++ b/src/Discord.Net.WebSocket/DiscordSocketClient.cs @@ -5,7 +5,7 @@ using Discord.Net.Converters; using Discord.Net.Udp; using Discord.Net.WebSockets; using Discord.Rest; -using Discord.WebSocket.Entities.Guilds; +using Discord.WebSocket; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; @@ -1465,6 +1465,10 @@ namespace Discord.WebSocket var data = (payload as JToken).ToObject(_serializer); var guild = State.GetGuild(data.GuildId); + + var voiceServer = new Entities.Guilds.SocketVoiceServer(data.GuildId, data.Endpoint, data.Token); + await TimedInvokeAsync(_voiceServerUpdatedEvent, nameof(UserVoiceStateUpdated), voiceServer).ConfigureAwait(false); + if (guild != null) { string endpoint = data.Endpoint.Substring(0, data.Endpoint.LastIndexOf(':')); @@ -1476,8 +1480,6 @@ namespace Discord.WebSocket return; } - SocketVoiceServer VoiceServer = new SocketVoiceServer(data.GuildId, data.Endpoint, data.Token); - await TimedInvokeAsync(_voiceServerUpdatedEvent, nameof(UserVoiceStateUpdated), VoiceServer).ConfigureAwait(false); } break;