Client

Client

new Client()

Source:
Properties:
Name Type Attributes Description
channels Store

Where channels are being cached

guilds Store

Where guilds are being cached

token String

The token of the client

users Store

Where users are being cached

options Object <optional>

Options for the Discord Client

Properties
Name Type Attributes Default Description
shardCount Number | String <optional>
1

The amount of shards to use

disableEveryone Boolean <optional>
true

Whether to disable the @everyone ping

getAllMembers Boolean <optional>
false

Whether to fetch all members on each guild regardless of being offline or not

storeMessages Boolean <optional>
false

Whether to store messages in a cache, once the bot restarts the messages in the cache will be gone and can't be re-added automatically

Extends

  • EventEmitter

Methods

createDM(user) → {Promise.<DMChannel>}

Source:

Creates a DMChannel between a user

Parameters:
Name Type Description
user Snowflake

The id of the recipient for the DM

Returns:
Type
Promise.<DMChannel>

createEmbed(channel, embed) → {Promise.<Message>}

Source:

Creates an embed to a channel

Parameters:
Name Type Description
channel Snowflake

The id of the channel to send a message to

embed Object

The embed to send

Returns:
Type
Promise.<Message>

createGuild(name, optionsopt) → {Promise.<Guild>}

Source:

Creates a guild

Parameters:
Name Type Attributes Description
name String

The name for the new guild

options Object <optional>

Options for the new guild

Properties
Name Type Attributes Description
region String <optional>

The region for the guild

icon String <optional>

A base64 128x128 jpeg image for the guild icon

Returns:
Type
Promise.<Guild>

createMessage(channel, content) → {Promise.<Message>}

Source:

Creates a message to a channel

Parameters:
Name Type Description
channel Snowflake

The id of the channel to send a message to

content String

The content to send

Returns:
Type
Promise.<Message>

customLog(type, color, message) → {Object}

Source:

Make your own log with your own type and color

Parameters:
Name Type Description
type String

The type of the log, can be anything

color String

The color of the type

message String

The message to log

Returns:
Type
Object

getUser(user) → {Promise.<User>}

Source:

Fetches the user from cache, if it doesn't exist use the REST API to fetch it and add to the cache

Parameters:
Name Type Description
user Snowflake

The id of the user to fetch

Returns:
Type
Promise.<User>

(async) initiate(token) → {Void}

Source:

This will start connecting to the gateway using the given bot token

Parameters:
Name Type Description
token String

The token of the user

Returns:
Type
Void

leaveGuild(guild) → {Promise.<Boolean>}

Source:

Makes the bot leave the guild

Parameters:
Name Type Description
guild Snowflake

The id of the guild

Returns:

Will return true if it's a success

Type
Promise.<Boolean>

log(type, message) → {Object}

Source:

Logs something to the console that is colored.

Parameters:
Name Type Description
type String

The type of the log

message String

The message to log

Returns:
Type
Object

rgbLog(type, message, optionsopt) → {Object}

Source:

Make your own log with your own type and color using RGB

Parameters:
Name Type Attributes Description
type String

The type of the log, can be anything

message String

The message to log

options Object <optional>

The options for the RGB Color

Properties
Name Type Attributes Default Description
red Number <optional>
0

The number for the color red in the rgb data

green Number <optional>
0

The number for the color green in the rgb data

blue Number <optional>
0

The number for the color blue in the rgb data

Returns:
Type
Object

start(token) → {Void}

Source:
Deprecated:
  • Yes

This will start connecting to the gateway using the given bot token

Parameters:
Name Type Description
token String

The token of the user

Returns:
Type
Void

Events

GUILD_MEMBER_ADD

Source:
Properties:
Name Type Description
member Member

The member that joined

Emitted when a guild member joins a guild

GUILD_MEMBER_REMOVE

Source:
Properties:
Name Type Description
member Member

The member that left

Emitted when a guild member leaves a guild

GUILD_MEMBER_UPDATE

Source:
Properties:
Name Type Description
member Member

The member that got updated

Emitted when a guild gets updated

GUILD_ROLE_CREATE

Source:
Properties:
Name Type Description
role Role

The new role created

GUILD_ROLE_DELETE

Source:
Properties:
Name Type Description
role Role

The role deleted

GUILD_ROLE_UPDATE

Source:
Properties:
Name Type Description
role Role

The role updated

PRESENCE_UPDATE

Source:
Properties:
Name Type Description
data Object

The data of the presence

Emitted when a user changes his presence or user info

READY

Source:

Emiited once all shards are ready

READY

Source:

Emiited once all shards are ready

READY

Source:

Emiited once all shards are ready

SHARD_LOADING

Source:
Properties:
Name Type Description
shard Shard.<Id>

Returns a partial Shard Object, contains an id only

Emitted once a Shard is being loaded

SHARD_READY

Source:
Properties:
Name Type Description
shard Object

The data of the shard

Emitted once a shard is ready

SHARD_READY

Source:
Properties:
Name Type Description
shard Object

The data of the shard

Emitted once a shard is ready