Skip to content

Commit

Permalink
[Fix] SocketApplicationCommand missing GuildId (#3063)
Browse files Browse the repository at this point in the history
  • Loading branch information
Misha-133 authored Feb 3, 2025
1 parent 52c2f0d commit c625f5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ public async Task<SocketApplicationCommand> CreateApplicationCommandAsync(Applic
{
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);

Expand All @@ -1068,7 +1068,7 @@ public async Task<IReadOnlyCollection<SocketApplicationCommand>> BulkOverwriteAp
{
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ internal void Update(Model model)

IntegrationTypes = model.IntegrationTypes.GetValueOrDefault(null)?.ToImmutableArray();
ContextTypes = model.ContextTypes.GetValueOrDefault(null)?.ToImmutableArray();

if (model.GuildId.IsSpecified)
GuildId = model.GuildId.Value;
}

/// <inheritdoc/>
Expand Down

0 comments on commit c625f5f

Please sign in to comment.