# Debugger

## <mark style="color:blue;">Constructor</mark>

```typescript
new Debugger(client, options);
```

| PARAMETER | TYPE                                                                    | DESCRIPTION                | OPTIONAL |
| --------- | ----------------------------------------------------------------------- | -------------------------- | -------- |
| `client`  | [Client](https://old.discordjs.dev/#/docs/discord.js/main/class/Client) | discord.js Client instance | ❌        |
| `options` | [Options](https://lxrnz.gitbook.io/discord-debug/interfaces/options)    | Debugger options           | ✅        |

## <mark style="color:blue;">Properties</mark>

### `.owners`

Array of owner IDs\
**Type**: [Snowflake](https://old.discordjs.dev/#/docs/discord.js/main/typedef/Snowflake)\[]

### `.client`

discord.js Client instance\
**Type**: [Client](https://old.discordjs.dev/#/docs/discord.js/main/class/Client)

### `.options`

Debugger Options\
**Type**: [?Options](https://lxrnz.gitbook.io/discord-debug/interfaces/options)

## <mark style="color:blue;">Methods</mark>

### .messageRun(`message`, `args?`)

Runs the debugger instance for message commands

| PARAMETER | TYPE                                                                                                 | DETAILS                             | OPTIONAL |
| --------- | ---------------------------------------------------------------------------------------------------- | ----------------------------------- | -------- |
| `message` | [Message](https://old.discordjs.dev/#/docs/discord.js/main/class/Message)                            | discord.js Message instance         | ❌        |
| `args`    | [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)\[] | Message args, including sub command | ✅        |

**Returns**: [Promise](https://lxrnz.gitbook.io/discord-debug/classes/broken-reference)<[Message](https://old.discordjs.dev/#/docs/discord.js/main/class/Message)>

**Examples**:

```typescript
if (message.content.startsWith('!debug')) {
    args = message.content.split(' ').slice(1);
    await Debugger.messageRun(message, args);
}
```

### .addOwner(`id`)

{% hint style="info" %}
Recommended: **`!debug owners add <id>`**
{% endhint %}

Add a `userId` to the owners array

| PARAMETER | TYPE                                                                            | DETAILS | OPTIONAL |
| --------- | ------------------------------------------------------------------------------- | ------- | -------- |
| `id`      | [Snowflake](https://old.discordjs.dev/#/docs/discord.js/main/typedef/Snowflake) | User ID | ❌        |

**Returns**: [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)\[]

**Examples**:

```typescript
const owners = Debugger.addOwner('923925375657082931');
console.log(`Owners: ${owners}`);
```

### .removeOwner(`id`)

{% hint style="info" %}
Recommended: **`!debug owners remove <id>`**
{% endhint %}

Remove a `userId` from the owners array

| PARAMETER | TYPE                                                                            | DETAILS | OPTIONAL |
| --------- | ------------------------------------------------------------------------------- | ------- | -------- |
| `id`      | [Snowflake](https://old.discordjs.dev/#/docs/discord.js/main/typedef/Snowflake) | User ID | ❌        |

**Returns**: [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)\[]

**Examples**:

```typescript
const owners = Debugger.removeOwner('923925375657082931');
console.log(`Owners: ${owners}`);
```
