Table of Contents

Class MessageExtensions

Namespace
Kook
Assembly
Kook.Net.Core.dll

Provides extension methods for IMessage.

public static class MessageExtensions
Inheritance
MessageExtensions
Inherited Members

Methods

AddReactionsAsync(IUserMessage, IEnumerable<IEmote>, RequestOptions?)

Add multiple reactions to a message.

public static Task AddReactionsAsync(this IUserMessage msg, IEnumerable<IEmote> reactions, RequestOptions? options = null)

Parameters

msg IUserMessage

The message to add reactions to.

reactions IEnumerable<IEmote>

An array of reactions to add to the 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.

Examples

IEmote a = new Emoji("🅰");
IEmote b = new Emoji("🅱");
await msg.AddReactionsAsync([a, b]);

Remarks

This method does not bulk add reactions! It will send a request for each reaction included.

See Also

GetJumpUrl(IMessage)

Gets a URL that jumps to the message.

public static string GetJumpUrl(this IMessage msg)

Parameters

msg IMessage

The message to jump to.

Returns

string

A string that contains a URL for jumping to the message in chat.

RemoveReactionsAsync(IUserMessage, IUser, IEnumerable<IEmote>, RequestOptions?)

Remove multiple reactions from a message.

public static Task RemoveReactionsAsync(this IUserMessage msg, IUser user, IEnumerable<IEmote> reactions, RequestOptions? options = null)

Parameters

msg IUserMessage

The message to remove reactions from.

user IUser

The user who removed the reaction.

reactions IEnumerable<IEmote>

An array of reactions to remove from the message.

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.

Examples

await msg.RemoveReactionsAsync(currentUser, [A, B]);

Remarks

This method does not bulk remove reactions! It will send a request for each reaction included.

See Also

ReplyCardAsync(IUserMessage, ICard, bool, bool, RequestOptions?)

Sends a card message to the source channel.

public static Task<Cacheable<IUserMessage, Guid>> ReplyCardAsync(this IUserMessage message, ICard card, bool isQuote = false, bool isEphemeral = false, RequestOptions? options = null)

Parameters

message IUserMessage

The message that is being replied on.

card ICard

The card to be sent.

isQuote bool

true if the source message will be quoted in this message; otherwise, false.

isEphemeral bool

true if the message to be sent can be seen only by the command invoker; otherwise, false.

options RequestOptions

The request options for this async request.

Returns

Task<Cacheable<IUserMessage, Guid>>

ReplyCardsAsync(IUserMessage, IEnumerable<ICard>, bool, bool, RequestOptions?)

Sends a card message to the source channel.

public static Task<Cacheable<IUserMessage, Guid>> ReplyCardsAsync(this IUserMessage message, IEnumerable<ICard> cards, bool isQuote = false, bool isEphemeral = false, RequestOptions? options = null)

Parameters

message IUserMessage

The message that is being replied on.

cards IEnumerable<ICard>

The cards to be sent.

isQuote bool

true if the source message will be quoted in this message; otherwise, false.

isEphemeral bool

true if the message to be sent can be seen only by the command invoker; otherwise, false.

options RequestOptions

The request options for this async request.

Returns

Task<Cacheable<IUserMessage, Guid>>

ReplyFileAsync(IUserMessage, FileAttachment, bool, bool, RequestOptions?)

Sends an inline reply of file that references a message.

public static Task<Cacheable<IUserMessage, Guid>> ReplyFileAsync(this IUserMessage message, FileAttachment attachment, bool isQuote = false, bool isEphemeral = false, RequestOptions? options = null)

Parameters

message IUserMessage

The message that is being replied on.

attachment FileAttachment

The attachment containing the file.

isQuote bool

true if the source message will be quoted in this message; otherwise, false.

isEphemeral bool

true if the message to be sent can be seen only by the command invoker; otherwise, false.

options RequestOptions

The options to be used when sending the request.

Returns

Task<Cacheable<IUserMessage, Guid>>

ReplyFileAsync(IUserMessage, Stream, string, AttachmentType, bool, bool, RequestOptions?)

Sends an inline reply of file that references a message.

public static Task<Cacheable<IUserMessage, Guid>> ReplyFileAsync(this IUserMessage message, Stream stream, string filename, AttachmentType type = AttachmentType.File, bool isQuote = false, bool isEphemeral = false, RequestOptions? options = null)

Parameters

message IUserMessage

The message that is being replied on.

stream Stream

Stream of the file to be sent.

filename string

The name of the file.

type AttachmentType

The type of the file.

isQuote bool

true if the source message will be quoted in this message; otherwise, false.

isEphemeral bool

true if the message to be sent can be seen only by the command invoker; otherwise, false.

options RequestOptions

The options to be used when sending the request.

Returns

Task<Cacheable<IUserMessage, Guid>>

ReplyFileAsync(IUserMessage, string, string?, AttachmentType, bool, bool, RequestOptions?)

Sends an inline reply of file that references a message.

public static Task<Cacheable<IUserMessage, Guid>> ReplyFileAsync(this IUserMessage message, string path, string? filename = null, AttachmentType type = AttachmentType.File, bool isQuote = false, bool isEphemeral = false, RequestOptions? options = null)

Parameters

message IUserMessage

The message that is being replied on.

path string

The file path of the file.

filename string

The name of the file.

type AttachmentType

The type of the file.

isQuote bool

true if the source message will be quoted in this message; otherwise, false.

isEphemeral bool

true if the message to be sent can be seen only by the command invoker; otherwise, false.

options RequestOptions

The options to be used when sending the request.

Returns

Task<Cacheable<IUserMessage, Guid>>

ReplyTextAsync(IUserMessage, string, bool, bool, RequestOptions?)

Sends an inline reply of text that references a message.

public static Task<Cacheable<IUserMessage, Guid>> ReplyTextAsync(this IUserMessage message, string content, bool isQuote = false, bool isEphemeral = false, RequestOptions? options = null)

Parameters

message IUserMessage

The message that is being replied on.

content string

Contents of the message.

isQuote bool

true if the source message will be quoted in this message; otherwise, false.

isEphemeral bool

true if the message to be sent can be seen only by the command invoker; otherwise, false.

options RequestOptions

The request options for this async request.

Returns

Task<Cacheable<IUserMessage, Guid>>