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
ForwardedMessages
Gets a collection of partial messages that were forwarded with this message.
IReadOnlyCollection<MessageSnapshot> ForwardedMessages { get; }
Property Value
InteractionMetadata
Gets the interaction metadata for the interaction this message is a response to.
IMessageInteractionMetadata InteractionMetadata { get; }
Property Value
Remarks
Will be null if the message is not a response to an interaction.
Poll
Gets the poll sent with this message.
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.
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
Methods
CrosspostAsync(RequestOptions)
Publishes (crossposts) this message.
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.
EndPollAsync(RequestOptions)
Immediately ends the poll.
Task EndPollAsync(RequestOptions options)
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.
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.
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.
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.
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
UnpinAsync(RequestOptions)
Removes this message from its channel's pinned messages.
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.