Class RestUserMessage
Represents a REST-based message sent by a user.
public class RestUserMessage : RestMessage, IUpdateable, IUserMessage, IMessage, ISnowflakeEntity, IEntity<ulong>, IDeletable
- Inheritance
-
RestUserMessage
- Implements
- Derived
- Inherited Members
- Extension Methods
Properties
Attachments
Gets a collection of the Attachment's on the message.
public override IReadOnlyCollection<Attachment> Attachments { get; }
Property Value
EditedTimestamp
Gets the time of this message's last edit.
public override DateTimeOffset? EditedTimestamp { get; }
Property Value
- DateTimeOffset?
Time of when the message was last edited; null if the message is never edited.
Embeds
Gets a collection of the Embed's on the message.
public override IReadOnlyCollection<Embed> Embeds { get; }
Property Value
ForwardedMessages
Gets a collection of partial messages that were forwarded with this message.
public IReadOnlyCollection<MessageSnapshot> ForwardedMessages { get; }
Property Value
InteractionMetadata
Gets the interaction metadata for the interaction this message is a response to.
public IMessageInteractionMetadata InteractionMetadata { get; }
Property Value
Remarks
Will be null if the message is not a response to an interaction.
IsPinned
Gets the value that indicates whether this message is pinned.
public override bool IsPinned { get; }
Property Value
IsSuppressed
Gets the value that indicates whether or not this message's embeds are suppressed.
public override bool IsSuppressed { get; }
Property Value
IsTTS
Gets the value that indicates whether this message was meant to be read-aloud by Discord.
public override bool IsTTS { get; }
Property Value
MentionedChannelIds
Gets the IDs of channels mentioned in this message.
public override IReadOnlyCollection<ulong> MentionedChannelIds { get; }
Property Value
- IReadOnlyCollection<ulong>
A read-only collection of channel IDs.
MentionedEveryone
Gets the value that indicates whether this message mentioned everyone.
public override bool MentionedEveryone { get; }
Property Value
MentionedRoleIds
Gets the IDs of roles mentioned in this message.
public override IReadOnlyCollection<ulong> MentionedRoleIds { get; }
Property Value
- IReadOnlyCollection<ulong>
A read-only collection of role IDs.
Poll
Gets the poll sent with this message.
public Poll? Poll { get; }
Property Value
- Poll?
Remarks
Will be null if the message has no poll.
ReferencedMessage
Gets the referenced message if it is a crosspost, channel follow add, pin, or reply message.
public 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.
public MessageResolvedData ResolvedData { get; }
Property Value
Stickers
public override IReadOnlyCollection<StickerItem> Stickers { get; }
Property Value
Tags
Gets all tags included in this message's content.
public override IReadOnlyCollection<ITag> Tags { get; }
Property Value
Methods
CrosspostAsync(RequestOptions)
Publishes (crossposts) this message.
public Task CrosspostAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe 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.
Exceptions
- InvalidOperationException
This operation may only be called on a INewsChannel channel.
EndPollAsync(RequestOptions)
Immediately ends the poll.
public Task EndPollAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
Remarks
You cannot end polls from other users.
GetPollAnswerVotersAsync(uint, int?, ulong?, RequestOptions)
Get users that voted for this specific answer.
public IAsyncEnumerable<IReadOnlyCollection<IUser>> GetPollAnswerVotersAsync(uint answerId, int? limit = null, ulong? afterId = null, RequestOptions options = null)
Parameters
answerId
uintThe id on the answer to fetch voters for
limit
int?The number of users to request.
afterId
ulong?The id of a user to start after.
options
RequestOptionsThe options to be used when sending the request.
Returns
ModifyAsync(Action<MessageProperties>, RequestOptions)
Modifies this message.
public Task ModifyAsync(Action<MessageProperties> func, RequestOptions options = null)
Parameters
func
Action<MessageProperties>A delegate containing the properties to modify the message with.
options
RequestOptionsThe 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.
public Task PinAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe 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.
public string Resolve(TagHandling userHandling = TagHandling.Name, TagHandling channelHandling = TagHandling.Name, TagHandling roleHandling = TagHandling.Name, TagHandling everyoneHandling = TagHandling.Ignore, TagHandling emojiHandling = TagHandling.Name)
Parameters
userHandling
TagHandlingDetermines how the user tag should be handled.
channelHandling
TagHandlingDetermines how the channel tag should be handled.
roleHandling
TagHandlingDetermines how the role tag should be handled.
everyoneHandling
TagHandlingDetermines how the @everyone tag should be handled.
emojiHandling
TagHandlingDetermines how the emoji tag should be handled.
Returns
Resolve(int, TagHandling, TagHandling, TagHandling, TagHandling, TagHandling)
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
startIndex
intuserHandling
TagHandlingchannelHandling
TagHandlingroleHandling
TagHandlingeveryoneHandling
TagHandlingemojiHandling
TagHandling
Returns
UnpinAsync(RequestOptions)
Removes this message from its channel's pinned messages.
public Task UnpinAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous operation for unpinning this message.