---
url: https://docs.juniper.bot/en/message-templates/types/discord/menu-builder.md
description: Discord MenuBuilder data type used in JuniperBot Template Engine.
---

[Number]: /en/message-templates/types/index#literals

[String]: /en/message-templates/types/index#literals

[Boolean]: /en/message-templates/types/index#literals

[List]: /en/message-templates/types/index#lists

[Map]: /en/message-templates/types/index#maps

[DateTime]: /en/message-templates/types/index#datetime

[TwitchChannel]: /en/message-templates/types/subscriptions/twitch#twitch-channel

[TwitchStream]: /en/message-templates/types/subscriptions/twitch#twitch-stream

[TwitchGame]: /en/message-templates/types/subscriptions/twitch#twitch-game

[YouTubeChannel]: /en/message-templates/types/subscriptions/youtube#youtube-channel

[YouTubeVideo]: /en/message-templates/types/subscriptions/youtube#youtube-video

[VkWallPost]: /en/message-templates/types/subscriptions/vk#vkwallpost

[Rank]: /en/message-templates/types/discord/rank

[Guild]: /en/message-templates/types/discord/guild

[Member]: /en/message-templates/types/discord/member

[Role]: /en/message-templates/types/discord/role

[Message]: /en/message-templates/types/discord/message

[Attachment]: /en/message-templates/types/discord/attachment

[Embed]: /en/message-templates/types/discord/embed

[Activity]: /en/message-templates/types/discord/activity

[MemberVoiceState]: /en/message-templates/types/discord/member-voice-state

[MemberPrimaryGuild]: /en/message-templates/types/discord/member-primary-guild

[MenuBuilder]: /en/message-templates/types/discord/menu-builder

[UserFlag]: /en/message-templates/types/discord/user-flag

[Permission]: /en/message-templates/types/discord/permission

[Category]: /en/message-templates/types/discord/category

[TextChannel]: /en/message-templates/types/discord/text-channel

[VoiceChannel]: /en/message-templates/types/discord/voice-channel

[NewsChannel]: /en/message-templates/types/discord/news-channel

[StageChannel]: /en/message-templates/types/discord/stage-channel

[ForumChannel]: /en/message-templates/types/discord/forum-channel

[MediaChannel]: /en/message-templates/types/discord/media-channel

[ThreadChannel]: /en/message-templates/types/discord/thread-channel

[Page]: /en/message-templates/types/storage/page

[GuildIndex]: /en/message-templates/types/storage/guild-index

[GuildIndexEntry]: /en/message-templates/types/storage/guild-index-entry

[GuildIndexes]: /en/message-templates/types/storage/guild-indexes

[MemberAttribute]: /en/message-templates/types/storage/member-attribute

[MemberAttributes]: /en/message-templates/types/storage/member-attributes

[Arguments]: /en/message-templates/types/custom-commands/arguments

[Parameters]: /en/message-templates/types/custom-commands/parameters

[Component]: /en/message-templates/types/custom-commands/component

[Modal]: /en/message-templates/types/custom-commands/modal

# MenuBuilder

