# Client

## Constructor

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

| Parameter | Type                                        | Description               |
| --------- | ------------------------------------------- | ------------------------- |
| options   | [clientOptions](/typedefs/clientoptions.md) | The options to the client |

## Properties

### channels

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

Returns - `collection<`[`channel`](/classes/channel.md)`>`

### guilds

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

Returns - `collection<`[`guild`](/classes/guild.md)`>`

### token&#x20;

{% hint style="danger" %}
Returned string should be kept secret at all times
{% endhint %}

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`](/classes/user.md)>

## 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     | <p>This is what will show up under the bot's profile</p><p>Default = null</p> |
| options.type | false     | <p>This is the type of the presence</p><p>Default = 0</p>                     |

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](/typedefs/clientoptions.md). 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   | [channel](/classes/channel.md) | The channel constructor of the channel that was created. |

### channelDelete

Triggered when a channel is deleted.

| Parameter | Type                           | Description                                              |
| --------- | ------------------------------ | -------------------------------------------------------- |
| channel   | [channel](/classes/channel.md) | The channel constructor of the channel that was deleted. |

### channelUpdate

Triggered when a channel is Updated.

| Parameter       | Type                           | Description                                 |
| --------------- | ------------------------------ | ------------------------------------------- |
| data.oldChannel | [channel](/classes/channel.md) | The channel constructor for the old channel |
| data.newChannel | [channel](/classes/channel.md) | The channel constructor for the new channel |

```javascript
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   | [Message](/event-classes/message-create.md) | The message constructor |

### messageDelete

Triggered when a message is deleted

| Parameter | Type           | Description                |
| --------- | -------------- | -------------------------- |
| message   | partialMessage | The partial message object |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dlite.js.org/classes/client.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
