Class SocketUserMessage
Represents a WebSocket-based message sent by a user.
Inherited Members
Namespace: Discord.WebSocket
Assembly: Discord.Net.WebSocket.dll
Syntax
public class SocketUserMessage : SocketMessage, IUserMessage, IMessage, ISnowflakeEntity, IEntity<ulong>, IDeletable
Properties
| Improve this Doc View SourceAttachments
Returns all attachments included in this message.
Declaration
public override IReadOnlyCollection<Attachment> Attachments { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<Attachment> | Collection of attachments. |
Overrides
| Improve this Doc View SourceEditedTimestamp
Gets the time of this message's last edit.
Declaration
public override DateTimeOffset? EditedTimestamp { get; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<System.DateTimeOffset> | Time of when the message was last edited; |
Overrides
| Improve this Doc View SourceEmbeds
Returns all embeds included in this message.
Declaration
public override IReadOnlyCollection<Embed> Embeds { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<Embed> | Collection of embed objects. |
Overrides
| Improve this Doc View SourceIsPinned
Gets the value that indicates whether this message is pinned.
Declaration
public override bool IsPinned { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Overrides
| Improve this Doc View SourceIsSuppressed
Gets the value that indicates whether or not this message's embeds are suppressed.
Declaration
public override bool IsSuppressed { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Overrides
| Improve this Doc View SourceIsTTS
Gets the value that indicates whether this message was meant to be read-aloud by Discord.
Declaration
public override bool IsTTS { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Overrides
| Improve this Doc View SourceMentionedChannels
Returns the channels mentioned in this message.
Declaration
public override IReadOnlyCollection<SocketGuildChannel> MentionedChannels { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<SocketGuildChannel> | Collection of WebSocket-based guild channels. |
Overrides
| Improve this Doc View SourceMentionedRoles
Returns the roles mentioned in this message.
Declaration
public override IReadOnlyCollection<SocketRole> MentionedRoles { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<SocketRole> | Collection of WebSocket-based roles. |
Overrides
| Improve this Doc View SourceMentionedUsers
Returns the users mentioned in this message.
Declaration
public override IReadOnlyCollection<SocketUser> MentionedUsers { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<SocketUser> | Collection of WebSocket-based users. |
Overrides
| Improve this Doc View SourceTags
Gets all tags included in this message's content.
Declaration
public override IReadOnlyCollection<ITag> Tags { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<ITag> |
Overrides
Methods
| Improve this Doc View SourceModifyAsync(Action<MessageProperties>, RequestOptions)
Modifies this message.
Declaration
public Task ModifyAsync(Action<MessageProperties> func, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Action<MessageProperties> | func | A delegate containing the properties to modify the message with. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task that represents the asynchronous modification operation. |
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.
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | Only the author of a message may modify the message. |
| System.ArgumentOutOfRangeException | Message content is too long, length must be less or equal to MaxMessageSize. |
ModifySuppressionAsync(Boolean, RequestOptions)
Modifies the suppression of this message.
Declaration
public Task ModifySuppressionAsync(bool suppressEmbeds, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | suppressEmbeds | Whether or not embeds in this message should be suppressed. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task that represents the asynchronous modification operation. |
Remarks
This method modifies whether or not embeds in this message are suppressed (hidden).
PinAsync(RequestOptions)
Adds this message to its channel's pinned messages.
Declaration
public Task PinAsync(RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.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.
Declaration
public string Resolve(TagHandling userHandling = TagHandling.Name, TagHandling channelHandling = TagHandling.Name, TagHandling roleHandling = TagHandling.Name, TagHandling everyoneHandling = TagHandling.Ignore, TagHandling emojiHandling = TagHandling.Name)
Parameters
| Type | Name | Description |
|---|---|---|
| TagHandling | userHandling | Determines how the user tag should be handled. |
| TagHandling | channelHandling | Determines how the channel tag should be handled. |
| TagHandling | roleHandling | Determines how the role tag should be handled. |
| TagHandling | everyoneHandling | Determines how the @everyone tag should be handled. |
| TagHandling | emojiHandling | Determines how the emoji tag should be handled. |
Returns
| Type | Description |
|---|---|
| System.String |
Resolve(Int32, TagHandling, TagHandling, TagHandling, TagHandling, TagHandling)
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)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | startIndex | |
| TagHandling | userHandling | |
| TagHandling | channelHandling | |
| TagHandling | roleHandling | |
| TagHandling | everyoneHandling | |
| TagHandling | emojiHandling |
Returns
| Type | Description |
|---|---|
| System.String |
UnpinAsync(RequestOptions)
Removes this message from its channel's pinned messages.
Declaration
public Task UnpinAsync(RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task that represents the asynchronous operation for unpinning this message. |