Table of Contents

Class SocketMessage

Namespace
Kook.WebSocket
Assembly
Kook.Net.WebSocket.dll

Represents a WebSocket-based message.

public abstract class SocketMessage : SocketEntity<Guid>, IMessage, IEntity<Guid>, IDeletable, IUpdateable
Inheritance
SocketMessage
Implements
Derived
Inherited Members
Extension Methods

Properties

Attachments

Gets the attachment included in this message.

public virtual IReadOnlyCollection<Attachment> Attachments { get; }

Property Value

IReadOnlyCollection<Attachment>

Author

Gets the author of this message.

public SocketUser Author { get; }

Property Value

SocketUser

A WebSocket-based user object.

Cards

Returns all cards included in this message.

public virtual IReadOnlyCollection<ICard> Cards { get; }

Property Value

IReadOnlyCollection<ICard>

Collection of card objects.

Channel

Gets the source channel of the message.

public ISocketMessageChannel Channel { get; }

Property Value

ISocketMessageChannel

A WebSocket-based message channel.

CleanContent

Gets the clean content for this message.

public string CleanContent { get; }

Property Value

string

A string that contains the body of the message stripped of mentions, markdown, emojis and pings; note that this field may be empty or the original code if the message is not a text based message.

Content

Gets the content for this message.

public string Content { get; }

Property Value

string

A string that contains the body of the message; note that this field may be empty or the original code if the message is not a text based message.

EditedTimestamp

Gets the time of this message's last edit.

public DateTimeOffset? EditedTimestamp { get; }

Property Value

DateTimeOffset?

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

Embeds

Returns all embeds included in this message.

public virtual IReadOnlyCollection<IEmbed> Embeds { get; }

Property Value

IReadOnlyCollection<IEmbed>

Collection of embed objects.

IsPinned

Gets the value that indicates whether this message is pinned.

public virtual bool? IsPinned { get; }

Property Value

bool?

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

MentionedEveryone

Gets the value that indicates whether this message mentioned everyone.

public virtual bool? MentionedEveryone { get; }

Property Value

bool?

true if this message mentioned everyone; otherwise false.

MentionedHere

Gets the value that indicates whether this message mentioned online users.

public virtual bool? MentionedHere { get; }

Property Value

bool?

true if this message mentioned online users; otherwise false.

MentionedRoles

Returns the roles mentioned in this message.

public virtual IReadOnlyCollection<SocketRole> MentionedRoles { get; }

Property Value

IReadOnlyCollection<SocketRole>

Collection of WebSocket-based roles.

MentionedUsers

Returns the users mentioned in this message.

public IReadOnlyCollection<SocketUser> MentionedUsers { get; }

Property Value

IReadOnlyCollection<SocketUser>

Collection of WebSocket-based users.

Pokes

Gets a collection of the SocketPokeAction's on the message.

public virtual IReadOnlyCollection<SocketPokeAction> Pokes { get; }

Property Value

IReadOnlyCollection<SocketPokeAction>

Collection of poke action objects.

RawContent

Gets the raw content of the message.

public string RawContent { get; }

Property Value

string

Remarks

This property is only available for messages that were received from the gateway.

Reactions

Gets all reactions included in this message.

public IReadOnlyDictionary<IEmote, ReactionMetadata> Reactions { get; }

Property Value

IReadOnlyDictionary<IEmote, ReactionMetadata>

Source

Gets the source type of this message.

public MessageSource Source { get; }

Property Value

MessageSource

Tags

Gets all tags included in this message's content.

public virtual IReadOnlyCollection<ITag> Tags { get; }

Property Value

IReadOnlyCollection<ITag>

Timestamp

Gets the time this message was sent.

public DateTimeOffset Timestamp { get; }

Property Value

DateTimeOffset

Time of when the message was sent.

Type

Gets the type of this message.

public MessageType Type { get; }

Property Value

MessageType

Methods

AddReactionAsync(IEmote, RequestOptions)

Adds a reaction to this message.

public Task AddReactionAsync(IEmote emote, RequestOptions options = null)

Parameters

emote IEmote

The emoji used to react to this message.

options RequestOptions

The options to be used when sending the request.

Returns

Task

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

See Also

DeleteAsync(RequestOptions)

Deletes this object and all its children.

public Task DeleteAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

GetReactionUsersAsync(IEmote, RequestOptions)

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

public Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emote, RequestOptions options = null)

Parameters

emote IEmote

The emoji that represents the reaction that you wish to get.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<IUser>>

Collection of users.

RemoveReactionAsync(IEmote, IUser, RequestOptions)

Removes a reaction from message.

public Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null)

Parameters

emote IEmote

The emoji used to react to this message.

user IUser

The user that added the emoji.

options RequestOptions

The options to be used when sending the request.

Returns

Task

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

See Also

RemoveReactionAsync(IEmote, ulong, RequestOptions)

Removes a reaction from message.

public Task RemoveReactionAsync(IEmote emote, ulong userId, RequestOptions options = null)

Parameters

emote IEmote

The emoji used to react to this message.

userId ulong

The ID of the user that added the emoji.

options RequestOptions

The options to be used when sending the request.

Returns

Task

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

See Also

ToString()

Gets the content of the message.

public override string ToString()

Returns

string

Content of the message.

UpdateAsync(RequestOptions)

Updates this object's properties with its current state.

public Task UpdateAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents an asynchronous reloading operation.

Remarks

warning

This method will fetch the latest data from REST API, and replace the current object's properties with the new data.