Table of Contents

Class WebhookMessageProperties

Namespace
NetCord.Rest
Assembly
NetCord.dll

A specialized message object, for use with executing webhooks.

public class WebhookMessageProperties : IHttpSerializable, IMessageProperties
Inheritance
WebhookMessageProperties
Implements
Inherited Members

Constructors

WebhookMessageProperties()

public WebhookMessageProperties()

Properties

AllowedMentions

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

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

Property Value

AllowedMentionsProperties

AppliedTags

When set, represents the tag IDs to apply to the created thread (via ThreadName).

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[JsonPropertyName("applied_tags")]
public IEnumerable<ulong>? AppliedTags { get; set; }

Property Value

IEnumerable<ulong>

Remarks

Requires the webhook channel to be a ForumGuildChannel or MediaForumGuildChannel.

Attachments

A list of attachments to include in the message.

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

Property Value

IEnumerable<AttachmentProperties>

AvatarUrl

Overrides the default avatar of the webhook.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[JsonPropertyName("avatar_url")]
public string? AvatarUrl { get; set; }

Property Value

string

Components

A list of components to include in the message.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[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.WhenWritingDefault)]
[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.WhenWritingDefault)]
[JsonPropertyName("embeds")]
public IEnumerable<EmbedProperties>? Embeds { get; set; }

Property Value

IEnumerable<EmbedProperties>

Flags

Includes additional information about the message's state.

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

Property Value

MessageFlags?

Poll

When set, creates a poll with the specified configuration.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[JsonPropertyName("poll")]
public MessagePollProperties? Poll { get; set; }

Property Value

MessagePollProperties

ThreadName

When set, creates a thread with the specified name.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[JsonPropertyName("thread_name")]
public string? ThreadName { get; set; }

Property Value

string

Remarks

Requires the webhook channel to be a ForumGuildChannel or MediaForumGuildChannel.

Tts

Whether the message is a Text-To-Speech message.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[JsonPropertyName("tts")]
public bool Tts { get; set; }

Property Value

bool

Username

Overrides the default username of the webhook.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[JsonPropertyName("username")]
public string? Username { get; set; }

Property Value

string

Remarks

Must follow the rules set for Name.

Methods

AddAppliedTags(params IEnumerable<ulong>)

When set, represents the tag IDs to apply to the created thread (via ThreadName).

public WebhookMessageProperties AddAppliedTags(params IEnumerable<ulong> appliedTags)

Parameters

appliedTags IEnumerable<ulong>

Returns

WebhookMessageProperties

Remarks

Requires the webhook channel to be a ForumGuildChannel or MediaForumGuildChannel.

AddAttachments(params IEnumerable<AttachmentProperties>)

A list of attachments to include in the message.

public WebhookMessageProperties AddAttachments(params IEnumerable<AttachmentProperties> attachments)

Parameters

attachments IEnumerable<AttachmentProperties>

Returns

WebhookMessageProperties

AddComponents(params IEnumerable<IMessageComponentProperties>)

A list of components to include in the message.

public WebhookMessageProperties AddComponents(params IEnumerable<IMessageComponentProperties> components)

Parameters

components IEnumerable<IMessageComponentProperties>

Returns

WebhookMessageProperties

AddEmbeds(params IEnumerable<EmbedProperties>)

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

public WebhookMessageProperties AddEmbeds(params IEnumerable<EmbedProperties> embeds)

Parameters

embeds IEnumerable<EmbedProperties>

Returns

WebhookMessageProperties

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 WebhookMessageProperties WithAllowedMentions(AllowedMentionsProperties? allowedMentions)

Parameters

allowedMentions AllowedMentionsProperties

Returns

WebhookMessageProperties

WithAppliedTags(IEnumerable<ulong>?)

When set, represents the tag IDs to apply to the created thread (via ThreadName).

public WebhookMessageProperties WithAppliedTags(IEnumerable<ulong>? appliedTags)

Parameters

appliedTags IEnumerable<ulong>

Returns

WebhookMessageProperties

Remarks

Requires the webhook channel to be a ForumGuildChannel or MediaForumGuildChannel.

WithAttachments(IEnumerable<AttachmentProperties>?)

A list of attachments to include in the message.

public WebhookMessageProperties WithAttachments(IEnumerable<AttachmentProperties>? attachments)

Parameters

attachments IEnumerable<AttachmentProperties>

Returns

WebhookMessageProperties

WithAvatarUrl(string?)

Overrides the default avatar of the webhook.

public WebhookMessageProperties WithAvatarUrl(string? avatarUrl)

Parameters

avatarUrl string

Returns

WebhookMessageProperties

WithComponents(IEnumerable<IMessageComponentProperties>?)

A list of components to include in the message.

public WebhookMessageProperties WithComponents(IEnumerable<IMessageComponentProperties>? components)

Parameters

components IEnumerable<IMessageComponentProperties>

Returns

WebhookMessageProperties

WithContent(string?)

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

public WebhookMessageProperties WithContent(string? content)

Parameters

content string

Returns

WebhookMessageProperties

WithEmbeds(IEnumerable<EmbedProperties>?)

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

public WebhookMessageProperties WithEmbeds(IEnumerable<EmbedProperties>? embeds)

Parameters

embeds IEnumerable<EmbedProperties>

Returns

WebhookMessageProperties

WithFlags(MessageFlags?)

Includes additional information about the message's state.

public WebhookMessageProperties WithFlags(MessageFlags? flags)

Parameters

flags MessageFlags?

Returns

WebhookMessageProperties

WithPoll(MessagePollProperties?)

When set, creates a poll with the specified configuration.

public WebhookMessageProperties WithPoll(MessagePollProperties? poll)

Parameters

poll MessagePollProperties

Returns

WebhookMessageProperties

WithThreadName(string?)

When set, creates a thread with the specified name.

public WebhookMessageProperties WithThreadName(string? threadName)

Parameters

threadName string

Returns

WebhookMessageProperties

Remarks

Requires the webhook channel to be a ForumGuildChannel or MediaForumGuildChannel.

WithTts(bool)

Whether the message is a Text-To-Speech message.

public WebhookMessageProperties WithTts(bool tts = true)

Parameters

tts bool

Returns

WebhookMessageProperties

WithUsername(string?)

Overrides the default username of the webhook.

public WebhookMessageProperties WithUsername(string? username)

Parameters

username string

Returns

WebhookMessageProperties

Remarks

Must follow the rules set for Name.

Operators

implicit operator WebhookMessageProperties(string)

public static implicit operator WebhookMessageProperties(string content)

Parameters

content string

Returns

WebhookMessageProperties