Show / Hide Table of Contents

Class SocketMessage

Represents a WebSocket-based message.

Inheritance
System.Object
SocketEntity<System.UInt64>
SocketMessage
SocketSystemMessage
SocketUserMessage
Implements
IMessage
ISnowflakeEntity
IEntity<System.UInt64>
IDeletable
Inherited Members
SocketEntity<UInt64>.Id
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Discord.WebSocket
Assembly: Discord.Net.WebSocket.dll
Syntax
public abstract class SocketMessage : SocketEntity<ulong>, IMessage, ISnowflakeEntity, IEntity<ulong>, IDeletable

Properties

| Improve this Doc View Source

Activity

Gets the activity associated with a message.

Declaration
public MessageActivity Activity { get; }
Property Value
Type Description
MessageActivity

A message's activity, if any is associated.

Remarks

Sent with Rich Presence-related chat embeds. This often refers to activity that requires end-user's interaction, such as a Spotify Invite activity.

| Improve this Doc View Source

Application

Gets the application associated with a message.

Declaration
public MessageApplication Application { get; }
Property Value
Type Description
MessageApplication

A message's application, if any is associated.

Remarks

Sent with Rich-Presence-related chat embeds.

| Improve this Doc View Source

Attachments

Returns all attachments included in this message.

Declaration
public virtual IReadOnlyCollection<Attachment> Attachments { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyCollection<Attachment>

Collection of attachments.

| Improve this Doc View Source

Author

Gets the author of this message.

Declaration
public SocketUser Author { get; }
Property Value
Type Description
SocketUser

A WebSocket-based user object.

| Improve this Doc View Source

Channel

Gets the source channel of the message.

Declaration
public ISocketMessageChannel Channel { get; }
Property Value
Type Description
ISocketMessageChannel

A WebSocket-based message channel.

| Improve this Doc View Source

Content

Gets the content for this message.

Declaration
public string Content { get; }
Property Value
Type Description
System.String

A string that contains the body of the message; note that this field may be empty if there is an embed.

| Improve this Doc View Source

CreatedAt

Gets when the snowflake was created.

Declaration
public DateTimeOffset CreatedAt { get; }
Property Value
Type Description
System.DateTimeOffset

A System.DateTimeOffset representing when the entity was first created.

| Improve this Doc View Source

EditedTimestamp

Gets the time of this message's last edit.

Declaration
public virtual DateTimeOffset? EditedTimestamp { get; }
Property Value
Type Description
System.Nullable<System.DateTimeOffset>

Time of when the message was last edited; null if the message is never edited.

| Improve this Doc View Source

Embeds

Returns all embeds included in this message.

Declaration
public virtual IReadOnlyCollection<Embed> Embeds { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyCollection<Embed>

Collection of embed objects.

| Improve this Doc View Source

IsPinned

Gets the value that indicates whether this message is pinned.

Declaration
public virtual bool IsPinned { get; }
Property Value
Type Description
System.Boolean

true if this message was added to its channel's pinned messages; otherwise false.

| Improve this Doc View Source

IsSuppressed

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

Declaration
public virtual bool IsSuppressed { get; }
Property Value
Type Description
System.Boolean

true if the embeds in this message have been suppressed (made invisible); otherwise false.

| Improve this Doc View Source

IsTTS

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

Declaration
public virtual bool IsTTS { get; }
Property Value
Type Description
System.Boolean

true if this message was sent as a text-to-speech message; otherwise false.

| Improve this Doc View Source

MentionedChannels

Returns the channels mentioned in this message.

Declaration
public virtual IReadOnlyCollection<SocketGuildChannel> MentionedChannels { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyCollection<SocketGuildChannel>

Collection of WebSocket-based guild channels.

| Improve this Doc View Source

MentionedRoles

Returns the roles mentioned in this message.

Declaration
public virtual IReadOnlyCollection<SocketRole> MentionedRoles { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyCollection<SocketRole>

Collection of WebSocket-based roles.

| Improve this Doc View Source

MentionedUsers

Returns the users mentioned in this message.

Declaration
public virtual IReadOnlyCollection<SocketUser> MentionedUsers { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyCollection<SocketUser>

Collection of WebSocket-based users.

| Improve this Doc View Source

Reactions

Gets all reactions included in this message.

Declaration
public IReadOnlyDictionary<IEmote, ReactionMetadata> Reactions { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyDictionary<IEmote, ReactionMetadata>
| Improve this Doc View Source

Reference

Gets the reference to the original message if it was crossposted.

Declaration
public MessageReference Reference { get; }
Property Value
Type Description
MessageReference

A message's reference, if any is associated.

Remarks

Sent with Cross-posted messages, meaning they were published from news channels and received by subscriber channels.

| Improve this Doc View Source

Source

Gets the source type of this message.

Declaration
public MessageSource Source { get; }
Property Value
Type Description
MessageSource
| Improve this Doc View Source

Tags

Gets all tags included in this message's content.

Declaration
public virtual IReadOnlyCollection<ITag> Tags { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyCollection<ITag>
| Improve this Doc View Source

Timestamp

Gets the time this message was sent.

Declaration
public DateTimeOffset Timestamp { get; }
Property Value
Type Description
System.DateTimeOffset

Time of when the message was sent.

Methods

| Improve this Doc View Source

AddReactionAsync(IEmote, RequestOptions)

Adds a reaction to this message.

Declaration
public Task AddReactionAsync(IEmote emote, RequestOptions options = null)
Parameters
Type Name Description
IEmote emote

The emoji used to react to this message.

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task

A task that represents the asynchronous operation for adding a reaction to this message.

See Also
IEmote
| Improve this Doc View Source

DeleteAsync(RequestOptions)

Deletes this object and all its children.

Declaration
public Task DeleteAsync(RequestOptions options = null)
Parameters
Type Name Description
RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task
| Improve this Doc View Source

GetReactionUsersAsync(IEmote, Int32, RequestOptions)

Declaration
public IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emote, int limit, RequestOptions options = null)
Parameters
Type Name Description
IEmote emote
System.Int32 limit
RequestOptions options
Returns
Type Description
System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<IUser>>
| Improve this Doc View Source

RemoveAllReactionsAsync(RequestOptions)

Removes all reactions from this message.

Declaration
public Task RemoveAllReactionsAsync(RequestOptions options = null)
Parameters
Type Name Description
RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task

A task that represents the asynchronous removal operation.

| Improve this Doc View Source

RemoveReactionAsync(IEmote, IUser, RequestOptions)

Removes a reaction from message.

Declaration
public Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null)
Parameters
Type Name Description
IEmote emote

The emoji used to react to this message.

IUser user

The user that added the emoji.

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task

A task that represents the asynchronous operation for removing a reaction to this message.

See Also
IEmote
| Improve this Doc View Source

RemoveReactionAsync(IEmote, UInt64, RequestOptions)

Removes a reaction from message.

Declaration
public Task RemoveReactionAsync(IEmote emote, ulong userId, RequestOptions options = null)
Parameters
Type Name Description
IEmote emote

The emoji used to react to this message.

System.UInt64 userId

The ID of the user that added the emoji.

RequestOptions options

The options to be used when sending the request.

Returns
Type Description
System.Threading.Tasks.Task

A task that represents the asynchronous operation for removing a reaction to this message.

See Also
IEmote
| Improve this Doc View Source

ToString()

Gets the content of the message.

Declaration
public override string ToString()
Returns
Type Description
System.String

Content of the message.

Overrides
System.Object.ToString()

Explicit Interface Implementations

| Improve this Doc View Source

IMessage.Attachments

Gets all attachments included in this message.

Declaration
IReadOnlyCollection<IAttachment> IMessage.Attachments { get; }
Returns
Type Description
System.Collections.Generic.IReadOnlyCollection<IAttachment>

A read-only collection of attachments.

Remarks

This property gets a read-only collection of attachments associated with this message. Depending on the user's end-client, a sent message may contain one or more attachments. For example, mobile users may attach more than one file in their message, while the desktop client only allows for one.

| Improve this Doc View Source

IMessage.Author

Gets the author of this message.

Declaration
IUser IMessage.Author { get; }
Returns
Type Description
IUser
| Improve this Doc View Source

IMessage.Channel

Gets the source channel of the message.

Declaration
IMessageChannel IMessage.Channel { get; }
Returns
Type Description
IMessageChannel
| Improve this Doc View Source

IMessage.Embeds

Gets all embeds included in this message.

Declaration
IReadOnlyCollection<IEmbed> IMessage.Embeds { get; }
Returns
Type Description
System.Collections.Generic.IReadOnlyCollection<IEmbed>

A read-only collection of embed objects.

| Improve this Doc View Source

IMessage.MentionedChannelIds

Gets the IDs of channels mentioned in this message.

Declaration
IReadOnlyCollection<ulong> IMessage.MentionedChannelIds { get; }
Returns
Type Description
System.Collections.Generic.IReadOnlyCollection<System.UInt64>

A read-only collection of channel IDs.

| Improve this Doc View Source

IMessage.MentionedRoleIds

Gets the IDs of roles mentioned in this message.

Declaration
IReadOnlyCollection<ulong> IMessage.MentionedRoleIds { get; }
Returns
Type Description
System.Collections.Generic.IReadOnlyCollection<System.UInt64>

A read-only collection of role IDs.

| Improve this Doc View Source

IMessage.MentionedUserIds

Gets the IDs of users mentioned in this message.

Declaration
IReadOnlyCollection<ulong> IMessage.MentionedUserIds { get; }
Returns
Type Description
System.Collections.Generic.IReadOnlyCollection<System.UInt64>

A read-only collection of user IDs.

| Improve this Doc View Source

IMessage.Type

Gets the type of this system message.

Declaration
MessageType IMessage.Type { get; }
Returns
Type Description
MessageType

Implements

IMessage
ISnowflakeEntity
IEntity<TId>
IDeletable
  • Improve this Doc
  • View Source
Back to top Generated by DocFX