> ## Documentation Index
> Fetch the complete documentation index at: https://www.chapterjs.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Options

> Find every field you can pass to edit() and to the methods that create channels, threads, posts, roles and invites

The methods that create or change something take an options object. Its fields are the ones of Discord, written in camelCase; your editor completes them.

> [!NOTE]
>
> These options belong to the actions of [Guild](https://www.chapterjs.org/reference/guild.md), the [channels](https://www.chapterjs.org/reference/channels) and [Role](https://www.chapterjs.org/reference/role.md). What a message takes is in [Message options](https://www.chapterjs.org/reference/message-options.md), what a member takes in [GuildMember](https://www.chapterjs.org/reference/member.md#types).

A few rules hold everywhere:

* When editing, only what you pass changes. `null` removes a value where the type allows it.
* Images are data URIs: `data:image/png;base64,...`.
* Ids are `Snowflake`s: the `id` of a structure, or the text copied from Discord.
* Permissions are written by name (`'ManageThreads'`), never as numbers: see [Permissions](https://www.chapterjs.org/reference/permissions.md).

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
import type { Guild } from 'chapterjs';

async function setUp(guild: Guild) {
  const role = await guild.createRole({ name: 'Helper', permissions: ['ManageMessages'] });
  await guild.createChannel({ name: 'help', topic: `Ask ${role} anything` });
}
```

## GuildEditOptions

What `edit()` takes on a server: only what is passed changes. Images are data URIs (`data:image/png;base64,...`).

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
guild.edit(options: GuildEditOptions, reason?: string): Promise<Guild>
```

**name** `string`

The name of the server.

**verificationLevel** `VerificationLevel | null`

What Discord asks of new members before they can write: a value of [`VerificationLevel`](https://www.chapterjs.org/reference/enums#verificationlevel).

**defaultMessageNotifications** `DefaultMessageNotificationLevel | null`

Whether members get a notification for every message or only when they are mentioned, by default: a value of [`DefaultMessageNotificationLevel`](https://www.chapterjs.org/reference/enums#defaultmessagenotificationlevel).

**explicitContentFilter** `ExplicitContentFilterLevel | null`

Whose images and videos Discord scans for explicit content: a value of [`ExplicitContentFilterLevel`](https://www.chapterjs.org/reference/enums#explicitcontentfilterlevel).

**afkChannelId** `Snowflake | null`

The id of the voice channel inactive members are moved to.

**afkTimeout** `number`

After how many seconds of inactivity a member is moved there: `60`, `300`, `900`, `1800` or `3600`.

**icon** `string | null`

The icon: a 1024x1024 PNG, JPEG or GIF (an animated GIF only when the server has the `ANIMATED_ICON` feature).

**splash** `string | null`

The background of the invite page: a 16:9 PNG or JPEG (when the server has the `INVITE_SPLASH` feature).

**discoverySplash** `string | null`

The background shown in server discovery: a 16:9 PNG or JPEG (when the server has the `DISCOVERABLE` feature).

**banner** `string | null`

The banner: a 16:9 PNG or JPEG (when the server has the `BANNER` feature; an animated GIF when it has the `ANIMATED_BANNER` feature).

**systemChannelId** `Snowflake | null`

The id of the channel where Discord posts welcome messages and boost notices.

**systemChannelFlags** `number`

Which of those notices are hidden, as a bit field.

**rulesChannelId** `Snowflake | null`

The id of the channel that shows the rules, in a community server.

**publicUpdatesChannelId** `Snowflake | null`

The id of the channel where the admins and moderators of a community server receive notices from Discord.

**preferredLocale** `Locale | null`

The language of a community server, used in server discovery and in the notices Discord sends; `'en-US'` by default. A value of [`Locale`](https://www.chapterjs.org/reference/enums#locale).

**features** `GuildFeature[]`

The features enabled on the server: see [`GuildFeature`](https://www.chapterjs.org/reference/guild#types).

**description** `string | null`

The description of the server.

**premiumProgressBarEnabled** `boolean`

Whether the boost progress bar is shown.

**safetyAlertsChannelId** `Snowflake | null`

The id of the channel where the admins and moderators of a community server receive safety alerts from Discord.

[Discord documentation](https://docs.discord.com/developers/resources/guild#modify-guild-json-params)

## ChannelCreateOptions

What `createChannel()` takes: a name, a type, and the settings of that kind of channel.

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
guild.createChannel(options: ChannelCreateOptions, reason?: string): Promise<GuildChannel>
```

Only `name` is needed: without a `type`, Discord creates a text channel. The other fields only apply to the kind of channel they describe.

**name** `string` *required*

The name of the channel (1-100 characters).

**type** `ChannelType | null`

The kind of channel: a value of [`ChannelType`](https://www.chapterjs.org/reference/enums#channeltype).

**topic** `string | null`

The topic shown at the top of the channel (0-1024 characters).

**bitrate** `number | null`

The audio quality of a voice or stage channel, in bits per second; 8000 at least.

**userLimit** `number | null`

How many people can join a voice channel.

**rateLimitPerUser** `number | null`

Slowmode: how many seconds a member waits between two messages (0-21600). Bots and members with the `BypassSlowmode` permission are not affected.

**position** `number | null`

Where the channel is in the list (channels with the same position are sorted by id).

**permissionOverwrites** `object[] | null`

What roles and members are allowed or denied in the channel.

**fields of an overwrite**

**id** `Snowflake`

The id of the role or of the member.

**type** `0 | 1`

`0` for a role, `1` for a member.

**allow** `string`

What is allowed, as the text Discord expects: `new Permissions(['SendMessages']).toString()`.

**deny** `string`

What is denied, written the same way.

**parentId** `Snowflake | null`

The id of the category to put the channel in.

**nsfw** `boolean | null`

Whether the channel is age-restricted.

**rtcRegion** `string | null`

The voice region of a voice or stage channel; `null` lets Discord pick it.

**videoQualityMode** `VideoQualityMode | null`

The camera quality of a voice channel: a value of [`VideoQualityMode`](https://www.chapterjs.org/reference/enums#videoqualitymode).

**defaultAutoArchiveDuration** `number | null`

After how many minutes without activity the Discord app suggests archiving a new thread of the channel.

**defaultReactionEmoji** `object | null`

The emoji of the "add reaction" button on the posts of a forum or media channel.

**fields**

**emojiId** `Snowflake | null`

The id of a custom emoji of the server.

**emojiName** `string | null`

A standard emoji, as its character.

**availableTags** `ForumTag[] | null`

The tags the posts of a forum or media channel can have: see [`ForumTag`](https://www.chapterjs.org/reference/data#forumtag). A new tag has no `id` yet: Discord gives it one.

**defaultSortOrder** `ForumSortOrderType | null`

How the posts of a forum or media channel are ordered: a value of [`ForumSortOrderType`](https://www.chapterjs.org/reference/enums#forumsortordertype).

**defaultForumLayout** `ForumLayoutType | null`

How the posts of a forum are displayed: a value of [`ForumLayoutType`](https://www.chapterjs.org/reference/enums#forumlayouttype).

**defaultThreadRateLimitPerUser** `number | null`

The slowmode given to new threads of the channel. It is copied when the thread is created and does not follow later changes.

**flags** `number | null`

The flags of the channel, as a bit field.

[Discord documentation](https://docs.discord.com/developers/resources/guild#create-guild-channel-json-params)

## GuildChannelEditOptions

What `edit()` takes on a channel of a server.

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
channel.edit(options: GuildChannelEditOptions, reason?: string): Promise<this>
```

It works on every channel of a server that is not a thread: text, voice, category and forum channels. A field that does not apply to the kind of channel is refused by Discord.

**name** `string`

The name of the channel (1-100 characters).

**type** `ChannelType`

The kind of channel: a value of [`ChannelType`](https://www.chapterjs.org/reference/enums#channeltype). Only a text channel can become an announcement channel and back, in a server that has the `NEWS` feature.

**position** `number | null`

Where the channel is in the list (channels with the same position are sorted by id).

**topic** `string | null`

The topic shown at the top of the channel: 0-1024 characters, or 0-4096 for a forum or media channel.

**nsfw** `boolean | null`

Whether the channel is age-restricted.

**rateLimitPerUser** `number | null`

Slowmode: how many seconds a member waits between two messages (0-21600). Bots and members with the `BypassSlowmode` permission are not affected.

**bitrate** `number | null`

The audio quality of a voice or stage channel, in bits per second; 8000 at least.

**userLimit** `number | null`

How many people can join: up to 99 in a voice channel, 10,000 in a stage channel; `0` means no limit.

**permissionOverwrites** `object[] | null`

What roles and members are allowed or denied in the channel or the category: the same objects as in [`ChannelCreateOptions`](#channelcreateoptions).

**parentId** `Snowflake | null`

The id of the category to move the channel to.

**rtcRegion** `string | null`

The voice region of the channel; `null` lets Discord pick it.

**videoQualityMode** `VideoQualityMode | null`

The camera quality of a voice channel: a value of [`VideoQualityMode`](https://www.chapterjs.org/reference/enums#videoqualitymode).

**defaultAutoArchiveDuration** `number | null`

After how many minutes without activity the Discord app suggests archiving a new thread of the channel.

**flags** `number`

The flags of the channel, as a bit field.

**availableTags** `ForumTag[]`

The tags the posts of a forum or media channel can have, 20 at most: see [`ForumTag`](https://www.chapterjs.org/reference/data#forumtag). A tag without `id` is a new one; the others keep theirs.

**defaultReactionEmoji** `object | null`

The emoji of the "add reaction" button on the posts of a forum or media channel: `{ emojiId, emojiName }`, as in [`ChannelCreateOptions`](#channelcreateoptions).

**defaultThreadRateLimitPerUser** `number`

The slowmode given to new threads of the channel. It is copied when the thread is created and does not follow later changes.

**defaultSortOrder** `ForumSortOrderType | null`

How the posts of a forum or media channel are ordered: a value of [`ForumSortOrderType`](https://www.chapterjs.org/reference/enums#forumsortordertype).

**defaultForumLayout** `ForumLayoutType`

How the posts of a forum are displayed: a value of [`ForumLayoutType`](https://www.chapterjs.org/reference/enums#forumlayouttype).

[Discord documentation](https://docs.discord.com/developers/resources/channel#modify-channel-json-params-guild-channel)

## ThreadCreateOptions

What `startThread()` takes on a text channel.

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
textChannel.startThread(options: ThreadCreateOptions, reason?: string): Promise<ThreadChannel>
```

To start a thread from a message, use `message.startThread()` instead: see [Message](https://www.chapterjs.org/reference/message.md).

**name** `string` *required*

The name of the thread (1-100 characters).

**autoArchiveDuration** `number`

After how many minutes without activity the thread leaves the channel list: `60`, `1440`, `4320` or `10080`.

**type** `ChannelType`

The kind of thread: `ChannelType.PublicThread`, `ChannelType.PrivateThread` or `ChannelType.AnnouncementThread` (see [`ChannelType`](https://www.chapterjs.org/reference/enums#channeltype)).

**invitable** `boolean`

Whether members who are not moderators can add other members to the thread. Only for a private thread.

**rateLimitPerUser** `number | null`

Slowmode: how many seconds a member waits between two messages (0-21600).

[Discord documentation](https://docs.discord.com/developers/resources/channel#start-thread-without-message-json-params)

## ThreadEditOptions

What `edit()` takes on a thread.

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
thread.edit(options: ThreadEditOptions, reason?: string): Promise<this>
```

`thread.archive()` and `thread.unarchive()` are shortcuts for `{ archived: true }` and `{ archived: false }`.

**name** `string`

The name of the thread (1-100 characters).

**archived** `boolean`

Whether the thread is archived.

**autoArchiveDuration** `number`

After how many minutes without activity the thread leaves the channel list: `60`, `1440`, `4320` or `10080`.

**locked** `boolean`

Whether the thread is locked: only members with the `ManageThreads` permission can then unarchive it.

**invitable** `boolean`

Whether members who are not moderators can add other members to the thread. Only for a private thread.

**rateLimitPerUser** `number | null`

Slowmode: how many seconds a member waits between two messages (0-21600). Bots and members with the `BypassSlowmode` permission are not affected.

**flags** `number`

The flags of the thread, as a bit field. Only a post of a forum or media channel can be pinned this way.

**appliedTags** `Snowflake[]`

The ids of the tags of a post of a forum or media channel, 5 at most.

[Discord documentation](https://docs.discord.com/developers/resources/channel#modify-channel-json-params-thread)

## ForumPostOptions

What `createPost()` takes.

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
forum.createPost(options: ForumPostOptions, reason?: string): Promise<ThreadChannel>
```

**name** `string` *required*

The title of the post.

**message** `MessageInput` *required*

The first message of the post: a text, or everything a message can contain (see [`MessageInput`](https://www.chapterjs.org/reference/message-options#messageinput)).

**appliedTags** `Snowflake[]`

The ids of the tags of the post.

**autoArchiveDuration** `60 | 1440 | 4320 | 10080`

After how many minutes without activity the post is archived.

**slowmode** `number`

Slowmode of the post, in seconds.

The message is checked like any other before it is sent: see [Message options](https://www.chapterjs.org/reference/message-options.md).

[Discord documentation](https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel-jsonform-params)

## RoleCreateOptions

What `createRole()` takes. Permissions are given by name, as a list of names or as a `Permissions` set.

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
guild.createRole(options?: RoleCreateOptions, reason?: string): Promise<Role>
```

Every field can be left out: `guild.createRole()` creates a role with the defaults of Discord.

**name** `string`

The name of the role, 100 characters at most.

**permissions** `PermissionResolvable | string`

What the role allows: a name, a list of names, a `Permissions` set, or the text Discord uses. See [`PermissionResolvable`](https://www.chapterjs.org/reference/permissions#permissionresolvable).

**colors** `object`

The colors of the role.

**fields**

**primaryColor** `number` *required*

The main color, as a number (`0xff0000` for red).

**secondaryColor** `number | null`

A second color: the role is then shown as a gradient between the two.

**tertiaryColor** `number | null`

A third color: the gradient then becomes holographic.

**hoist** `boolean`

Whether members with the role are shown apart in the member list.

**icon** `string | null`

The icon of the role, as a data URI (when the server has the `ROLE_ICONS` feature).

**unicodeEmoji** `string | null`

A standard emoji shown as the icon of the role (when the server has the `ROLE_ICONS` feature).

**mentionable** `boolean`

Whether everyone can mention the role.

[Discord documentation](https://docs.discord.com/developers/resources/guild#create-guild-role-json-params)

## RoleEditOptions

What `edit()` takes on a role: only what is passed changes. Permissions are given by name, as a list of names or as a `Permissions` set.

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
role.edit(options: RoleEditOptions, reason?: string): Promise<Role>
```

**name** `string`

The name of the role, 100 characters at most.

**permissions** `PermissionResolvable | string`

What the role allows: a name, a list of names, a `Permissions` set, or the text Discord uses. It replaces the permissions of the role: start from `role.permissions.add()` or `.remove()` to change one. See [`PermissionResolvable`](https://www.chapterjs.org/reference/permissions#permissionresolvable).

**colors** `object`

The colors of the role: `{ primaryColor, secondaryColor, tertiaryColor }`, as in [`RoleCreateOptions`](#rolecreateoptions).

**hoist** `boolean`

Whether members with the role are shown apart in the member list.

**icon** `string`

The icon of the role, as a data URI (when the server has the `ROLE_ICONS` feature).

**unicodeEmoji** `string`

A standard emoji shown as the icon of the role (when the server has the `ROLE_ICONS` feature).

**mentionable** `boolean`

Whether everyone can mention the role.

[Discord documentation](https://docs.discord.com/developers/resources/guild#modify-guild-role-json-params)

## InviteCreateOptions

What `createInvite()` takes.

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
channel.createInvite(options?: InviteCreateOptions, reason?: string): Promise<Invite>
```

Every field can be left out: `channel.createInvite()` creates an invite with the defaults of Discord.

**maxAge** `number`

After how many seconds the invite expires, from 0 (never) to 604800 (7 days).

**maxUses** `number`

How many times it can be used, from 0 (no limit) to 100.

**temporary** `boolean`

Whether the invite only grants a temporary membership: members who join with it are kicked when they go offline.

**unique** `boolean`

`true` to always create a new link, instead of reusing a similar one that already exists. Useful for many one-time links.

**targetType** `1 | 2`

What a voice channel invite opens: `1` a stream, `2` an embedded activity.

**targetUserId** `Snowflake`

The id of the user whose stream to show. Needed when `targetType` is `1`; the user must be streaming in the channel.

**targetApplicationId** `Snowflake`

The id of the activity to open. Needed when `targetType` is `2`; the application must have the `EMBEDDED` flag.

**targetUserIds** `Snowflake[]`

The ids of the only users who can see and accept the invite, 1000 at most.

**roleIds** `Snowflake[]`

The ids of the roles given to whoever joins with the invite.

[Discord documentation](https://docs.discord.com/developers/resources/channel#create-channel-invite-jsonform-params)

## FetchMessagesOptions

What `fetchMessages()` takes: how many messages, and from where.

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
channel.fetchMessages(options?: FetchMessagesOptions): Promise<Message[]>
```

**limit** `number`

How many messages, from 1 to 100. Default: 50.

**before** `Snowflake | \{ id: Snowflake \}`

Only messages before this one.

**after** `Snowflake | \{ id: Snowflake \}`

Only messages after this one.

**around** `Snowflake | \{ id: Snowflake \}`

Messages around this one.

`limit` is checked before anything is sent. A wrong one throws a `RangeError`:

```text theme={"theme":{"light":"github-light","dark":"vesper"}}
limit is a whole number between 1 and 100, got 500.
```

To start from a date rather than from a message, turn the date into an id with [`snowflakeFromTimestamp()`](https://www.chapterjs.org/reference/helpers#snowflakefromtimestamp).

[Discord documentation](https://docs.discord.com/developers/resources/message#get-channel-messages-query-string-params)


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