::: tip Bonus Feature
Selection Menus are only available for servers with [bonus](https://juniper.bot/donate)!
:::

This data type describes the selection menu builder. Almost all the methods return the same builder, so it is possible to build a method chains like this:

```template
{% do channel
    .createEmbed()
    .withDescription('Oh, hi!')
    .addSelectMenu('STRING', 'selectedSpecies', 'Who are you?', '27a55ca1-c13b-47f5-b8ad-e0da6329a53f')
      .addOption('Otter', 'otterOption', ':otter:')
      .addOption('Fox', 'foxOption', ':fox_face:')
      .withDefaultOption('foxOption')
    .endMenu()
    .send()
%}
```

## Methods { #methods }

### `withMinValues(Amount)` { #method-withminvalues .template-method }

::: tabs

\== Description | mdi-text

Sets the minimum amount of values user has to select (0-25, 1 by default).

**Returns:** \[MenuBuilder]

\== Parameters | mdi-code-parentheses

| Parameter | Type     | Description                  |
|:----------|:---------|:-----------------------------|
| `Amount`  | \[Number] | The minimum amount of values |

\== Example | mdi-code-block-braces

```template{5}
{% do channel
    .createEmbed()
    .withDescription('Oh, hi!')
    .addSelectMenu('CHANNEL', 'selectedChannels', 'Select channels', '27a55ca1-c13b-47f5-b8ad-e0da6329a53f')
      .withMinValues(2)
      .withMaxValues(3)
      .withChannelTypes(['VOICE', 'TEXT'])
    .endMenu()
    .send()
%}
```

:::

### `withMaxValues(Amount)` { #method-withmaxvalues .template-method }

::: tabs

\== Description | mdi-text

Sets the maximum amount of values user can select at once (1-25, 1 by default).

**Returns:** \[MenuBuilder]

\== Parameters | mdi-code-parentheses

| Parameter | Type     | Description                  |
|:----------|:---------|:-----------------------------|
| `Amount`  | \[Number] | The maximum amount of values |

\== Example | mdi-code-block-braces

```template{6}
{% do channel
    .createEmbed()
    .withDescription('Oh, hi!')
    .addSelectMenu('CHANNEL', 'selectedChannels', 'Select channels', '27a55ca1-c13b-47f5-b8ad-e0da6329a53f')
      .withMinValues(2)
      .withMaxValues(3)
      .withChannelTypes(['VOICE', 'TEXT'])
    .endMenu()
    .send()
%}
```

:::

### `withRequiredRange(Minimum, Maximum)` { #method-withrequiredrange .template-method }

::: tabs

\== Description | mdi-text

Sets the range of values user has to select (two previous methods combined).

**Returns:** \[MenuBuilder]

\== Parameters | mdi-code-parentheses

| Parameter | Type     | Description                                       |
|:----------|:---------|:--------------------------------------------------|
| `Minimum` | \[Number] | The minimum amount of values (0-25, 1 by default) |
| `Maximum` | \[Number] | The maximum amount of values (1-25, 1 by default) |

\== Example | mdi-code-block-braces

```template{5}
{% do channel
    .createEmbed()
    .withDescription('Oh, hi!')
    .addSelectMenu('CHANNEL', 'selectedChannels', 'Select channels', '27a55ca1-c13b-47f5-b8ad-e0da6329a53f')
      .withRequiredRange(2, 3)
      .withChannelTypes(['VOICE', 'TEXT'])
    .endMenu()
    .send()
%}
```

:::

### `addOption(Label, Value, Emote, Description)` { #method-addoption .template-method }

::: tabs

\== Description | mdi-text

Adds a new selection options for menus of `STRING` type (25 at max).

**Returns:** \[MenuBuilder]

\== Parameters | mdi-code-parentheses

| Parameter     | Type     | Description                                                                                                                                                                                                                             |
|:--------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Label`       | \[String] | Option label                                                                                                                                                                                                                            |
| `Value`       | \[String] | Option value                                                                                                                                                                                                                            |
| `Emote`       | \[String] | Emotion in the following formats:`🦊` — Unicode-character;`:fox_face:` — name of emotion including default and server's emojis;`<a:foxwaggy:695917473874051112>` — custom emoji code.(Optional) |
| `Description` | \[String] | Option description(Optional)                                                                                                                                                                                                       |

\== Example | mdi-code-block-braces

```template{5,6}
{% do channel
    .createEmbed()
    .withDescription('Oh, hi!')
    .addSelectMenu('STRING', 'selectedSpecies', 'Who are you?', '27a55ca1-c13b-47f5-b8ad-e0da6329a53f')
      .addOption('Otter', 'otterOption', ':otter:')
      .addOption('Fox', 'foxOption', ':fox_face:')
    .endMenu()
    .send()
%}
```

:::

### `withDefaultOptions(Options)` { #method-withdefaultoptions .template-method }

::: tabs

\== Description | mdi-text

Sets options selected by default.

**Returns:** \[MenuBuilder]

\== Parameters | mdi-code-parentheses

| Parameter | Type             | Description                                                                                                                                            |
|:----------|:-----------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Options` | \[List]<\[String]> | For `STRING` menus it's values of options;For other menu types it's identifiers of channels, roles or members |

\== Example | mdi-code-block-braces

```template{9}
{% do channel
    .createEmbed()
    .withDescription('Oh, hi!')
    .addSelectMenu('STRING', 'selectedSpecies', 'What are the best?', '27a55ca1-c13b-47f5-b8ad-e0da6329a53f')
      .addOption('Otter', 'otterOption', ':otter:')
      .addOption('Fox', 'foxOption', ':fox_face:')
      .addOption('Bee', 'beeOption', ':bee:')
      .withMaxValues(3)
      .withDefaultOptions(['foxOption', 'otterOption'])
    .endMenu()
    .send()
%}
```

:::

### `withDefaultOption(Option)` { #method-withdefaultoption .template-method }

::: tabs

\== Description | mdi-text

Sets single option selected by default.

**Returns:** \[MenuBuilder]

\== Parameters | mdi-code-parentheses

| Parameter | Type     | Description                                                                                                                                     |
|:----------|:---------|:------------------------------------------------------------------------------------------------------------------------------------------------|
| `Option`  | \[String] | For `STRING` menu it's value of option;For other menu types it's identifier of channel, role or member |

\== Example | mdi-code-block-braces

```template{7}
{% do channel
    .createEmbed()
    .withDescription('Oh, hi!')
    .addSelectMenu('STRING', 'selectedSpecies', 'Who are you?', '27a55ca1-c13b-47f5-b8ad-e0da6329a53f')
      .addOption('Otter', 'otterOption', ':otter:')
      .addOption('Fox', 'foxOption', ':fox_face:')
      .withDefaultOption('foxOption')
    .endMenu()
    .send()
%}
```

:::

### `withChannelTypes(Types)` { #method-withchanneltypes .template-method }

::: tabs

\== Description | mdi-text

Sets channels type for `CHANNEL` menu.

**Returns:** \[MenuBuilder]

\== Parameters | mdi-code-parentheses

| Parameter | Type             | Description                                                                                                                               |
|:----------|:-----------------|:------------------------------------------------------------------------------------------------------------------------------------------|
| `Types`   | \[List]<\[String]> | Possible values are:`TEXT`;`NEWS`;`VOICE`;`STAGE`;`CATEGORY`;`FORUM`. |

\== Example | mdi-code-block-braces

```template{6}
{% do channel
    .createEmbed()
    .withDescription('Oh, hi!')
    .addSelectMenu('CHANNEL', 'selectedChannels', 'Select channels', '27a55ca1-c13b-47f5-b8ad-e0da6329a53f')
      .withRequiredRange(2, 3)
      .withChannelTypes(['VOICE', 'TEXT'])
    .endMenu()
    .send()
%}
```

:::

### `withChannelType(Type)` { #method-withchanneltype .template-method }

::: tabs

\== Description | mdi-text

Sets single channel type for `CHANNEL` menu.

**Returns:** \[MenuBuilder]

\== Parameters | mdi-code-parentheses

| Parameter | Type     | Description                                                                                                                             |
|:----------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------|
| `Type`    | \[String] | Possible value is:`TEXT`;`NEWS`;`VOICE`;`STAGE`;`CATEGORY`;`FORUM`. |

\== Example | mdi-code-block-braces

```template{6}
{% do channel
    .createEmbed()
    .withDescription('Oh, hi!')
    .addSelectMenu('CHANNEL', 'selectedChannels', 'Select channels', '27a55ca1-c13b-47f5-b8ad-e0da6329a53f')
      .withRequiredRange(2, 3)
      .withChannelType('TEXT')
    .endMenu()
    .send()
%}
```

:::

### `endMenu()` { #method-endmenu .template-method }

::: tabs

\== Description | mdi-text

Returns an Embed object related to this menu. Used to continue the method chain for Embed.

**Returns:** \[Embed]

\== Example | mdi-code-block-braces

```template{7}
{% do channel
    .createEmbed()
    .withDescription('Oh, hi!')
    .addSelectMenu('STRING', 'selectedSpecies', 'Who are you?', '27a55ca1-c13b-47f5-b8ad-e0da6329a53f')
      .addOption('Otter', 'otterOption', ':otter:')
      .addOption('Fox', 'foxOption', ':fox_face:')
    .endMenu()
    .send()
%}
```

:::
