Add embed builder extensions (#460)
* Add embed builder extensions People in #dotnet_discord-net suggested that this should be part of the lib after I demonstrated it * Move some extensions into EmbedBuilder [2] Apparently git didn't like that previous commit * Fix error with EmbedBuilderExtensions A summary of issues which happened: - Git decided to add an amend commit (I told it to quit?) - VS Code thinks everything is an error so it wasn't helpful - dotnet decided to think there was no error until I deleted all build outputs and rebuild Sometimes I question my ability to use version control properly.
This commit is contained in:
committed by
RogueException
parent
74f6a4b392
commit
fdd38c8d7f
20
src/Discord.Net.Rest/Extensions/EmbedBuilderExtensions.cs
Normal file
20
src/Discord.Net.Rest/Extensions/EmbedBuilderExtensions.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace Discord
|
||||
{
|
||||
public static class EmbedBuilderExtensions
|
||||
{
|
||||
public static EmbedBuilder WithColor(this EmbedBuilder builder, uint rawValue) =>
|
||||
builder.WithColor(new Color(rawValue));
|
||||
|
||||
public static EmbedBuilder WithColor(this EmbedBuilder builder, byte r, byte g, byte b) =>
|
||||
builder.WithColor(new Color(r, g, b));
|
||||
|
||||
public static EmbedBuilder WithColor(this EmbedBuilder builder, float r, float g, float b) =>
|
||||
builder.WithColor(new Color(r, g, b));
|
||||
|
||||
public static EmbedBuilder WithAuthor(this EmbedBuilder builder, IUser user) =>
|
||||
builder.WithAuthor($"{user.Username}#{user.Discriminator}", user.AvatarUrl);
|
||||
|
||||
public static EmbedBuilder WithAuthor(this EmbedBuilder builder, IGuildUser user) =>
|
||||
builder.WithAuthor($"{user.Nickname ?? user.Username}#{user.Discriminator}", user.AvatarUrl);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user