Browse Source

Fix removing components when using ModifyAsync on a message

pull/1923/head
quin lynch 3 years ago
parent
commit
fd9d3c8f76
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs

+ 2
- 2
src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs View File

@@ -84,7 +84,7 @@ namespace Discord.Rest
{ {
Content = args.Content, Content = args.Content,
Embeds = apiEmbeds?.ToArray() ?? Optional<API.Embed[]>.Unspecified, Embeds = apiEmbeds?.ToArray() ?? Optional<API.Embed[]>.Unspecified,
Components = args.Components.IsSpecified ? args.Components.Value?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() : Optional<API.ActionRowComponent[]>.Unspecified,
Components = args.Components.IsSpecified ? args.Components.Value?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? new API.ActionRowComponent[0] : Optional<API.ActionRowComponent[]>.Unspecified,
Flags = args.Flags, Flags = args.Flags,
AllowedMentions = args.AllowedMentions.IsSpecified ? args.AllowedMentions.Value.ToModel() : Optional<API.AllowedMentions>.Unspecified, AllowedMentions = args.AllowedMentions.IsSpecified ? args.AllowedMentions.Value.ToModel() : Optional<API.AllowedMentions>.Unspecified,
}; };
@@ -150,7 +150,7 @@ namespace Discord.Rest
Embeds = apiEmbeds?.ToArray() ?? Optional<API.Embed[]>.Unspecified, Embeds = apiEmbeds?.ToArray() ?? Optional<API.Embed[]>.Unspecified,
Flags = args.Flags.IsSpecified ? args.Flags.Value : Optional.Create<MessageFlags?>(), Flags = args.Flags.IsSpecified ? args.Flags.Value : Optional.Create<MessageFlags?>(),
AllowedMentions = args.AllowedMentions.IsSpecified ? args.AllowedMentions.Value.ToModel() : Optional.Create<API.AllowedMentions>(), AllowedMentions = args.AllowedMentions.IsSpecified ? args.AllowedMentions.Value.ToModel() : Optional.Create<API.AllowedMentions>(),
Components = args.Components.IsSpecified ? args.Components.Value?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() : Optional<API.ActionRowComponent[]>.Unspecified,
Components = args.Components.IsSpecified ? args.Components.Value?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? new API.ActionRowComponent[0] : Optional<API.ActionRowComponent[]>.Unspecified,
}; };
return await client.ApiClient.ModifyMessageAsync(channelId, msgId, apiArgs, options).ConfigureAwait(false); return await client.ApiClient.ModifyMessageAsync(channelId, msgId, apiArgs, options).ConfigureAwait(false);
} }


Loading…
Cancel
Save