Reference
Classes
Client

Class: Client

Represents a socket based Client.

Extended by

Constructors

new Client()

new Client(token, options?): Client

new Client("token", { sharding: { totalShards: 2 } });

Parameters

ParameterType
tokenstring
options?Partial<ClientOptions>

Returns

Client

Defined in

src/core/Client.ts:78 (opens in a new tab)

Properties

PropertyModifierTypeDescriptionDefined in
#tokenprotectedstringThe Discord authorization token.src/core/Client.ts:36 (opens in a new tab)
cachepublicClientCacheManagerClient cache utility will store Guild objects when received from Discord gateway and API,src/core/Client.ts:61 (opens in a new tab)
eventspublicClientEventsAll events received from Discord gateway and other utility events.src/core/Client.ts:71 (opens in a new tab)
optionspublicClientOptionsClient options to customize every thing, such as API version, URLs, sharding, etc...src/core/Client.ts:56 (opens in a new tab)
readypublicbooleanWhether has completed the initialization setup and is fully connected to Discord gateway.src/core/Client.ts:51 (opens in a new tab)
restpublicRequestManagerUtility class to handle all HTTPS requests to Discord API.src/core/Client.ts:41 (opens in a new tab)
shardspublicGatewayManagerGateway manager, handle all shards connection.src/core/Client.ts:46 (opens in a new tab)
user?publicUserThe client user.src/core/Client.ts:66 (opens in a new tab)

Methods

getMe()

getMe(): Promise<User>

Get and set the client user object.

await client.getMe();
console.log(client.user);
const user = await client.getMe();
console.log(user);

Returns

Promise<User>

Defined in

src/core/Client.ts:124 (opens in a new tab)


init()

init(): Promise<void>

Start the initialization process, first it will try to catch the user itself, then it will connect all the shards.

await client.init();

Returns

Promise<void>

Defined in

src/core/Client.ts:142 (opens in a new tab)