From f9ba642976c05bdfd55fa4a184bfd015b81b01cf Mon Sep 17 00:00:00 2001
From: Mihail Gribkov <61027276+Misha-133@users.noreply.github.com>
Date: Mon, 14 Jul 2025 01:39:46 +0300
Subject: [PATCH] [Fix] Certain global user properies not getting updated
(#3158)
* yep
* fix
---
.gitignore | 50 +++++++++++++++++++
.../Entities/Users/SocketGlobalUser.cs | 15 +++++-
.../Entities/Users/SocketGroupUser.cs | 22 ++++++++
.../Entities/Users/SocketGuildUser.cs | 7 +++
.../Entities/Users/SocketSelfUser.cs | 22 ++++++++
.../Entities/Users/SocketThreadUser.cs | 22 ++++++++
.../Entities/Users/SocketUnknownUser.cs | 6 +++
.../Entities/Users/SocketUser.cs | 11 ++--
.../Entities/Users/SocketWebhookUser.cs | 9 ++++
9 files changed, 159 insertions(+), 5 deletions(-)
diff --git a/.gitignore b/.gitignore
index 65437084..b3c3a187 100644
--- a/.gitignore
+++ b/.gitignore
@@ -206,3 +206,53 @@ docs/api/\.manifest
# Codealike UID
codealike.json
+WebhookEventsApp/WebhookEventsApp.csproj
+WebhookEventsApp/Properties/launchSettings.json
+WebhookEventsApp/Program.cs
+WebhookEventsApp/Modules/TestModule.cs
+WebhookEventsApp/Interaction.cs
+WebhookEventsApp/AspNetCoreInteractions.cs
+WebhookEventsApp/appsettings.json
+WebhookEventsApp/appsettings.Development.json
+VoiceFuckery/VoiceFuckery.csproj
+VoiceFuckery/Program.cs
+VoiceFuckery/opus.dll
+VoiceFuckery/libsodium.dll
+VoiceFuckery/bees.mp3
+ShardFuckery/ShardFuckery.csproj
+ShardFuckery/Program.cs
+RestInteractionsTestBot/RestInteractionsTestBot.csproj
+RestInteractionsTestBot/Properties/launchSettings.json
+RestInteractionsTestBot/Program.cs
+RestInteractionsTestBot/Modules/TestModule.cs
+RestInteractionsTestBot/BotService.cs
+RestInteractionsTestBot/AspNetCoreInteractions.cs
+RestInteractionsTestBot/appsettings.json
+RestInteractionsTestBot/appsettings.Development.json
+DNetTestApp/Program.cs
+DNetTestApp/DNetTestApp.csproj
+DNetRestIntFramework/Program.cs
+DNetRestIntFramework/DNetRestIntFramework.csproj
+DNetRestIntFramework/BotService.cs
+DiscordNetTestBot/Startup.cs
+DiscordNetTestBot/Properties/CommandLocalizations.ru.resx
+DiscordNetTestBot/Properties/CommandLocalizations.resx
+DiscordNetTestBot/Properties/CommandLocalizations.Designer.cs
+DiscordNetTestBot/Modules/TestModule.cs
+DiscordNetTestBot/Modules/MoreModules.cs
+DiscordNetTestBot/Modules/CringeAutocomplete.cs
+DiscordNetTestBot/Modules/CommandModule.cs
+DiscordNetTestBot/Modules/AnotherModule.cs
+DiscordNetTestBot/InteractionHandler.cs
+DiscordNetTestBot/DiscordNetTestBot.csproj
+DiscordNetTestBot/DiscordBot.cs
+DiscordNetTestBot/appsettings.json
+DiscordNetTestBot/DiscordNetTemplate.csproj
+DiscordNetTestBot/Services/DiscordBotService.cs
+DiscordNetTestBot/Services/InteractionHandler.cs
+DiscordNetTestBot/Modules/ModalValueDebug.cs
+DiscordNetTestBot/Modules/ComponentsDebug.cs
+ShardedFun/ShardedFun.csproj
+ShardedFun/Program.cs
+DiscordNetTestBot/Services/TetrisService.cs
+DiscordNetTestBot/Modules/TetrisModule.cs
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketGlobalUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketGlobalUser.cs
index 5c933447..7f89e49a 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketGlobalUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketGlobalUser.cs
@@ -8,14 +8,27 @@ namespace Discord.WebSocket
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
internal class SocketGlobalUser : SocketUser
{
+ ///
public override bool IsBot { get; internal set; }
+ ///
public override string Username { get; internal set; }
+ ///
public override ushort DiscriminatorValue { get; internal set; }
+ ///
public override string AvatarId { get; internal set; }
+ ///
public override string GlobalName { get; internal set; }
+ ///
+ public override string AvatarDecorationHash { get; internal set; }
+ ///
+ public override ulong? AvatarDecorationSkuId { get; internal set; }
+ ///
+ public override PrimaryGuild? PrimaryGuild { get; internal set; }
+ ///
internal override SocketPresence Presence { get; set; }
-
+ ///
public override bool IsWebhook => false;
+ ///
internal override SocketGlobalUser GlobalUser { get => this; set => throw new NotImplementedException(); }
private readonly object _lockObj = new object();
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketGroupUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketGroupUser.cs
index 1f16f344..63abafef 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketGroupUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketGroupUser.cs
@@ -31,6 +31,28 @@ namespace Discord.WebSocket
public override string AvatarId { get { return GlobalUser.AvatarId; } internal set { GlobalUser.AvatarId = value; } }
///
public override string GlobalName { get { return GlobalUser.GlobalName; } internal set { GlobalUser.GlobalName = value; } }
+
+ ///
+ public override string AvatarDecorationHash
+ {
+ get => GlobalUser.AvatarDecorationHash;
+ internal set => GlobalUser.AvatarDecorationHash = value;
+ }
+
+ ///
+ public override ulong? AvatarDecorationSkuId
+ {
+ get => GlobalUser.AvatarDecorationSkuId;
+ internal set => GlobalUser.AvatarDecorationSkuId = value;
+ }
+
+ ///
+ public override PrimaryGuild? PrimaryGuild
+ {
+ get => GlobalUser.PrimaryGuild;
+ internal set => GlobalUser.PrimaryGuild = value;
+ }
+
///
internal override SocketPresence Presence { get { return GlobalUser.Presence; } set { GlobalUser.Presence = value; } }
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs
index 0a79b770..8a39fe46 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs
@@ -53,6 +53,13 @@ namespace Discord.WebSocket
///
public override string GlobalName { get { return GlobalUser.GlobalName; } internal set { GlobalUser.GlobalName = value; } }
+ ///
+ public override string AvatarDecorationHash { get => GlobalUser.AvatarDecorationHash; internal set => GlobalUser.AvatarDecorationHash = value; }
+ ///
+ public override ulong? AvatarDecorationSkuId { get => GlobalUser.AvatarDecorationSkuId; internal set => GlobalUser.AvatarDecorationSkuId = value; }
+ ///
+ public override PrimaryGuild? PrimaryGuild { get => GlobalUser.PrimaryGuild; internal set => GlobalUser.PrimaryGuild = value; }
+
///
public string GuildBannerHash { get; private set; }
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketSelfUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketSelfUser.cs
index 979a1111..65d14f14 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketSelfUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketSelfUser.cs
@@ -46,6 +46,28 @@ namespace Discord.WebSocket
public override string AvatarId { get { return GlobalUser.AvatarId; } internal set { GlobalUser.AvatarId = value; } }
///
public override string GlobalName { get { return GlobalUser.GlobalName; } internal set { GlobalUser.GlobalName = value; } }
+
+ ///
+ public override string AvatarDecorationHash
+ {
+ get => GlobalUser.AvatarDecorationHash;
+ internal set => GlobalUser.AvatarDecorationHash = value;
+ }
+
+ ///
+ public override ulong? AvatarDecorationSkuId
+ {
+ get => GlobalUser.AvatarDecorationSkuId;
+ internal set => GlobalUser.AvatarDecorationSkuId = value;
+ }
+
+ ///
+ public override PrimaryGuild? PrimaryGuild
+ {
+ get => GlobalUser.PrimaryGuild;
+ internal set => GlobalUser.PrimaryGuild = value;
+ }
+
///
internal override SocketPresence Presence { get { return GlobalUser.Presence; } set { GlobalUser.Presence = value; } }
///
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketThreadUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketThreadUser.cs
index d87da400..a6c1322b 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketThreadUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketThreadUser.cs
@@ -65,6 +65,28 @@ namespace Discord.WebSocket
get => GlobalUser.GlobalName;
internal set => GlobalUser.GlobalName = value;
}
+
+ ///
+ public override string AvatarDecorationHash
+ {
+ get => GlobalUser.AvatarDecorationHash;
+ internal set => GlobalUser.AvatarDecorationHash = value;
+ }
+
+ ///
+ public override ulong? AvatarDecorationSkuId
+ {
+ get => GlobalUser.AvatarDecorationSkuId;
+ internal set => GlobalUser.AvatarDecorationSkuId = value;
+ }
+
+ ///
+ public override PrimaryGuild? PrimaryGuild
+ {
+ get => GlobalUser.PrimaryGuild;
+ internal set => GlobalUser.PrimaryGuild = value;
+ }
+
///
public string DisplayAvatarId => GuildAvatarId ?? AvatarId;
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketUnknownUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketUnknownUser.cs
index 930518b1..d1730b65 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketUnknownUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketUnknownUser.cs
@@ -21,6 +21,12 @@ namespace Discord.WebSocket
public override string AvatarId { get; internal set; }
///
public override string GlobalName { get; internal set; }
+ ///
+ public override string AvatarDecorationHash { get; internal set; }
+ ///
+ public override ulong? AvatarDecorationSkuId { get; internal set; }
+ ///
+ public override PrimaryGuild? PrimaryGuild { get; internal set; }
///
public override bool IsBot { get; internal set; }
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs
index 02cd8aa4..121d9f82 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs
@@ -49,10 +49,13 @@ namespace Discord.WebSocket
public IReadOnlyCollection Activities => Presence.Activities ?? ImmutableList.Empty;
///
- public string AvatarDecorationHash { get; private set; }
+ public abstract string AvatarDecorationHash { get; internal set; }
///
- public ulong? AvatarDecorationSkuId { get; private set; }
+ public abstract ulong? AvatarDecorationSkuId { get; internal set; }
+
+ ///
+ public abstract PrimaryGuild? PrimaryGuild { get; internal set; }
///
public PrimaryGuild? PrimaryGuild { get; private set; }
@@ -120,15 +123,15 @@ namespace Discord.WebSocket
{
if (model.PrimaryGuild.Value is null)
{
- PrimaryGuild = null;
if (PrimaryGuild is not null)
hasChanges = true;
+ PrimaryGuild = null;
}
else
{
if (PrimaryGuild?.GuildId != model.PrimaryGuild.Value.GuildId ||
PrimaryGuild?.BadgeHash != model.PrimaryGuild.Value.BadgeHash ||
- PrimaryGuild?.Tag != model.PrimaryGuild.Value.Tag||
+ PrimaryGuild?.Tag != model.PrimaryGuild.Value.Tag ||
PrimaryGuild?.IdentityEnabled != model.PrimaryGuild.Value.IdentityEnabled)
{
PrimaryGuild = new(
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketWebhookUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketWebhookUser.cs
index 0b46e26d..52add008 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketWebhookUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketWebhookUser.cs
@@ -28,6 +28,15 @@ namespace Discord.WebSocket
///
public override string GlobalName { get; internal set; }
+ ///
+ public override string AvatarDecorationHash { get; internal set; }
+
+ ///
+ public override ulong? AvatarDecorationSkuId { get; internal set; }
+
+ ///
+ public override PrimaryGuild? PrimaryGuild { get; internal set; }
+
///
public override bool IsBot { get; internal set; }