Class UserExtensions
- Namespace
- Kook
- Assembly
- Kook.Net.Core.dll
An extension class for various Kook user objects.
public static class UserExtensions
- Inheritance
-
UserExtensions
- Inherited Members
Methods
BanAsync(IGuildUser, int, string?, RequestOptions?)
Bans the user from the guild and optionally prunes their recent messages.
public static Task BanAsync(this IGuildUser user, int pruneDays = 0, string? reason = null, RequestOptions? options = null)
Parameters
user
IGuildUserThe user to ban.
pruneDays
intThe number of days to remove messages from this
user
for - must be between [0, 7]reason
stringThe reason of the ban to be written in the audit log.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous operation for banning a user.
Exceptions
- ArgumentException
pruneDays
is not between 0 to 7.
SendCardAsync(IUser, ICard, IQuote?, RequestOptions?)
Sends a card message message via DM.
public static Task<Cacheable<IUserMessage, Guid>> SendCardAsync(this IUser user, ICard card, IQuote? quote = null, RequestOptions? options = null)
Parameters
user
IUserThe user to send the DM to.
card
ICardThe card to be sent.
quote
IQuoteThe message quote to be included. Used to reply to specific messages.
options
RequestOptionsThe request options for this
async
request.
Returns
SendCardsAsync(IUser, IEnumerable<ICard>, IQuote?, RequestOptions?)
Sends a card message message via DM.
public static Task<Cacheable<IUserMessage, Guid>> SendCardsAsync(this IUser user, IEnumerable<ICard> cards, IQuote? quote = null, RequestOptions? options = null)
Parameters
user
IUserThe user to send the DM to.
cards
IEnumerable<ICard>The cards to be sent.
quote
IQuoteThe message quote to be included. Used to reply to specific messages.
options
RequestOptionsThe request options for this
async
request.
Returns
SendFileAsync(IUser, FileAttachment, IQuote?, RequestOptions?)
Sends a file via DM.
public static Task<Cacheable<IUserMessage, Guid>> SendFileAsync(this IUser user, FileAttachment attachment, IQuote? quote = null, RequestOptions? options = null)
Parameters
user
IUserThe user to send the DM to.
attachment
FileAttachmentThe attachment containing the file.
quote
IQuoteThe message quote to be included. Used to reply to specific messages.
options
RequestOptionsThe options to be used when sending the request.
Returns
SendFileAsync(IUser, Stream, string, AttachmentType, IQuote?, RequestOptions?)
Sends a file via DM.
public static Task<Cacheable<IUserMessage, Guid>> SendFileAsync(this IUser user, Stream stream, string filename, AttachmentType type = AttachmentType.File, IQuote? quote = null, RequestOptions? options = null)
Parameters
user
IUserThe user to send the DM to.
stream
StreamThe stream of the file.
filename
stringThe name of the file.
type
AttachmentTypeThe type of the file.
quote
IQuoteThe message quote to be included. Used to reply to specific messages.
options
RequestOptionsThe options to be used when sending the request.
Returns
SendFileAsync(IUser, string, string?, AttachmentType, IQuote?, RequestOptions?)
Sends a file via DM.
public static Task<Cacheable<IUserMessage, Guid>> SendFileAsync(this IUser user, string path, string? filename = null, AttachmentType type = AttachmentType.File, IQuote? quote = null, RequestOptions? options = null)
Parameters
user
IUserThe user to send the DM to.
path
stringThe file path of the file.
filename
stringThe name of the file.
type
AttachmentTypeThe type of the file.
quote
IQuoteThe message quote to be included. Used to reply to specific messages.
options
RequestOptionsThe options to be used when sending the request.
Returns
SendTextAsync(IUser, string, IQuote?, RequestOptions?)
Sends a text message via DM.
public static Task<Cacheable<IUserMessage, Guid>> SendTextAsync(this IUser user, string content, IQuote? quote = null, RequestOptions? options = null)
Parameters
user
IUserThe user to send the DM to.
content
stringThe KMarkdown content to be sent.
quote
IQuoteThe message quote to be included. Used to reply to specific messages.
options
RequestOptionsThe options to be used when sending the request.