# Community

Defined in: [zaun/js/index.d.ts:81](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L81)

## Constructors

### Constructor

> **new Community**(): `Community`

#### Returns

`Community`

## Properties

### bots

> `readonly` **bots**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>

Defined in: [zaun/js/index.d.ts:108](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L108)

Installed bots' public cards, as last heard.

***

### channels

> `readonly` **channels**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Channel`](/docs/reference/js/zaun-client/classes/channel/)\> & `object`

Defined in: [zaun/js/index.d.ts:88](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L88)

#### Type Declaration

##### create()

> **create**(`name`, `options?`): `Promise`\<[`Channel`](/docs/reference/js/zaun-client/classes/channel/)\>

###### Parameters

###### name

`string`

###### options?

###### parent?

`string` \| [`Channel`](/docs/reference/js/zaun-client/classes/channel/)

###### type?

`"text"` \| `"announcement"` \| `"voice"` \| `"category"`

###### Returns

`Promise`\<[`Channel`](/docs/reference/js/zaun-client/classes/channel/)\>

***

### client

> `readonly` **client**: [`Client`](/docs/reference/js/zaun-client/classes/client/)

Defined in: [zaun/js/index.d.ts:82](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L82)

***

### commands

> `readonly` **commands**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/)\>

Defined in: [zaun/js/index.d.ts:106](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L106)

Bot commands in this community, as last heard (each with its `bot_id`).

***

### data

> `readonly` **data**: `any`

Defined in: [zaun/js/index.d.ts:96](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L96)

The cache as plain data.

***

### description

> `readonly` **description**: `string`

Defined in: [zaun/js/index.d.ts:85](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L85)

***

### dms

> `readonly` **dms**: [`Channel`](/docs/reference/js/zaun-client/classes/channel/)[]

Defined in: [zaun/js/index.d.ts:137](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L137)

DM: this member's open direct messages with bots, from the cache.

***

### id

> `readonly` **id**: `string`

Defined in: [zaun/js/index.d.ts:83](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L83)

***

### isOwner

> `readonly` **isOwner**: `boolean`

Defined in: [zaun/js/index.d.ts:86](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L86)

***

### me

> `readonly` **me**: [`Member`](/docs/reference/js/zaun-client/classes/member/)

Defined in: [zaun/js/index.d.ts:87](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L87)

***

### members

> `readonly` **members**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Member`](/docs/reference/js/zaun-client/classes/member/)\> & `object`

Defined in: [zaun/js/index.d.ts:94](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L94)

#### Type Declaration

##### fetch()

> **fetch**(): `Promise`\<[`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Member`](/docs/reference/js/zaun-client/classes/member/)\>\>

###### Returns

`Promise`\<[`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Member`](/docs/reference/js/zaun-client/classes/member/)\>\>

***

### name

> `readonly` **name**: `string`

Defined in: [zaun/js/index.d.ts:84](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L84)

***

### presences

> `readonly` **presences**: ([`Presence`](/docs/reference/js/zaun-client/interfaces/presence/) & `object`)[]

Defined in: [zaun/js/index.d.ts:113](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L113)

presence: every member not offline.

***

### roles

> `readonly` **roles**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Role`](/docs/reference/js/zaun-client/classes/role/)\> & `object`

Defined in: [zaun/js/index.d.ts:91](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L91)

#### Type Declaration

##### create()

> **create**(`name`, `options?`): `Promise`\<[`Role`](/docs/reference/js/zaun-client/classes/role/)\>

###### Parameters

###### name

`string`

###### options?

###### permissions?

[`PermissionResolvable`](/docs/reference/js/zaun-client/type-aliases/permissionresolvable/)

###### Returns

`Promise`\<[`Role`](/docs/reference/js/zaun-client/classes/role/)\>

## Methods

### bot()

> **bot**(`botId`): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>

Defined in: [zaun/js/index.d.ts:110](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L110)

#### Parameters

##### botId

`string`

#### Returns

`Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>

