Remove checks from UpdateAsync methods (#2790)
This commit is contained in:
@@ -162,12 +162,6 @@ namespace Discord.Rest
|
||||
var embed = args.Embed;
|
||||
var embeds = args.Embeds;
|
||||
|
||||
bool hasText = args.Content.IsSpecified ? !string.IsNullOrEmpty(args.Content.Value) : !string.IsNullOrEmpty(Message.Content);
|
||||
bool hasEmbeds = embed.IsSpecified && embed.Value != null || embeds.IsSpecified && embeds.Value?.Length > 0 || Message.Embeds.Any();
|
||||
|
||||
if (!hasText && !hasEmbeds)
|
||||
Preconditions.NotNullOrEmpty(args.Content.IsSpecified ? args.Content.Value : string.Empty, nameof(args.Content));
|
||||
|
||||
var apiEmbeds = embed.IsSpecified || embeds.IsSpecified ? new List<API.Embed>() : null;
|
||||
|
||||
if (embed.IsSpecified && embed.Value != null)
|
||||
|
||||
@@ -475,12 +475,6 @@ namespace Discord.Rest
|
||||
var embed = args.Embed;
|
||||
var embeds = args.Embeds;
|
||||
|
||||
bool hasText = args.Content.IsSpecified ? !string.IsNullOrEmpty(args.Content.Value) : false;
|
||||
bool hasEmbeds = embed.IsSpecified && embed.Value != null || embeds.IsSpecified && embeds.Value?.Length > 0;
|
||||
|
||||
if (!hasText && !hasEmbeds)
|
||||
Preconditions.NotNullOrEmpty(args.Content.IsSpecified ? args.Content.Value : string.Empty, nameof(args.Content));
|
||||
|
||||
var apiEmbeds = embed.IsSpecified || embeds.IsSpecified ? new List<API.Embed>() : null;
|
||||
|
||||
if (embed.IsSpecified && embed.Value != null)
|
||||
|
||||
@@ -224,16 +224,6 @@ namespace Discord.WebSocket
|
||||
var embed = args.Embed;
|
||||
var embeds = args.Embeds;
|
||||
|
||||
bool hasText = args.Content.IsSpecified ? !string.IsNullOrEmpty(args.Content.Value) : !string.IsNullOrEmpty(Message.Content);
|
||||
bool hasEmbeds = embed.IsSpecified && embed.Value != null || embeds.IsSpecified && embeds.Value?.Length > 0 || Message.Embeds.Any();
|
||||
bool hasComponents = args.Components.IsSpecified && args.Components.Value != null;
|
||||
bool hasAttachments = args.Attachments.IsSpecified;
|
||||
bool hasFlags = args.Flags.IsSpecified;
|
||||
|
||||
// No content needed if modifying flags
|
||||
if ((!hasComponents && !hasText && !hasEmbeds && !hasAttachments) && !hasFlags)
|
||||
Preconditions.NotNullOrEmpty(args.Content.IsSpecified ? args.Content.Value : string.Empty, nameof(args.Content));
|
||||
|
||||
var apiEmbeds = embed.IsSpecified || embeds.IsSpecified ? new List<API.Embed>() : null;
|
||||
|
||||
if (embed.IsSpecified && embed.Value != null)
|
||||
|
||||
@@ -221,12 +221,6 @@ namespace Discord.WebSocket
|
||||
var embed = args.Embed;
|
||||
var embeds = args.Embeds;
|
||||
|
||||
bool hasText = args.Content.IsSpecified ? !string.IsNullOrEmpty(args.Content.Value) : false;
|
||||
bool hasEmbeds = embed.IsSpecified && embed.Value != null || embeds.IsSpecified && embeds.Value?.Length > 0;
|
||||
|
||||
if (!hasText && !hasEmbeds)
|
||||
Preconditions.NotNullOrEmpty(args.Content.IsSpecified ? args.Content.Value : string.Empty, nameof(args.Content));
|
||||
|
||||
var apiEmbeds = embed.IsSpecified || embeds.IsSpecified ? new List<API.Embed>() : null;
|
||||
|
||||
if (embed.IsSpecified && embed.Value != null)
|
||||
|
||||
Reference in New Issue
Block a user