Browse Source

Add XMLDocs

+ EmbedBuilderExtensions
+ CacheMode
+ ImageFormat
pull/988/head
Hsu Still 7 years ago
parent
commit
faaf3397da
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
3 changed files with 12 additions and 2 deletions
  1. +3
    -1
      src/Discord.Net.Core/Entities/CacheMode.cs
  2. +2
    -1
      src/Discord.Net.Core/Entities/ImageFormat.cs
  3. +7
    -0
      src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs

+ 3
- 1
src/Discord.Net.Core/Entities/CacheMode.cs View File

@@ -1,8 +1,10 @@
namespace Discord
namespace Discord
{
public enum CacheMode
{
/// <summary> Allows the object to be downloaded if it does not exist in the current cache. </summary>
AllowDownload,
/// <summary> Only allows the object to be pulled from the existing cache. </summary>
CacheOnly
}
}

+ 2
- 1
src/Discord.Net.Core/Entities/ImageFormat.cs View File

@@ -1,5 +1,6 @@
namespace Discord
namespace Discord
{
/// <summary> The type of format for the image to return. </summary>
public enum ImageFormat
{
Auto,


+ 7
- 0
src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs View File

@@ -4,24 +4,31 @@ namespace Discord
{
public static class EmbedBuilderExtensions
{
/// <summary> Adds embed color based on the provided raw value. </summary>
public static EmbedBuilder WithColor(this EmbedBuilder builder, uint rawValue) =>
builder.WithColor(new Color(rawValue));

/// <summary> Adds embed color based on the provided RGB <see cref="byte"/> value. </summary>
public static EmbedBuilder WithColor(this EmbedBuilder builder, byte r, byte g, byte b) =>
builder.WithColor(new Color(r, g, b));

/// <summary> Adds embed color based on the provided RGB <see cref="int"/> value. </summary>
public static EmbedBuilder WithColor(this EmbedBuilder builder, int r, int g, int b) =>
builder.WithColor(new Color(r, g, b));

/// <summary> Adds embed color based on the provided RGB <see cref="float"/> value. </summary>
public static EmbedBuilder WithColor(this EmbedBuilder builder, float r, float g, float b) =>
builder.WithColor(new Color(r, g, b));

/// <summary> Fills the embed author field with the provided user's full username and avatar URL. </summary>
public static EmbedBuilder WithAuthor(this EmbedBuilder builder, IUser user) =>
builder.WithAuthor($"{user.Username}#{user.Discriminator}", user.GetAvatarUrl());

/// <summary> Fills the embed author field with the provided user's nickname and avatar URL; username is used if nickname is not set. </summary>
public static EmbedBuilder WithAuthor(this EmbedBuilder builder, IGuildUser user) =>
builder.WithAuthor($"{user.Nickname ?? user.Username}#{user.Discriminator}", user.GetAvatarUrl());

/// <summary> Converts a <see cref="EmbedType.Rich"/> <see cref="IEmbed"/> object to a <see cref="EmbedBuilder"/>. </summary>
public static EmbedBuilder ToEmbedBuilder(this IEmbed embed)
{
if (embed.Type != EmbedType.Rich)


Loading…
Cancel
Save