Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 45 additions & 3 deletions NetCord/Embed.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,66 @@
namespace NetCord;

/// <summary>
/// Displays embedded content such as an image or URL, alongside a title and various other fields. All text in the embed must add up to under 6000 characters, and you can only have up to 10 embed per message.
/// </summary>
public class Embed : IJsonModel<JsonModels.JsonEmbed>
{
JsonModels.JsonEmbed IJsonModel<JsonModels.JsonEmbed>.JsonModel => _jsonModel;
private readonly JsonModels.JsonEmbed _jsonModel;

/// <summary>
/// The text that is placed above the description, usually highlighted. Also directs to a URL if given, has a 256 character limit.
/// </summary>
public string? Title => _jsonModel.Title;
/// <summary>
/// The type of the embed, always set to <see cref="EmbedType.Rich"> for webhook embeds. </see>.
Comment thread
Red-K0 marked this conversation as resolved.
Outdated
/// </summary>
public EmbedType? Type => _jsonModel.Type;
/// <summary>
/// The part of the embed where most of the text is contained, limited to 4096 characters.
Comment thread
Red-K0 marked this conversation as resolved.
Outdated
/// </summary>
public string? Description => _jsonModel.Description;
/// <summary>
/// The link to the address of the webpage. Mostly used with the thumbnail, icon and author elements in order to link to an image.
Comment thread
Red-K0 marked this conversation as resolved.
Outdated
/// </summary>
public string? Url => _jsonModel.Url;
/// <summary>
/// Time that the embed was posted. Located next to the footer.
Comment thread
Red-K0 marked this conversation as resolved.
Outdated
/// </summary>
public DateTimeOffset? Timestamp => _jsonModel.Timestamp;
/// <summary>
/// Color of your embed’s border, usually in hexadecimal or decimal, specified by an integer between 0x000000 and 0xFFFFFF.
Comment thread
Red-K0 marked this conversation as resolved.
Outdated
/// </summary>
public Color? Color => _jsonModel.Color;
/// <summary>
/// Text at the bottom of the embed, limited to 2048 characters.
/// </summary>
public EmbedFooter? Footer { get; }
/// <summary>
/// The URL of the image, a large-sized image located below the "Description" element.
Comment thread
Red-K0 marked this conversation as resolved.
Outdated
/// </summary>
public EmbedImage? Image { get; }
/// <summary>
/// The URL of the thumbnail, a medium-sized image in the top right corner of the embed.
Comment thread
Red-K0 marked this conversation as resolved.
Outdated
/// </summary>
public EmbedThumbnail? Thumbnail { get; }
/// <summary>
/// The URL of the video to include in the embed.
Comment thread
Red-K0 marked this conversation as resolved.
Outdated
/// </summary>
public EmbedVideo? Video { get; }
/// <summary>
/// The provider of the embed content (YouTube, Twitter/X, etc). Generally unused in bot embeds.
Comment thread
Red-K0 marked this conversation as resolved.
Outdated
/// </summary>
public EmbedProvider? Provider { get; }
/// <summary>
/// Adds the author block to the embed, always located at the top of the embed.
Comment thread
KubaZ2 marked this conversation as resolved.
Outdated
/// </summary>
public EmbedAuthor? Author { get; }
/// <summary>
/// Allows you to add multiple subtitles with additional content underneath them below the main "Title" and "Description" blocks, maximum of 25 per embed.
Comment thread
Red-K0 marked this conversation as resolved.
Outdated
/// </summary>
public IReadOnlyList<EmbedField> Fields { get; }

/// <summary>
/// Creates an embed from its JsonModels equivalent.
Comment thread
Red-K0 marked this conversation as resolved.
Outdated
/// </summary>
public Embed(JsonModels.JsonEmbed jsonModel)
{
_jsonModel = jsonModel;
Expand Down