Table of Contents

Interface IUserMessage

Namespace
Discord
Assembly
Discord.Net.Core.dll

Represents a generic message sent by a user.

public interface IUserMessage : IMessage, ISnowflakeEntity, IEntity<ulong>, IDeletable
Inherited Members
Extension Methods

Properties

InteractionMetadata

Gets the interaction metadata for the interaction this message is a response to.

IMessageInteractionMetadata InteractionMetadata { get; }

Property Value

IMessageInteractionMetadata

Remarks

Will be null if the message is not a response to an interaction.

ReferencedMessage

Gets the referenced message if it is a crosspost, channel follow add, pin, or reply message.

IUserMessage ReferencedMessage { get; }

Property Value

IUserMessage

The referenced message, if any is associated and still exists.

ResolvedData

Gets the resolved data if the message has components. null otherwise.

MessageResolvedData ResolvedData { get; }

Property Value

MessageResolvedData

Methods

CrosspostAsync(RequestOptions)

Publishes (crossposts) this message.

Task CrosspostAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous operation for publishing this message.

Remarks

warning

This call will throw an InvalidOperationException if attempted in a non-news channel.

This method will publish (crosspost) the message. Please note, publishing (crossposting), is only available in news channels.

ModifyAsync(Action<MessageProperties>, RequestOptions)

Modifies this message.

Task ModifyAsync(Action<MessageProperties> func, RequestOptions options = null)

Parameters

func Action<MessageProperties>

A delegate containing the properties to modify the message with.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous modification operation.

Examples

The following example replaces the content of the message with Hello World!.

await msg.ModifyAsync(x => x.Content = "Hello World!");

Remarks

This method modifies this message with the specified properties. To see an example of this method and what properties are available, please refer to MessageProperties.

PinAsync(RequestOptions)

Adds this message to its channel's pinned messages.

Task PinAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous operation for pinning this message.

Resolve(TagHandling, TagHandling, TagHandling, TagHandling, TagHandling)

Transforms this message's text into a human-readable form by resolving its tags.

string Resolve(TagHandling userHandling = TagHandling.Name, TagHandling channelHandling = TagHandling.Name, TagHandling roleHandling = TagHandling.Name, TagHandling everyoneHandling = TagHandling.Ignore, TagHandling emojiHandling = TagHandling.Name)

Parameters

userHandling TagHandling

Determines how the user tag should be handled.

channelHandling TagHandling

Determines how the channel tag should be handled.

roleHandling TagHandling

Determines how the role tag should be handled.

everyoneHandling TagHandling

Determines how the @everyone tag should be handled.

emojiHandling TagHandling

Determines how the emoji tag should be handled.

Returns

string

UnpinAsync(RequestOptions)

Removes this message from its channel's pinned messages.

Task UnpinAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous operation for unpinning this message.