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
IUserMessageThe message to add reactions to.
reactions
IEnumerable<IEmote>An array of reactions to add to the message.
options
RequestOptionsThe 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
IMessageThe message to jump to.
Returns
- string
A string that contains a URL for jumping to the message in chat.
MaybeTextImageMixedMessage(IUserMessage)
Gets whether the message may be a text image mixed message.
public static bool MaybeTextImageMixedMessage(this IUserMessage msg)
Parameters
msg
IUserMessageThe message to check against.
Returns
- bool
true
if the message may be a text image mixed message; otherwise,false
.
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
IUserMessageThe message to remove reactions from.
user
IUserThe user who removed the reaction.
reactions
IEnumerable<IEmote>An array of reactions to remove from the message.
options
RequestOptionsThe 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
IUserMessageThe message that is being replied on.
card
ICardThe card to be sent.
isQuote
booltrue
if the source message will be quoted in this message; otherwise,false
.isEphemeral
booltrue
if the message to be sent can be seen only by the command invoker; otherwise,false
.options
RequestOptionsThe request options for this
async
request.
Returns
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
IUserMessageThe message that is being replied on.
cards
IEnumerable<ICard>The cards to be sent.
isQuote
booltrue
if the source message will be quoted in this message; otherwise,false
.isEphemeral
booltrue
if the message to be sent can be seen only by the command invoker; otherwise,false
.options
RequestOptionsThe request options for this
async
request.
Returns
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
IUserMessageThe message that is being replied on.
attachment
FileAttachmentThe attachment containing the file.
isQuote
booltrue
if the source message will be quoted in this message; otherwise,false
.isEphemeral
booltrue
if the message to be sent can be seen only by the command invoker; otherwise,false
.options
RequestOptionsThe options to be used when sending the request.
Returns
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
IUserMessageThe message that is being replied on.
stream
StreamStream of the file to be sent.
filename
stringThe name of the file.
type
AttachmentTypeThe type of the file.
isQuote
booltrue
if the source message will be quoted in this message; otherwise,false
.isEphemeral
booltrue
if the message to be sent can be seen only by the command invoker; otherwise,false
.options
RequestOptionsThe options to be used when sending the request.
Returns
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
IUserMessageThe message that is being replied on.
path
stringThe file path of the file.
filename
stringThe name of the file.
type
AttachmentTypeThe type of the file.
isQuote
booltrue
if the source message will be quoted in this message; otherwise,false
.isEphemeral
booltrue
if the message to be sent can be seen only by the command invoker; otherwise,false
.options
RequestOptionsThe options to be used when sending the request.
Returns
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
IUserMessageThe message that is being replied on.
content
stringContents of the message.
isQuote
booltrue
if the source message will be quoted in this message; otherwise,false
.isEphemeral
booltrue
if the message to be sent can be seen only by the command invoker; otherwise,false
.options
RequestOptionsThe request options for this
async
request.