Skip to main content

Class SocketUserMessage

Represents a WebSocket-based message sent by a user.

Assembly: Discord.Net.WebSocket.dll​
View Source​
Declaration
public class SocketUserMessage : SocketMessage, IUserMessage, IMessage, ISnowflakeEntity, IEntity<ulong>, IDeletable

Properties​

IsTTS​

Gets the value that indicates whether this message was meant to be read-aloud by Discord.

View Source​
Declaration
public override bool IsTTS { get; }

IsPinned​

Gets the value that indicates whether this message is pinned.

View Source​
Declaration
public override bool IsPinned { get; }

IsSuppressed​

Gets the value that indicates whether or not this message's embeds are suppressed.

View Source​
Declaration
public override bool IsSuppressed { get; }

EditedTimestamp​

Gets the time of this message's last edit.

View Source​
Declaration
public override DateTimeOffset? EditedTimestamp { get; }

MentionedEveryone​

Gets the value that indicates whether this message mentioned everyone.

View Source​
Declaration
public override bool MentionedEveryone { get; }

Attachments​

Returns all attachments included in this message.

View Source​
Declaration
public override IReadOnlyCollection<Attachment> Attachments { get; }

Embeds​

Returns all embeds included in this message.

View Source​
Declaration
public override IReadOnlyCollection<Embed> Embeds { get; }

Tags​

Gets all tags included in this message's content.

View Source​
Declaration
public override IReadOnlyCollection<ITag> Tags { get; }

MentionedChannels​

Returns the channels mentioned in this message.

View Source​
Declaration
public override IReadOnlyCollection<SocketGuildChannel> MentionedChannels { get; }

MentionedRoles​

Returns the roles mentioned in this message.

View Source​
Declaration
public override IReadOnlyCollection<SocketRole> MentionedRoles { get; }

Stickers​

View Source​
Declaration
public override IReadOnlyCollection<SocketSticker> Stickers { get; }

ReferencedMessage​

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

View Source​
Declaration
public IUserMessage ReferencedMessage { get; }

Methods​

ModifyAsync(Action<MessageProperties>, RequestOptions)​

Modifies this message.

View Source​
Declaration
public Task ModifyAsync(Action<MessageProperties> func, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous modification operation.

Parameters​
TypeNameDescription
System.Action<Discord.MessageProperties>funcA delegate containing the properties to modify the message with.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

PinAsync(RequestOptions)​

Adds this message to its channel's pinned messages.

View Source​
Declaration
public Task PinAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous operation for pinning this message.

Parameters​
TypeNameDescription
Discord.RequestOptionsoptionsThe options to be used when sending the request.

UnpinAsync(RequestOptions)​

Removes this message from its channel's pinned messages.

View Source​
Declaration
public Task UnpinAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous operation for unpinning this message.

Parameters​
TypeNameDescription
Discord.RequestOptionsoptionsThe options to be used when sending the request.

Resolve(Int32, TagHandling, TagHandling, TagHandling, TagHandling, TagHandling)​

View Source​
Declaration
public string Resolve(int startIndex, TagHandling userHandling = TagHandling.Name, TagHandling channelHandling = TagHandling.Name, TagHandling roleHandling = TagHandling.Name, TagHandling everyoneHandling = TagHandling.Ignore, TagHandling emojiHandling = TagHandling.Name)
Returns​

System.String

Parameters​
TypeName
System.Int32startIndex
Discord.TagHandlinguserHandling
Discord.TagHandlingchannelHandling
Discord.TagHandlingroleHandling
Discord.TagHandlingeveryoneHandling
Discord.TagHandlingemojiHandling

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

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

View Source​
Declaration
public string Resolve(TagHandling userHandling = TagHandling.Name, TagHandling channelHandling = TagHandling.Name, TagHandling roleHandling = TagHandling.Name, TagHandling everyoneHandling = TagHandling.Ignore, TagHandling emojiHandling = TagHandling.Name)
Returns​

System.String

Parameters​
TypeNameDescription
Discord.TagHandlinguserHandlingDetermines how the user tag should be handled.
Discord.TagHandlingchannelHandlingDetermines how the channel tag should be handled.
Discord.TagHandlingroleHandlingDetermines how the role tag should be handled.
Discord.TagHandlingeveryoneHandlingDetermines how the @everyone tag should be handled.
Discord.TagHandlingemojiHandlingDetermines how the emoji tag should be handled.

CrosspostAsync(RequestOptions)​

Publishes (crossposts) this message.

View Source​
Declaration
public async Task CrosspostAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous operation for publishing this message.

Parameters​
TypeNameDescription
Discord.RequestOptionsoptionsThe options to be used when sending the request.

Implements​

Extension Methods​

  • Discord.IUserMessage.Discord.Commands.MessageExtensions.HasCharPrefix(System.Char,System.Int32@)
  • Discord.IUserMessage.Discord.Commands.MessageExtensions.HasStringPrefix(System.String,System.Int32@,System.StringComparison)
  • Discord.IUserMessage.Discord.Commands.MessageExtensions.HasMentionPrefix(Discord.IUser,System.Int32@)