Add embed builder, some more ported classes

This commit is contained in:
Ske
2020-12-23 02:19:02 +01:00
parent 05334f0d25
commit f6fb8204bb
13 changed files with 305 additions and 189 deletions

View File

@@ -0,0 +1,86 @@
using System.Collections.Generic;
using Myriad.Types;
namespace Myriad.Builders
{
public class EmbedBuilder
{
private Embed _embed = new();
private readonly List<Embed.Field> _fields = new();
public EmbedBuilder Title(string? title)
{
_embed = _embed with {Title = title};
return this;
}
public EmbedBuilder Description(string? description)
{
_embed = _embed with { Description = description};
return this;
}
public EmbedBuilder Url(string? url)
{
_embed = _embed with {Url = url};
return this;
}
public EmbedBuilder Color(uint? color)
{
_embed = _embed with {Color = color};
return this;
}
public EmbedBuilder Footer(Embed.EmbedFooter? footer)
{
_embed = _embed with {
Footer = footer
};
return this;
}
public EmbedBuilder Image(Embed.EmbedImage? image)
{
_embed = _embed with {
Image = image
};
return this;
}
public EmbedBuilder Thumbnail(Embed.EmbedThumbnail? thumbnail)
{
_embed = _embed with {
Thumbnail = thumbnail
};
return this;
}
public EmbedBuilder Author(Embed.EmbedAuthor? author)
{
_embed = _embed with {
Author = author
};
return this;
}
public EmbedBuilder Timestamp(string? timestamp)
{
_embed = _embed with {
Timestamp = timestamp
};
return this;
}
public EmbedBuilder Field(Embed.Field field)
{
_fields.Add(field);
return this;
}
public Embed Build() =>
_embed with { Fields = _fields.ToArray() };
}
}