> ## Documentation Index
> Fetch the complete documentation index at: https://botmesh.afaya.com.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Whitelist

> Class exported by @botmesh/core.

Defined in: [gates/accessList.ts:209](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L209)

`bot.whitelist` — an [AccessList](https://botmesh.afaya.com.co/api/core/classes/AccessList.md) plus a mode switch. While **disabled**
(the default) its entries have no effect. While **enabled**, only messages whose
senderId OR chatId is on the list are processed; an enabled, empty whitelist
blocks everyone. The blacklist always wins over the whitelist.

## Extends

* [`AccessList`](https://botmesh.afaya.com.co/api/core/classes/AccessList)

## Constructors

### Constructor

```ts theme={null}
new Whitelist(): Whitelist;
```

Defined in: [gates/accessList.ts:212](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L212)

#### Returns

`Whitelist`

#### Overrides

[`AccessList`](https://botmesh.afaya.com.co/api/core/classes/AccessList).[`constructor`](https://botmesh.afaya.com.co/api/core/classes/AccessList#constructor)

## Properties

### name

```ts theme={null}
readonly name: AccessListName;
```

Defined in: [gates/accessList.ts:119](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L119)

#### Inherited from

[`AccessList`](https://botmesh.afaya.com.co/api/core/classes/AccessList).[`name`](https://botmesh.afaya.com.co/api/core/classes/AccessList#name)

## Methods

### add()

```ts theme={null}
add(ids): this;
```

Defined in: [gates/accessList.ts:122](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L122)

Add one id or many. Duplicates are ignored. Throws `TypeError` on an empty/non-string id.

#### Parameters

| Parameter | Type |
| - | - |
| `ids` | `string` \| readonly `string`\[] |

#### Returns

`this`

#### Inherited from

[`AccessList`](https://botmesh.afaya.com.co/api/core/classes/AccessList).[`add`](https://botmesh.afaya.com.co/api/core/classes/AccessList#add)

***

### remove()

```ts theme={null}
remove(ids): this;
```

Defined in: [gates/accessList.ts:134](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L134)

Remove one id or many. Unknown ids are ignored. Throws `TypeError` on an empty/non-string id.

#### Parameters

| Parameter | Type |
| - | - |
| `ids` | `string` \| readonly `string`\[] |

#### Returns

`this`

#### Inherited from

[`AccessList`](https://botmesh.afaya.com.co/api/core/classes/AccessList).[`remove`](https://botmesh.afaya.com.co/api/core/classes/AccessList#remove)

***

### has()

```ts theme={null}
has(id): boolean;
```

Defined in: [gates/accessList.ts:144](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L144)

Is `id` on the list? Exact, case-sensitive match. Never throws.

#### Parameters

| Parameter | Type |
| - | - |
| `id` | `string` |

#### Returns

`boolean`

#### Inherited from

[`AccessList`](https://botmesh.afaya.com.co/api/core/classes/AccessList).[`has`](https://botmesh.afaya.com.co/api/core/classes/AccessList#has)

***

### list()

```ts theme={null}
list(): string[];
```

Defined in: [gates/accessList.ts:149](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L149)

The ids on the list, in insertion order (a copy).

#### Returns

`string`\[]

#### Inherited from

[`AccessList`](https://botmesh.afaya.com.co/api/core/classes/AccessList).[`list`](https://botmesh.afaya.com.co/api/core/classes/AccessList#list)

***

### clear()

```ts theme={null}
clear(): this;
```

Defined in: [gates/accessList.ts:159](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L159)

Remove every id.

#### Returns

`this`

#### Inherited from

[`AccessList`](https://botmesh.afaya.com.co/api/core/classes/AccessList).[`clear`](https://botmesh.afaya.com.co/api/core/classes/AccessList#clear)

***

### onChange()

```ts theme={null}
onChange(listener): () => void;
```

Defined in: [gates/accessList.ts:188](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L188)

Subscribe to effective mutations (no-op calls do not notify). Returns an
unsubscriber. A throwing listener never breaks the mutation that triggered it.

#### Parameters

| Parameter | Type |
| - | - |
| `listener` | (`change`) => `void` |

#### Returns

() => `void`

#### Inherited from

[`AccessList`](https://botmesh.afaya.com.co/api/core/classes/AccessList).[`onChange`](https://botmesh.afaya.com.co/api/core/classes/AccessList#onchange)

***

### enable()

```ts theme={null}
enable(): this;
```

Defined in: [gates/accessList.ts:220](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L220)

Turn whitelist mode on.

#### Returns

`this`

***

### disable()

```ts theme={null}
disable(): this;
```

Defined in: [gates/accessList.ts:229](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L229)

Turn whitelist mode off (open access, subject to the blacklist).

#### Returns

`this`

***

### load()

```ts theme={null}
load(snapshot): this;
```

Defined in: [gates/accessList.ts:241](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L241)

Replace the contents from a snapshot. A bare id array, or a snapshot without
`enabled`, leaves the current mode untouched.

#### Parameters

| Parameter | Type |
| - | - |
| `snapshot` | \| readonly `string`\[] \| `Partial`\<[`WhitelistSnapshot`](https://botmesh.afaya.com.co/api/core/interfaces/WhitelistSnapshot)> |

#### Returns

`this`

#### Overrides

[`AccessList`](https://botmesh.afaya.com.co/api/core/classes/AccessList).[`load`](https://botmesh.afaya.com.co/api/core/classes/AccessList#load)

***

### export()

```ts theme={null}
export(): WhitelistSnapshot;
```

Defined in: [gates/accessList.ts:249](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L249)

JSON-serializable snapshot for host-side persistence.

#### Returns

[`WhitelistSnapshot`](https://botmesh.afaya.com.co/api/core/interfaces/WhitelistSnapshot)

#### Overrides

[`AccessList`](https://botmesh.afaya.com.co/api/core/classes/AccessList).[`export`](https://botmesh.afaya.com.co/api/core/classes/AccessList#export)

## Accessors

### size

#### Get Signature

```ts theme={null}
get size(): number;
```

Defined in: [gates/accessList.ts:154](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L154)

Number of ids on the list.

##### Returns

`number`

#### Inherited from

[`AccessList`](https://botmesh.afaya.com.co/api/core/classes/AccessList).[`size`](https://botmesh.afaya.com.co/api/core/classes/AccessList#size)

***

### enabled

#### Get Signature

```ts theme={null}
get enabled(): boolean;
```

Defined in: [gates/accessList.ts:215](https://github.com/andresayac/botmesh/blob/main/packages/core/src/gates/accessList.ts#L215)

Is whitelist mode active?

##### Returns

`boolean`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.