Skip to main content

Class SocketMessage

Represents a WebSocket-based message.

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

Properties​

Author​

Gets the author of this message.

View Source​
Declaration
public SocketUser Author { get; }

Channel​

Gets the source channel of the message.

View Source​
Declaration
public ISocketMessageChannel Channel { get; }

Source​

Gets the source type of this message.

View Source​
Declaration
public MessageSource Source { get; }

Content​

Gets the content for this message.

View Source​
Declaration
public string Content { get; }

CleanContent​

Gets the clean content for this message.

View Source​
Declaration
public string CleanContent { get; }

CreatedAt​

Gets when the snowflake was created.

View Source​
Declaration
public DateTimeOffset CreatedAt { get; }

IsTTS​

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

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

IsPinned​

Gets the value that indicates whether this message is pinned.

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

IsSuppressed​

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

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

EditedTimestamp​

Gets the time of this message's last edit.

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

MentionedEveryone​

Gets the value that indicates whether this message mentioned everyone.

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

Activity​

Gets the activity associated with a message.

View Source​
Declaration
public MessageActivity Activity { get; }

Application​

Gets the application associated with a message.

View Source​
Declaration
public MessageApplication Application { get; }

Reference​

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

View Source​
Declaration
public MessageReference Reference { get; }

Components​

View Source​
Declaration
public IReadOnlyCollection<ActionRowComponent> Components { get; }

Interaction​

Gets the interaction this message is a response to.

View Source​
Declaration
public MessageInteraction<SocketUser> Interaction { get; }

Flags​

Gets the flags related to this message.

View Source​
Declaration
public MessageFlags? Flags { get; }

Type​

Gets the type of this message.

View Source​
Declaration
public MessageType Type { get; }

Attachments​

Returns all attachments included in this message.

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

Embeds​

Returns all embeds included in this message.

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

MentionedChannels​

Returns the channels mentioned in this message.

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

MentionedRoles​

Returns the roles mentioned in this message.

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

Tags​

Gets all tags included in this message's content.

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

Stickers​

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

Reactions​

Gets all reactions included in this message.

View Source​
Declaration
public IReadOnlyDictionary<IEmote, ReactionMetadata> Reactions { get; }

MentionedUsers​

Returns the users mentioned in this message.

View Source​
Declaration
public IReadOnlyCollection<SocketUser> MentionedUsers { get; }

Timestamp​

Gets the time this message was sent.

View Source​
Declaration
public DateTimeOffset Timestamp { get; }

IMessage.Author​

Gets the author of this message.

View Source​
Declaration
IUser IMessage.Author { get; }

IMessage.Channel​

Gets the source channel of the message.

View Source​
Declaration
IMessageChannel IMessage.Channel { get; }

IMessage.Attachments​

Gets all attachments included in this message.

View Source​
Declaration
IReadOnlyCollection<IAttachment> IMessage.Attachments { get; }

IMessage.Embeds​

Gets all embeds included in this message.

View Source​
Declaration
IReadOnlyCollection<IEmbed> IMessage.Embeds { get; }

IMessage.MentionedChannelIds​

Gets the IDs of channels mentioned in this message.

View Source​
Declaration
IReadOnlyCollection<ulong> IMessage.MentionedChannelIds { get; }

IMessage.MentionedRoleIds​

Gets the IDs of roles mentioned in this message.

View Source​
Declaration
IReadOnlyCollection<ulong> IMessage.MentionedRoleIds { get; }

IMessage.MentionedUserIds​

Gets the IDs of users mentioned in this message.

View Source​
Declaration
IReadOnlyCollection<ulong> IMessage.MentionedUserIds { get; }

IMessage.Components​

The Discord.IMessageComponent's attached to this message

View Source​
Declaration
IReadOnlyCollection<IMessageComponent> IMessage.Components { get; }

IMessage.Interaction​

Gets the interaction this message is a response to.

View Source​
Declaration
IMessageInteraction IMessage.Interaction { get; }

IMessage.Stickers​

Gets all stickers items included in this message.

View Source​
Declaration
IReadOnlyCollection<IStickerItem> IMessage.Stickers { get; }

Methods​

DeleteAsync(RequestOptions)​

Deletes this object and all its children.

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

System.Threading.Tasks.Task

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

ToString()​

Gets the content of the message.

View Source​
Declaration
public override string ToString()
Returns​

System.String: Content of the message.

AddReactionAsync(IEmote, RequestOptions)​

Adds a reaction to this message.

View Source​
Declaration
public Task AddReactionAsync(IEmote emote, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous operation for adding a reaction to this message.

Parameters​
TypeNameDescription
Discord.IEmoteemoteThe emoji used to react to this message.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

RemoveReactionAsync(IEmote, IUser, RequestOptions)​

Removes a reaction from message.

View Source​
Declaration
public Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous operation for removing a reaction to this message.

Parameters​
TypeNameDescription
Discord.IEmoteemoteThe emoji used to react to this message.
Discord.IUseruserThe user that added the emoji.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

RemoveReactionAsync(IEmote, UInt64, RequestOptions)​

Removes a reaction from message.

View Source​
Declaration
public Task RemoveReactionAsync(IEmote emote, ulong userId, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous operation for removing a reaction to this message.

Parameters​
TypeNameDescription
Discord.IEmoteemoteThe emoji used to react to this message.
System.UInt64userIdThe ID of the user that added the emoji.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

RemoveAllReactionsAsync(RequestOptions)​

Removes all reactions from this message.

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

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

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

RemoveAllReactionsForEmoteAsync(IEmote, RequestOptions)​

Removes all reactions with a specific emoji from this message.

View Source​
Declaration
public Task RemoveAllReactionsForEmoteAsync(IEmote emote, RequestOptions options = null)
Returns​

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

Parameters​
TypeNameDescription
Discord.IEmoteemoteThe emoji used to react to this message.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

GetReactionUsersAsync(IEmote, Int32, RequestOptions)​

Gets all users that reacted to a message with a given emote.

View Source​
Declaration
public IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emote, int limit, RequestOptions options = null)
Returns​

System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<Discord.IUser>>: Paged collection of users.

Parameters​
TypeNameDescription
Discord.IEmoteemote
System.Int32limitThe number of users to request.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

Implements​