[Fix] Certain global user properies not getting updated (#3158)

* yep

* fix
This commit is contained in:
Mihail Gribkov
2025-07-14 01:39:46 +03:00
committed by GitHub
parent 978f999843
commit f9ba642976
9 changed files with 159 additions and 5 deletions

50
.gitignore vendored
View File

@@ -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

View File

@@ -8,14 +8,27 @@ namespace Discord.WebSocket
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
internal class SocketGlobalUser : SocketUser
{
/// <inheritdoc />
public override bool IsBot { get; internal set; }
/// <inheritdoc />
public override string Username { get; internal set; }
/// <inheritdoc />
public override ushort DiscriminatorValue { get; internal set; }
/// <inheritdoc />
public override string AvatarId { get; internal set; }
/// <inheritdoc />
public override string GlobalName { get; internal set; }
/// <inheritdoc />
public override string AvatarDecorationHash { get; internal set; }
/// <inheritdoc />
public override ulong? AvatarDecorationSkuId { get; internal set; }
/// <inheritdoc />
public override PrimaryGuild? PrimaryGuild { get; internal set; }
/// <inheritdoc />
internal override SocketPresence Presence { get; set; }
/// <inheritdoc />
public override bool IsWebhook => false;
/// <inheritdoc />
internal override SocketGlobalUser GlobalUser { get => this; set => throw new NotImplementedException(); }
private readonly object _lockObj = new object();

View File

@@ -31,6 +31,28 @@ namespace Discord.WebSocket
public override string AvatarId { get { return GlobalUser.AvatarId; } internal set { GlobalUser.AvatarId = value; } }
/// <inheritdoc />
public override string GlobalName { get { return GlobalUser.GlobalName; } internal set { GlobalUser.GlobalName = value; } }
/// <inheritdoc />
public override string AvatarDecorationHash
{
get => GlobalUser.AvatarDecorationHash;
internal set => GlobalUser.AvatarDecorationHash = value;
}
/// <inheritdoc />
public override ulong? AvatarDecorationSkuId
{
get => GlobalUser.AvatarDecorationSkuId;
internal set => GlobalUser.AvatarDecorationSkuId = value;
}
/// <inheritdoc />
public override PrimaryGuild? PrimaryGuild
{
get => GlobalUser.PrimaryGuild;
internal set => GlobalUser.PrimaryGuild = value;
}
/// <inheritdoc />
internal override SocketPresence Presence { get { return GlobalUser.Presence; } set { GlobalUser.Presence = value; } }

View File

@@ -53,6 +53,13 @@ namespace Discord.WebSocket
/// <inheritdoc />
public override string GlobalName { get { return GlobalUser.GlobalName; } internal set { GlobalUser.GlobalName = value; } }
/// <inheritdoc />
public override string AvatarDecorationHash { get => GlobalUser.AvatarDecorationHash; internal set => GlobalUser.AvatarDecorationHash = value; }
/// <inheritdoc />
public override ulong? AvatarDecorationSkuId { get => GlobalUser.AvatarDecorationSkuId; internal set => GlobalUser.AvatarDecorationSkuId = value; }
/// <inheritdoc />
public override PrimaryGuild? PrimaryGuild { get => GlobalUser.PrimaryGuild; internal set => GlobalUser.PrimaryGuild = value; }
/// <inheritdoc/>
public string GuildBannerHash { get; private set; }

View File

@@ -46,6 +46,28 @@ namespace Discord.WebSocket
public override string AvatarId { get { return GlobalUser.AvatarId; } internal set { GlobalUser.AvatarId = value; } }
/// <inheritdoc />
public override string GlobalName { get { return GlobalUser.GlobalName; } internal set { GlobalUser.GlobalName = value; } }
/// <inheritdoc />
public override string AvatarDecorationHash
{
get => GlobalUser.AvatarDecorationHash;
internal set => GlobalUser.AvatarDecorationHash = value;
}
/// <inheritdoc />
public override ulong? AvatarDecorationSkuId
{
get => GlobalUser.AvatarDecorationSkuId;
internal set => GlobalUser.AvatarDecorationSkuId = value;
}
/// <inheritdoc />
public override PrimaryGuild? PrimaryGuild
{
get => GlobalUser.PrimaryGuild;
internal set => GlobalUser.PrimaryGuild = value;
}
/// <inheritdoc />
internal override SocketPresence Presence { get { return GlobalUser.Presence; } set { GlobalUser.Presence = value; } }
/// <inheritdoc />

View File

@@ -65,6 +65,28 @@ namespace Discord.WebSocket
get => GlobalUser.GlobalName;
internal set => GlobalUser.GlobalName = value;
}
/// <inheritdoc />
public override string AvatarDecorationHash
{
get => GlobalUser.AvatarDecorationHash;
internal set => GlobalUser.AvatarDecorationHash = value;
}
/// <inheritdoc />
public override ulong? AvatarDecorationSkuId
{
get => GlobalUser.AvatarDecorationSkuId;
internal set => GlobalUser.AvatarDecorationSkuId = value;
}
/// <inheritdoc />
public override PrimaryGuild? PrimaryGuild
{
get => GlobalUser.PrimaryGuild;
internal set => GlobalUser.PrimaryGuild = value;
}
/// <inheritdoc/>
public string DisplayAvatarId => GuildAvatarId ?? AvatarId;

View File

@@ -21,6 +21,12 @@ namespace Discord.WebSocket
public override string AvatarId { get; internal set; }
/// <inheritdoc />
public override string GlobalName { get; internal set; }
/// <inheritdoc />
public override string AvatarDecorationHash { get; internal set; }
/// <inheritdoc />
public override ulong? AvatarDecorationSkuId { get; internal set; }
/// <inheritdoc />
public override PrimaryGuild? PrimaryGuild { get; internal set; }
/// <inheritdoc />
public override bool IsBot { get; internal set; }

View File

@@ -49,10 +49,13 @@ namespace Discord.WebSocket
public IReadOnlyCollection<IActivity> Activities => Presence.Activities ?? ImmutableList<IActivity>.Empty;
/// <inheritdoc />
public string AvatarDecorationHash { get; private set; }
public abstract string AvatarDecorationHash { get; internal set; }
/// <inheritdoc />
public ulong? AvatarDecorationSkuId { get; private set; }
public abstract ulong? AvatarDecorationSkuId { get; internal set; }
/// <inheritdoc />
public abstract PrimaryGuild? PrimaryGuild { get; internal set; }
/// <inheritdoc />
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(

View File

@@ -28,6 +28,15 @@ namespace Discord.WebSocket
/// <inheritdoc />
public override string GlobalName { get; internal set; }
/// <inheritdoc />
public override string AvatarDecorationHash { get; internal set; }
/// <inheritdoc />
public override ulong? AvatarDecorationSkuId { get; internal set; }
/// <inheritdoc />
public override PrimaryGuild? PrimaryGuild { get; internal set; }
/// <inheritdoc />
public override bool IsBot { get; internal set; }