Fix Embed.Length behavior (#1012)
- This commit splits up the get statement lines for better analysis.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -57,7 +57,18 @@ namespace Discord
|
|||||||
Fields = fields;
|
Fields = fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Length => Title?.Length + Author?.Name?.Length + Description?.Length + Footer?.Text?.Length + Fields.Sum(f => f.Name.Length + f.Value.ToString().Length) ?? 0;
|
public int Length
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int titleLength = Title?.Length ?? 0;
|
||||||
|
int authorLength = Author?.Name?.Length ?? 0;
|
||||||
|
int descriptionLength = Description?.Length ?? 0;
|
||||||
|
int footerLength = Footer?.Text?.Length ?? 0;
|
||||||
|
int fieldSum = Fields.Sum(f => f.Name?.Length + f.Value?.ToString().Length) ?? 0;
|
||||||
|
return titleLength + authorLength + descriptionLength + footerLength + fieldSum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override string ToString() => Title;
|
public override string ToString() => Title;
|
||||||
private string DebuggerDisplay => $"{Title} ({Type})";
|
private string DebuggerDisplay => $"{Title} ({Type})";
|
||||||
|
|||||||
Reference in New Issue
Block a user