Client

Please scroll down to see full documentation

Constructor

const client = new Discord.Bot(options = {})

Parameter

Type

Description

options

The options to the client

Properties

channels

This can be used to search up specific channels and do stuff with it

Returns - collection<channel>

guilds

This can be used to search up specific guilds and do stuff with it

Returns - collection<guild>

token

Returned string should be kept secret at all times

Returns the bot token that were used to login the bot

Returns - String

users

This can be used to search up specific users and do stuff with it

Returns - collection<user>

Methods

login(token)

Used to the the bot in. This is essential for the bot to become online. This function is ran in async.

Param

Required?

Description

token

true

The login token

Returns - botToken

setPresence(status, options = {})

Used to set the game of the bot.

Param

Required?

Description

status

true

status of the bot(online, dnd, idle, offline)

options.game

false

This is what will show up under the bot's profile

Default = null

options.type

false

This is the type of the presence

Default = 0

Returns - void

ready(callback)

Fired when all caches are cut and the bot is completely ready. This time depends on the timeout option given in clientOptions. Default is 5000 milliseconds(5 seconds)

Param

Type

Required?

Description

callback

function

true

The callback function

Events

channelCreate

Triggered when a channel is created.

Parameter

Type

Description

channel

The channel constructor of the channel that was created.

channelDelete

Triggered when a channel is deleted.

Parameter

Type

Description

channel

The channel constructor of the channel that was deleted.

channelUpdate

Triggered when a channel is Updated.

Parameter

Type

Description

data.oldChannel

The channel constructor for the old channel

data.newChannel

The channel constructor for the new channel

client.on("channelUpdate", function(data){
    console.log(data.newChannel)//new channel's constructor
    console.log(data.oldChannel)//old channel's constructor
})

messageCreate

Triggered when a message is sent

Parameter

Type

Description

message

The message constructor

messageDelete

Triggered when a message is deleted

Parameter

Type

Description

message

partialMessage

The partial message object

Last updated