[Fix] SocketApplicationCommand missing GuildId (#3063)

This commit is contained in:
Mihail Gribkov
2025-02-03 21:55:33 +03:00
committed by GitHub
parent 52c2f0d918
commit c625f5fe0b
2 changed files with 5 additions and 2 deletions

View File

@@ -1048,7 +1048,7 @@ namespace Discord.WebSocket
{ {
var model = await InteractionHelper.CreateGuildCommandAsync(Discord, Id, properties, options); var model = await InteractionHelper.CreateGuildCommandAsync(Discord, Id, properties, options);
var entity = Discord.State.GetOrAddCommand(model.Id, (id) => SocketApplicationCommand.Create(Discord, model)); var entity = Discord.State.GetOrAddCommand(model.Id, (id) => SocketApplicationCommand.Create(Discord, model, Id));
entity.Update(model); entity.Update(model);
@@ -1068,7 +1068,7 @@ namespace Discord.WebSocket
{ {
var models = await InteractionHelper.BulkOverwriteGuildCommandsAsync(Discord, Id, properties, options); var models = await InteractionHelper.BulkOverwriteGuildCommandsAsync(Discord, Id, properties, options);
var entities = models.Select(x => SocketApplicationCommand.Create(Discord, x)); var entities = models.Select(x => SocketApplicationCommand.Create(Discord, x, Id));
Discord.State.PurgeCommands(x => !x.IsGlobalCommand && x.Guild.Id == Id); Discord.State.PurgeCommands(x => !x.IsGlobalCommand && x.Guild.Id == Id);

View File

@@ -146,6 +146,9 @@ namespace Discord.WebSocket
IntegrationTypes = model.IntegrationTypes.GetValueOrDefault(null)?.ToImmutableArray(); IntegrationTypes = model.IntegrationTypes.GetValueOrDefault(null)?.ToImmutableArray();
ContextTypes = model.ContextTypes.GetValueOrDefault(null)?.ToImmutableArray(); ContextTypes = model.ContextTypes.GetValueOrDefault(null)?.ToImmutableArray();
if (model.GuildId.IsSpecified)
GuildId = model.GuildId.Value;
} }
/// <inheritdoc/> /// <inheritdoc/>