***

### botConfig()

> **botConfig**(`bot`): `Promise`\<`Record`\<`string`, `string`\>\>

Defined in: [zaun/js/index.d.ts:131](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L131)

Owner only: the values set for a bot's settings (secrets as `"••••"`); a key not
there uses its card's `default`.

#### Parameters

##### bot

`string` \| [`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)

#### Returns

`Promise`\<`Record`\<`string`, `string`\>\>

***

### channel()

> **channel**(`id`): [`Channel`](/docs/reference/js/zaun-client/classes/channel/)

Defined in: [zaun/js/index.d.ts:97](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L97)

#### Parameters

##### id

`string`

#### Returns

[`Channel`](/docs/reference/js/zaun-client/classes/channel/)

***

### configureBot()

> **configureBot**(`bot`, `values`): `Promise`\<`Record`\<`string`, `string`\>\>

Defined in: [zaun/js/index.d.ts:128](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L128)

Owner only: sets or clears (`null`: back to the card's `default`) the values of the
settings a bot declares (`BotCard.config`); resolves with every value the owner has set,
a secret one as `"••••"` (write-only). Rejects with `FORBIDDEN` (not the owner),
`NOT_FOUND`, or `BAD_REQUEST` for a key the bot does not declare. zaun-host 0.4.0.

#### Parameters

##### bot

`string` \| [`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)

##### values

`Record`\<`string`, `string` \| `null`\>

#### Returns

`Promise`\<`Record`\<`string`, `string`\>\>

***

### createInvite()

> **createInvite**(`options?`): `Promise`\<`string`\>

Defined in: [zaun/js/index.d.ts:100](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L100)

#### Parameters

##### options?

###### expiresIn?

`number`

###### maxUses?

`number`

#### Returns

`Promise`\<`string`\>

***

### disableBot()

> **disableBot**(`botId`): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>

Defined in: [zaun/js/index.d.ts:122](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L122)

#### Parameters

##### botId

`string`

#### Returns

`Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>

***

### dmSettings()

> **dmSettings**(): `Promise`\<[`DmSettings`](/docs/reference/js/zaun-client/interfaces/dmsettings/)\>

Defined in: [zaun/js/index.d.ts:141](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L141)

DM: whether bots may open DMs with this member.

#### Returns

`Promise`\<[`DmSettings`](/docs/reference/js/zaun-client/interfaces/dmsettings/)\>

***

### enableBot()

> **enableBot**(`botId`): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>

Defined in: [zaun/js/index.d.ts:121](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L121)

#### Parameters

##### botId

`string`

#### Returns

`Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>

***

### fetchBots()

> **fetchBots**(): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)[]\>

Defined in: [zaun/js/index.d.ts:109](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L109)

#### Returns

`Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)[]\>

***

### fetchDms()

> **fetchDms**(): `Promise`\<[`Channel`](/docs/reference/js/zaun-client/classes/channel/)[]\>

Defined in: [zaun/js/index.d.ts:139](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L139)

DM: reloads the open DMs from the host.

#### Returns

`Promise`\<[`Channel`](/docs/reference/js/zaun-client/classes/channel/)[]\>

***

### grantBot()

> **grantBot**(`botId`, `grants`): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>

Defined in: [zaun/js/index.d.ts:120](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L120)

#### Parameters

##### botId

`string`

##### grants

###### capabilities?

[`BotCapabilities`](/docs/reference/js/zaun-client/interfaces/botcapabilities/)

###### permissions?

[`PermissionResolvable`](/docs/reference/js/zaun-client/type-aliases/permissionresolvable/)

#### Returns

`Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>

***

### installBot()

> **installBot**(`pkg`, `options?`): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>

Defined in: [zaun/js/index.d.ts:118](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L118)

