public static LocalEmbedBuilder FillLineWithEmptyFields(this LocalEmbedBuilder eb) { var currentInlineFieldCount = 0; for (var i = eb.Fields.Count - 1; i >= 0; i--) { if (!eb.Fields[i].IsInline) { break; } currentInlineFieldCount++; } // line is already full if (currentInlineFieldCount % 3 == 0) { return(eb); } while (currentInlineFieldCount % 3 != 0) { eb.AddInlineBlankField(); currentInlineFieldCount++; } return(eb); }
public LocalEmbedBuilder CreateInfoEmbed() { var eb = new LocalEmbedBuilder() .WithDefaultColor() .WithTitle(ToString()) .WithDescription(Summary); var displayMethods = new List <string>(); var displayProperties = new List <string>(); var propertyCount = 0; var methodCount = 0; foreach (var member in Members) { if (member is SearchableMethod method) { if (displayMethods.Count < 3 && !displayMethods.Contains(method.Info.Name)) { displayMethods.Add(method.Info.Name); } methodCount++; } else if (member is SearchableProperty property) { if (displayProperties.Count < 3 && !displayProperties.Contains(property.Info.Name)) { displayProperties.Add(property.Info.Name); } propertyCount++; } } if (displayProperties.Count > 0) { eb.AddInlineCodeBlockField($"Properties ({propertyCount})", string.Join("\n", displayProperties)); eb.AddInlineBlankField(); } if (displayMethods.Count > 0) { eb.AddInlineCodeBlockField($"Methods ({methodCount})", string.Join('\n', displayMethods)); } return(eb); }