Class SocketUserMessage
Represents a WebSocket-based message sent by a user.
Assembly: Discord.Net.WebSocket.dll​
View Source​
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​
public override bool IsTTS { get; }
IsPinned​
Gets the value that indicates whether this message is pinned.
View Source​
public override bool IsPinned { get; }
IsSuppressed​
Gets the value that indicates whether or not this message's embeds are suppressed.
View Source​
public override bool IsSuppressed { get; }
EditedTimestamp​
Gets the time of this message's last edit.
View Source​
public override DateTimeOffset? EditedTimestamp { get; }
MentionedEveryone​
Gets the value that indicates whether this message mentioned everyone.
View Source​
public override bool MentionedEveryone { get; }
Attachments​
Returns all attachments included in this message.
View Source​
public override IReadOnlyCollection<Attachment> Attachments { get; }
Embeds​
Returns all embeds included in this message.
View Source​
public override IReadOnlyCollection<Embed> Embeds { get; }
Tags​
Gets all tags included in this message's content.
View Source​
public override IReadOnlyCollection<ITag> Tags { get; }
MentionedChannels​
Returns the channels mentioned in this message.
View Source​
public override IReadOnlyCollection<SocketGuildChannel> MentionedChannels { get; }
MentionedRoles​
Returns the roles mentioned in this message.
View Source​
public override IReadOnlyCollection<SocketRole> MentionedRoles { get; }
Stickers​
View Source​
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​
public IUserMessage ReferencedMessage { get; }
Methods​
ModifyAsync(Action<MessageProperties>, RequestOptions)​
Modifies this message.
View Source​
public Task ModifyAsync(Action<MessageProperties> func, RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous modification operation.
Parameters​
Type | Name | Description |
---|---|---|
System.Action<Discord.MessageProperties> | func | A delegate containing the properties to modify the message with. |
Discord.RequestOptions | options | The options to be used when sending the request. |
PinAsync(RequestOptions)​
Adds this message to its channel's pinned messages.
View Source​
public Task PinAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous operation for pinning this message.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
UnpinAsync(RequestOptions)​
Removes this message from its channel's pinned messages.
View Source​
public Task UnpinAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous operation for unpinning this message.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
Resolve(Int32, TagHandling, TagHandling, TagHandling, TagHandling, TagHandling)​
View Source​
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​
Type | Name |
---|---|
System.Int32 | startIndex |
Discord.TagHandling | userHandling |
Discord.TagHandling | channelHandling |
Discord.TagHandling | roleHandling |
Discord.TagHandling | everyoneHandling |
Discord.TagHandling | emojiHandling |
Resolve(TagHandling, TagHandling, TagHandling, TagHandling, TagHandling)​
Transforms this message's text into a human-readable form by resolving its tags.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.TagHandling | userHandling | Determines how the user tag should be handled. |
Discord.TagHandling | channelHandling | Determines how the channel tag should be handled. |
Discord.TagHandling | roleHandling | Determines how the role tag should be handled. |
Discord.TagHandling | everyoneHandling | Determines how the @everyone tag should be handled. |
Discord.TagHandling | emojiHandling | Determines how the emoji tag should be handled. |
CrosspostAsync(RequestOptions)​
Publishes (crossposts) this message.
View Source​
public async Task CrosspostAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous operation for publishing this message.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The 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@)