2020-12-23 01:19:02 +00:00
|
|
|
using Myriad.Types;
|
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
namespace Myriad.Builders;
|
2020-12-23 01:19:02 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public class EmbedBuilder
|
|
|
|
{
|
|
|
|
private readonly List<Embed.Field> _fields = new();
|
|
|
|
private Embed _embed = new();
|
2020-12-23 01:19:02 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public EmbedBuilder Title(string? title)
|
|
|
|
{
|
|
|
|
_embed = _embed with { Title = title };
|
|
|
|
return this;
|
|
|
|
}
|
2020-12-23 01:19:02 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public EmbedBuilder Description(string? description)
|
|
|
|
{
|
|
|
|
_embed = _embed with { Description = description };
|
|
|
|
return this;
|
|
|
|
}
|
2020-12-23 01:19:02 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public EmbedBuilder Url(string? url)
|
|
|
|
{
|
|
|
|
_embed = _embed with { Url = url };
|
|
|
|
return this;
|
|
|
|
}
|
2020-12-23 01:19:02 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public EmbedBuilder Color(uint? color)
|
|
|
|
{
|
|
|
|
_embed = _embed with { Color = color };
|
|
|
|
return this;
|
|
|
|
}
|
2020-12-23 01:19:02 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public EmbedBuilder Footer(Embed.EmbedFooter? footer)
|
|
|
|
{
|
|
|
|
_embed = _embed with { Footer = footer };
|
|
|
|
return this;
|
|
|
|
}
|
2020-12-23 01:19:02 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public EmbedBuilder Image(Embed.EmbedImage? image)
|
|
|
|
{
|
|
|
|
_embed = _embed with { Image = image };
|
|
|
|
return this;
|
|
|
|
}
|
2020-12-23 01:19:02 +00:00
|
|
|
|
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public EmbedBuilder Thumbnail(Embed.EmbedThumbnail? thumbnail)
|
|
|
|
{
|
|
|
|
_embed = _embed with { Thumbnail = thumbnail };
|
|
|
|
return this;
|
|
|
|
}
|
2020-12-23 01:19:02 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public EmbedBuilder Author(Embed.EmbedAuthor? author)
|
|
|
|
{
|
|
|
|
_embed = _embed with { Author = author };
|
|
|
|
return this;
|
|
|
|
}
|
2020-12-23 01:19:02 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public EmbedBuilder Timestamp(string? timestamp)
|
|
|
|
{
|
|
|
|
_embed = _embed with { Timestamp = timestamp };
|
|
|
|
return this;
|
|
|
|
}
|
2020-12-23 01:19:02 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public EmbedBuilder Field(Embed.Field field)
|
|
|
|
{
|
|
|
|
_fields.Add(field);
|
|
|
|
return this;
|
2020-12-23 01:19:02 +00:00
|
|
|
}
|
2021-11-27 02:10:56 +00:00
|
|
|
|
|
|
|
public Embed Build() =>
|
|
|
|
_embed with { Fields = _fields.ToArray() };
|
2020-12-23 01:19:02 +00:00
|
|
|
}
|