Owner only: installs the `.zbot` uploaded as attachment `pkg`, with the registry `source`
it was verified against, if any.

#### Parameters

##### pkg

`string`

##### options?

###### grants?

\{ `capabilities?`: [`BotCapabilities`](/docs/reference/js/zaun-client/interfaces/botcapabilities/); `permissions?`: `string`; \}

###### grants.capabilities?

[`BotCapabilities`](/docs/reference/js/zaun-client/interfaces/botcapabilities/)

###### grants.permissions?

`string`

###### rolePosition?

`number`

###### source?

[`InstallSource`](/docs/reference/js/zaun-client/interfaces/installsource/)

#### Returns

`Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>

***

### leave()

> **leave**(): `Promise`\<`void`\>

Defined in: [zaun/js/index.d.ts:104](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L104)

Leaves (the owner cannot). Once the host accepts, the community is forgotten here: its
state and member key leave the store, `communityDelete` follows with `{ t: "left" }`, and
a later join of it from the same store starts afresh.

#### Returns

`Promise`\<`void`\>

***

### member()

> **member**(`id`): [`Member`](/docs/reference/js/zaun-client/classes/member/)

Defined in: [zaun/js/index.d.ts:98](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L98)

#### Parameters

##### id

`string`

#### Returns

[`Member`](/docs/reference/js/zaun-client/classes/member/)

***

### registerBot()

> **registerBot**(`member`, `name?`): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>

Defined in: [zaun/js/index.d.ts:133](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L133)

Owner only: marks a member connected over SimpleX as an external bot.

#### Parameters

##### member

`string` \| [`Member`](/docs/reference/js/zaun-client/classes/member/)

##### name?

`string`

#### Returns

`Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>

***

### removeBot()

> **removeBot**(`botId`, `options?`): `Promise`\<`void`\>

Defined in: [zaun/js/index.d.ts:123](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L123)

#### Parameters

##### botId

`string`

##### options?

###### keepData?

`boolean`

#### Returns

`Promise`\<`void`\>

***

### role()

> **role**(`id`): [`Role`](/docs/reference/js/zaun-client/classes/role/)

Defined in: [zaun/js/index.d.ts:99](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L99)

#### Parameters

##### id

`string`

#### Returns

[`Role`](/docs/reference/js/zaun-client/classes/role/)

***

### setCommands()

> **setCommands**(`commands`): `Promise`\<[`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/)[]\>

Defined in: [zaun/js/index.d.ts:135](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L135)

As a bot: replaces this bot's commands.

#### Parameters

##### commands

([`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/) \| [`CommandBuilder`](/docs/reference/js/zaun-client/classes/commandbuilder/))[]

#### Returns

`Promise`\<[`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/)[]\>

***

### setDmsFromBots()

> **setDmsFromBots**(`allow`): `Promise`\<[`DmSettings`](/docs/reference/js/zaun-client/interfaces/dmsettings/)\>

Defined in: [zaun/js/index.d.ts:142](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L142)

#### Parameters

##### allow

`boolean`

#### Returns

`Promise`\<[`DmSettings`](/docs/reference/js/zaun-client/interfaces/dmsettings/)\>

***

### setStatusText()

> **setStatusText**(`text`, `options?`): `Promise`\<`any`\>

Defined in: [zaun/js/index.d.ts:115](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L115)

Sets this member's custom status here; no text and no emoji clears it.

#### Parameters

##### text

`string`

##### options?

###### emoji?

`string`

###### expiresAt?

`number` \| `Date`

#### Returns

`Promise`\<`any`\>

***

### updateBot()

> **updateBot**(`botId`, `pkg`, `options?`): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>

Defined in: [zaun/js/index.d.ts:119](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L119)

#### Parameters

##### botId

`string`

##### pkg

`string`

##### options?

###### source?

[`InstallSource`](/docs/reference/js/zaun-client/interfaces/installsource/)

#### Returns

`Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\>
