Table of Contents

Class MessageOptions

Namespace
NetCord.Rest
Assembly
NetCord.dll

Represents a modification to apply to a message.

public class MessageOptions : IHttpSerializable
Inheritance
MessageOptions
Implements
Inherited Members

Properties

AllowedMentions

Defines which users and roles the message is allowed to mention.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("allowed_mentions")]
public AllowedMentionsProperties? AllowedMentions { get; set; }

Property Value

AllowedMentionsProperties

Attachments

A list of attachments to include in the message.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonConverter(typeof(AttachmentPropertiesIEnumerableConverter))]
[JsonPropertyName("attachments")]
public IEnumerable<AttachmentProperties>? Attachments { get; set; }

Property Value

IEnumerable<AttachmentProperties>

Components

A list of components to include in the message.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("components")]
public IEnumerable<IMessageComponentProperties>? Components { get; set; }

Property Value

IEnumerable<IMessageComponentProperties>

Content

The text contents of a message, limited to 2000 characters. This limit is raised to 4000 characters for Discord Nitro subscribers.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("content")]
public string? Content { get; set; }

Property Value

string

Embeds

A list of up to 10 embeds to include, totalling up to 6000 characters.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("embeds")]
public IEnumerable<EmbedProperties>? Embeds { get; set; }

Property Value

IEnumerable<EmbedProperties>

Flags

Includes additional information about the message's state.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("flags")]
public MessageFlags? Flags { get; set; }

Property Value

MessageFlags?

Methods

AddAttachments(params IEnumerable<AttachmentProperties>)

A list of attachments to include in the message.

public MessageOptions AddAttachments(params IEnumerable<AttachmentProperties> attachments)

Parameters

attachments IEnumerable<AttachmentProperties>

Returns

MessageOptions

AddComponents(params IEnumerable<IMessageComponentProperties>)

A list of components to include in the message.

public MessageOptions AddComponents(params IEnumerable<IMessageComponentProperties> components)

Parameters

components IEnumerable<IMessageComponentProperties>

Returns

MessageOptions

AddEmbeds(params IEnumerable<EmbedProperties>)

A list of up to 10 embeds to include, totalling up to 6000 characters.

public MessageOptions AddEmbeds(params IEnumerable<EmbedProperties> embeds)

Parameters

embeds IEnumerable<EmbedProperties>

Returns

MessageOptions

Serialize()

Serializes the object or its part into HttpContent.

public HttpContent Serialize()

Returns

HttpContent

WithAllowedMentions(AllowedMentionsProperties?)

Defines which users and roles the message is allowed to mention.

public MessageOptions WithAllowedMentions(AllowedMentionsProperties? allowedMentions)

Parameters

allowedMentions AllowedMentionsProperties

Returns

MessageOptions

WithAttachments(IEnumerable<AttachmentProperties>?)

A list of attachments to include in the message.

public MessageOptions WithAttachments(IEnumerable<AttachmentProperties>? attachments)

Parameters

attachments IEnumerable<AttachmentProperties>

Returns

MessageOptions

WithComponents(IEnumerable<IMessageComponentProperties>?)

A list of components to include in the message.

public MessageOptions WithComponents(IEnumerable<IMessageComponentProperties>? components)

Parameters

components IEnumerable<IMessageComponentProperties>

Returns

MessageOptions

WithContent(string?)

The text contents of a message, limited to 2000 characters. This limit is raised to 4000 characters for Discord Nitro subscribers.

public MessageOptions WithContent(string? content)

Parameters

content string

Returns

MessageOptions

WithEmbeds(IEnumerable<EmbedProperties>?)

A list of up to 10 embeds to include, totalling up to 6000 characters.

public MessageOptions WithEmbeds(IEnumerable<EmbedProperties>? embeds)

Parameters

embeds IEnumerable<EmbedProperties>

Returns

MessageOptions

WithFlags(MessageFlags?)

Includes additional information about the message's state.

public MessageOptions WithFlags(MessageFlags? flags)

Parameters

flags MessageFlags?

Returns

MessageOptions