Table of Contents

Interface IKookClient

Namespace
Kook
Assembly
Kook.Net.Core.dll

Represents a generic Kook client.

public interface IKookClient : IDisposable
Inherited Members

Properties

ConnectionState

Gets the current state of connection.

ConnectionState ConnectionState { get; }

Property Value

ConnectionState

CurrentUser

Gets the currently logged-in user.

ISelfUser? CurrentUser { get; }

Property Value

ISelfUser

TokenType

Gets the token type of the logged-in user.

TokenType TokenType { get; }

Property Value

TokenType

Methods

GetBlockedUsersAsync(CacheMode, RequestOptions?)

Gets blocked users.

Task<IReadOnlyCollection<IUser>> GetBlockedUsersAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions? options = null)

Parameters

mode CacheMode

The CacheMode that determines whether the object should be fetched from cache.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<IUser>>

A task that represents the asynchronous get operation. The task result contains a collection of users that are blocked by the current user.

GetChannelAsync(ulong, CacheMode, RequestOptions?)

Gets a generic channel.

Task<IChannel?> GetChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions? options = null)

Parameters

id ulong

The identifier of the channel.

mode CacheMode

The CacheMode that determines whether the object should be fetched from cache.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IChannel>

A task that represents the asynchronous get operation. The task result contains the channel associated with the identifier; null when the channel cannot be found.

GetDMChannelAsync(Guid, CacheMode, RequestOptions?)

Gets a direct message channel.

Task<IDMChannel?> GetDMChannelAsync(Guid chatCode, CacheMode mode = CacheMode.AllowDownload, RequestOptions? options = null)

Parameters

chatCode Guid

The identifier of the channel.

mode CacheMode

The CacheMode that determines whether the object should be fetched from cache.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IDMChannel>

A task that represents the asynchronous get operation. The task result contains a read-only collection of direct-message channels that the user currently partakes in.

GetDMChannelsAsync(CacheMode, RequestOptions?)

Gets a collection of direct message channels opened in this session.

Task<IReadOnlyCollection<IDMChannel>> GetDMChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions? options = null)

Parameters

mode CacheMode

The CacheMode that determines whether the object should be fetched from cache.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<IDMChannel>>

A task that represents the asynchronous get operation. The task result contains a read-only collection of direct-message channels that the user currently partakes in.

Remarks

This method returns a collection of currently opened direct message channels.

warning

This method will not return previously opened DM channels outside of the current session! If you have just started the client, this may return an empty collection.

GetFriendRequestsAsync(CacheMode, RequestOptions?)

Gets friend requests.

Task<IReadOnlyCollection<IFriendRequest>> GetFriendRequestsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions? options = null)

Parameters

mode CacheMode

The CacheMode that determines whether the object should be fetched from cache.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<IFriendRequest>>

A task that represents the asynchronous get operation. The task result contains a collection of users that requested to be friends with the current user.

GetFriendsAsync(CacheMode, RequestOptions?)

Gets friends.

Task<IReadOnlyCollection<IUser>> GetFriendsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions? options = null)

Parameters

mode CacheMode

The CacheMode that determines whether the object should be fetched from cache.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<IUser>>

A task that represents the asynchronous get operation. The task result contains a collection of users that are friends with the current user.

GetGuildAsync(ulong, CacheMode, RequestOptions?)

Gets a guild.

Task<IGuild?> GetGuildAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions? options = null)

Parameters

id ulong

The guild identifier.

mode CacheMode

The CacheMode that determines whether the object should be fetched from cache.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IGuild>

A task that represents the asynchronous get operation. The task result contains the guild associated with the identifier; null when the guild cannot be found.

GetGuildsAsync(CacheMode, RequestOptions?)

Gets a collection of guilds that the user is currently in.

Task<IReadOnlyCollection<IGuild>> GetGuildsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions? options = null)

Parameters

mode CacheMode

The CacheMode that determines whether the object should be fetched from cache.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<IGuild>>

A task that represents the asynchronous get operation. The task result contains a read-only collection of guilds that the current user is in.

GetUserAsync(string, string, RequestOptions?)

Gets a user.

Task<IUser?> GetUserAsync(string username, string identifyNumber, RequestOptions? options = null)

Parameters

username string

The name of the user (e.g. Still).

identifyNumber string

The identify value of the user (e.g. 2876).

options RequestOptions

The options to be used when sending the request.

Returns

Task<IUser>

A task that represents the asynchronous get operation. The task result contains the user associated with the name and the identifyNumber; null if the user is not found.

GetUserAsync(ulong, CacheMode, RequestOptions?)

Gets a user.

Task<IUser?> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions? options = null)

Parameters

id ulong

The identifier of the user.

mode CacheMode

The CacheMode that determines whether the object should be fetched from cache.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IUser>

A task that represents the asynchronous get operation. The task result contains the user associated with the identifier; null if the user is not found.

StartAsync()

Starts the connection between Kook and the client..

Task StartAsync()

Returns

Task

A task that represents the asynchronous start operation.

Remarks

This method will initialize the connection between the client and Kook.

important

This method will immediately return after it is called, as it will initialize the connection on another thread.

StopAsync()

Stops the connection between Kook and the client.

Task StopAsync()

Returns

Task

A task that represents the asynchronous stop operation.