Skip to content
Merged
Changes from 13 commits
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
61 changes: 59 additions & 2 deletions NetCord/Embed.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,81 @@
namespace NetCord;

/// <summary>
/// Displays embedded content such as an image or URL, alongside a title and various other fields. You can only have up to 10 embeds per message, and the total text of all embeds must be less than or equal to 6000 characters.
/// </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>
/// Information about the type of the embed.
/// </summary>
public EmbedType? Type => _jsonModel.Type;

/// <summary>
/// The part of the embed where the main text is contained, limited to 4096 characters.
/// </summary>
public string? Description => _jsonModel.Description;

/// <summary>
/// A link to an address of a webpage. When set, the <see cref="Title"/> becomes a clickable link, directing to the URL.
/// </summary>
public string? Url => _jsonModel.Url;

/// <summary>
/// Displays time in a format similar to a message timestamp. Located next to the footer.
/// </summary>
public DateTimeOffset? Timestamp => _jsonModel.Timestamp;

/// <summary>
/// The color of the embed’s border in an RGB format.
/// </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 image to include in the embed, displayed as a large-sized image located below the <see cref="Description"/> element.
/// </summary>
public EmbedImage? Image { get; }

/// <summary>
/// The thumbnail of the embed, displayed as a medium-sized image in the top right corner of the embed.
/// </summary>
public EmbedThumbnail? Thumbnail { get; }

/// <summary>
/// The video to include and display in the embed.
/// </summary>
public EmbedVideo? Video { get; }

/// <summary>
/// The provider of the embed content (YouTube, Twitter/X, etc), automatically generated from links in content.
/// </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 <see cref="Title"/> and <see cref="Description"/> blocks, maximum of 25 per embed.
/// </summary>
public IReadOnlyList<EmbedField> Fields { get; }


/// <summary>
/// Creates an embed from its <see cref="JsonModels.JsonEmbed"/> equivalent.
/// </summary>
public Embed(JsonModels.JsonEmbed jsonModel)
{
_jsonModel = jsonModel;
Expand Down