From 8daa0b6c911a36cbf6a9fb6cfbe8b030dd9b0ceb Mon Sep 17 00:00:00 2001 From: Quin Lynch <49576606+quinchs@users.noreply.github.com> Date: Mon, 20 Dec 2021 12:42:28 -0400 Subject: [PATCH] fix: guild scheduled events update (#1976) --- src/Discord.Net.WebSocket/DiscordSocketClient.cs | 2 +- src/Discord.Net.WebSocket/Entities/Guilds/SocketGuildEvent.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net.WebSocket/DiscordSocketClient.cs b/src/Discord.Net.WebSocket/DiscordSocketClient.cs index 5d2938ef4..95b36f9b5 100644 --- a/src/Discord.Net.WebSocket/DiscordSocketClient.cs +++ b/src/Discord.Net.WebSocket/DiscordSocketClient.cs @@ -2640,7 +2640,7 @@ namespace Discord.WebSocket return; } - var before = guild.GetEvent(data.Id); + var before = guild.GetEvent(data.Id)?.Clone(); var beforeCacheable = new Cacheable(before, data.Id, before != null, () => Task.FromResult((SocketGuildEvent)null)); diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuildEvent.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuildEvent.cs index 6974c0498..df619e4ca 100644 --- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuildEvent.cs +++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuildEvent.cs @@ -196,6 +196,8 @@ namespace Discord.WebSocket public IAsyncEnumerable> GetUsersAsync(ulong fromUserId, Direction dir, int limit = DiscordConfig.MaxGuildEventUsersPerBatch, RequestOptions options = null) => GuildHelper.GetEventUsersAsync(Discord, this, fromUserId, dir, limit, options); + internal SocketGuildEvent Clone() => MemberwiseClone() as SocketGuildEvent; + #region IGuildScheduledEvent ///