Class SocketMessage
Represents a WebSocket-based message.
Assembly: Discord.Net.WebSocket.dll​
View Source​
public abstract class SocketMessage : SocketEntity<ulong>, IMessage, ISnowflakeEntity, IEntity<ulong>, IDeletable
Properties​
Author​
Gets the author of this message.
View Source​
public SocketUser Author { get; }
Channel​
Gets the source channel of the message.
View Source​
public ISocketMessageChannel Channel { get; }
Source​
Gets the source type of this message.
View Source​
public MessageSource Source { get; }
Content​
Gets the content for this message.
View Source​
public string Content { get; }
CleanContent​
Gets the clean content for this message.
View Source​
public string CleanContent { get; }
CreatedAt​
Gets when the snowflake was created.
View Source​
public DateTimeOffset CreatedAt { get; }
IsTTS​
Gets the value that indicates whether this message was meant to be read-aloud by Discord.
View Source​
public virtual bool IsTTS { get; }
IsPinned​
Gets the value that indicates whether this message is pinned.
View Source​
public virtual bool IsPinned { get; }
IsSuppressed​
Gets the value that indicates whether or not this message's embeds are suppressed.
View Source​
public virtual bool IsSuppressed { get; }
EditedTimestamp​
Gets the time of this message's last edit.
View Source​
public virtual DateTimeOffset? EditedTimestamp { get; }
MentionedEveryone​
Gets the value that indicates whether this message mentioned everyone.
View Source​
public virtual bool MentionedEveryone { get; }
Activity​
Gets the activity associated with a message.
View Source​
public MessageActivity Activity { get; }
Application​
Gets the application associated with a message.
View Source​
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​
public MessageReference Reference { get; }
Components​
View Source​
public IReadOnlyCollection<ActionRowComponent> Components { get; }
Interaction​
Gets the interaction this message is a response to.
View Source​
public MessageInteraction<SocketUser> Interaction { get; }
Flags​
Gets the flags related to this message.
View Source​
public MessageFlags? Flags { get; }
Type​
Gets the type of this message.
View Source​
public MessageType Type { get; }
Attachments​
Returns all attachments included in this message.
View Source​
public virtual IReadOnlyCollection<Attachment> Attachments { get; }
Embeds​
Returns all embeds included in this message.
View Source​
public virtual IReadOnlyCollection<Embed> Embeds { get; }
MentionedChannels​
Returns the channels mentioned in this message.
View Source​
public virtual IReadOnlyCollection<SocketGuildChannel> MentionedChannels { get; }
MentionedRoles​
Returns the roles mentioned in this message.
View Source​
public virtual IReadOnlyCollection<SocketRole> MentionedRoles { get; }
Tags​
Gets all tags included in this message's content.
View Source​
public virtual IReadOnlyCollection<ITag> Tags { get; }
Stickers​
View Source​
public virtual IReadOnlyCollection<SocketSticker> Stickers { get; }
Reactions​
Gets all reactions included in this message.
View Source​
public IReadOnlyDictionary<IEmote, ReactionMetadata> Reactions { get; }
MentionedUsers​
Returns the users mentioned in this message.
View Source​
public IReadOnlyCollection<SocketUser> MentionedUsers { get; }
Timestamp​
Gets the time this message was sent.
View Source​
public DateTimeOffset Timestamp { get; }
IMessage.Author​
Gets the author of this message.
View Source​
IUser IMessage.Author { get; }
IMessage.Channel​
Gets the source channel of the message.
View Source​
IMessageChannel IMessage.Channel { get; }
IMessage.Attachments​
Gets all attachments included in this message.
View Source​
IReadOnlyCollection<IAttachment> IMessage.Attachments { get; }
IMessage.Embeds​
Gets all embeds included in this message.
View Source​
IReadOnlyCollection<IEmbed> IMessage.Embeds { get; }
IMessage.MentionedChannelIds​
Gets the IDs of channels mentioned in this message.
View Source​
IReadOnlyCollection<ulong> IMessage.MentionedChannelIds { get; }
IMessage.MentionedRoleIds​
Gets the IDs of roles mentioned in this message.
View Source​
IReadOnlyCollection<ulong> IMessage.MentionedRoleIds { get; }
IMessage.MentionedUserIds​
Gets the IDs of users mentioned in this message.
View Source​
IReadOnlyCollection<ulong> IMessage.MentionedUserIds { get; }
IMessage.Components​
The Discord.IMessageComponent's attached to this message
View Source​
IReadOnlyCollection<IMessageComponent> IMessage.Components { get; }
IMessage.Interaction​
Gets the interaction this message is a response to.
View Source​
IMessageInteraction IMessage.Interaction { get; }
IMessage.Stickers​
Gets all stickers items included in this message.
View Source​
IReadOnlyCollection<IStickerItem> IMessage.Stickers { get; }
Methods​
DeleteAsync(RequestOptions)​
Deletes this object and all its children.
View Source​
public Task DeleteAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
ToString()​
Gets the content of the message.
View Source​
public override string ToString()
Returns​
System.String
:
Content of the message.
AddReactionAsync(IEmote, RequestOptions)​
Adds a reaction to this message.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.IEmote | emote | The emoji used to react to this message. |
Discord.RequestOptions | options | The options to be used when sending the request. |
RemoveReactionAsync(IEmote, IUser, RequestOptions)​
Removes a reaction from message.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.IEmote | emote | The emoji used to react to this message. |
Discord.IUser | user | The user that added the emoji. |
Discord.RequestOptions | options | The options to be used when sending the request. |
RemoveReactionAsync(IEmote, UInt64, RequestOptions)​
Removes a reaction from message.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.IEmote | emote | The emoji used to react to this message. |
System.UInt64 | userId | The ID of the user that added the emoji. |
Discord.RequestOptions | options | The options to be used when sending the request. |
RemoveAllReactionsAsync(RequestOptions)​
Removes all reactions from this message.
View Source​
public Task RemoveAllReactionsAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous removal operation.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
RemoveAllReactionsForEmoteAsync(IEmote, RequestOptions)​
Removes all reactions with a specific emoji from this message.
View Source​
public Task RemoveAllReactionsForEmoteAsync(IEmote emote, RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous removal operation.
Parameters​
Type | Name | Description |
---|---|---|
Discord.IEmote | emote | The emoji used to react to this message. |
Discord.RequestOptions | options | The 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​
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​
Type | Name | Description |
---|---|---|
Discord.IEmote | emote | |
System.Int32 | limit | The number of users to request. |
Discord.RequestOptions | options | The options to be used when sending the request. |