---
url: https://docs.juniper.bot/en/message-templates/types/discord/member.md
description: Discord Member 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

# Member

This data type describes all available data about the member and operations over them.

## Properties { #properties }

| Property         | Type                 | Description                                           |
|:-----------------|:---------------------|:------------------------------------------------------|
| `id`             | \[Number]             | Unique identifier                                     |
| `mention`        | \[String]             | Mention string                                        |
| `name`           | \[String]             | Name                                                  |
| `displayName`    | \[String]             | Display Name                                          |
| `nickname`       | \[String]             | Nickname on the server or original name               |
| `tag`            | \[String]             | Full tag in the format `Nickname#1234`                |
| `bot`            | \[Boolean]            | `true` if this member is bot                          |
| `moderator`      | \[Boolean]            | `true` if this member is server moderator             |
| `discriminator`  | \[String]             | Discriminator (4 digits after #)                      |
| `joinedAt`       | \[DateTime]           | Join date and time                                    |
| `createdAt`      | \[DateTime]           | Registration date and time                            |
| `status`         | \[String]             | Status (Online, Idle, DnD, Offline)                   |
| `avatarUrl`      | \[String]             | Avatar URL                                            |
| `guildAvatarUrl` | \[String]             | Per-Guild Avatar URL or original one if it is not set |
| `bannerUrl`      | \[String]             | Profile Banner URL                                    |
| `accentColor`    | \[String]             | Profile Accent Color in `#RRGGBB` format              |
| `bio`            | \[String]             | Bio specified in `/user`                              |
| `rank`           | \[Rank]               | Ranking data                                          |
| `roles`          | \[List]<\[Role]>       | List of assigned roles                                |
| `guild`          | \[Guild]              | Server information                                    |
| `attributes`     | \[MemberAttributes]   | Attributes storage                                    |
| `activities`     | \[List]<\[Activity]>   | Member activities                                     |
| `voiceState`     | \[MemberVoiceState]   | Member voice channel connectivity state               |
| `primaryGuild`   | \[MemberPrimaryGuild] | Member primary guild (Server Tag)                     |
| `flags`          | \[List]<\[UserFlag]>   | Member flags                                          |

## Methods { #member-methods }

### `hasRole(Role)` { #method-hasrole .template-method }

::: tabs

\== Description | mdi-text

Checks if member has this role.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter | Type             | Description            |
|:----------|:-----------------|:-----------------------|
| `Role`    | \[Number], \[Role] | Role ID or role object |

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

```template{1}
{% if member.hasRole(313987336041922560) %}
You have this role.
{% endif %}
```

:::

### `hasRoles(Roles)` { #method-hasroles .template-method }

::: tabs

\== Description | mdi-text

Checks if member has all of those roles.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter | Type             | Description                       |
|:----------|:-----------------|:----------------------------------|
| `Roles`   | \[List]<\[Number]> | List of role identifiers to check |

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

```template{1}
{% if member.hasRoles([313987336041922560, 559701501597974529]) %}
You have those roles.
{% endif %}
```

:::

### `hasAnyRole(Roles)` { #method-hasanyrole .template-method }

::: tabs

\== Description | mdi-text

Checks if member has any of those roles.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter | Type             | Description                       |
|:----------|:-----------------|:----------------------------------|
| `Roles`   | \[List]<\[Number]> | List of role identifiers to check |

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

```template{1}
{% if member.hasAnyRole([313987336041922560, 559701501597974529]) %}
You have any of those roles.
{% endif %}
```

:::

### `hasPermission(Name)` { #method-haspermission .template-method }

::: tabs

\== Description | mdi-text

Checks if member has this permission over all his roles.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter | Type         | Description         |
|:----------|:-------------|:--------------------|
| `Name`    | \[Permission] | Permission to check |

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

```template{1}
{% if member.hasPermission('ADMINISTRATOR') %}
You are administrator
{% endif %}
```

:::

### `hasPermissions(Names)` { #method-haspermissions .template-method }

::: tabs

\== Description | mdi-text

Checks if member has all specified permissions over all his roles.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter | Type                 | Description          |
|:----------|:---------------------|:---------------------|
| `Names`   | \[List]<\[Permission]> | Permissions to check |

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

```template{1}
{% if member.hasPermissions(['KICK_MEMBERS', 'BAN_MEMBERS']) %}
You can kick and ban
{% endif %}
```

:::

### `hasPermission(Channel, Name)` { #method-haspermission-channel .template-method }

::: tabs

\== Description | mdi-text

Checks if member has this permission in the channel specified.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter | Type                                                        | Description                       |
|:----------|:------------------------------------------------------------|:----------------------------------|
| `Channel` | \[Number], \[TextChannel], \[NewsChannel], \[VoiceChannel], \[StageChannel], \[ForumChannel], \[MediaChannel], \[ThreadChannel], \[Category] | Text channel ID or channel object |
| `Name`    | \[Permission]                                                | Permission to check               |

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

```template{1}
{% if member.hasPermission(channel, 'MESSAGE_MANAGE') %}
You can manage this channel
{% endif %}
```

:::

### `hasPermissions(Channel, Names)` { #method-haspermissions-channel .template-method }

::: tabs

\== Description | mdi-text

Checks if member has all specified permissions in the channel specified.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter | Type                                                        | Description                       |
|:----------|:------------------------------------------------------------|:----------------------------------|
| `Channel` | \[Number], \[TextChannel], \[NewsChannel], \[VoiceChannel], \[StageChannel], \[ForumChannel], \[MediaChannel], \[ThreadChannel], \[Category] | Text channel ID or channel object |
| `Names`   | \[List]<\[Permission]>                                        | Permissions to check              |

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

```template{1}
{% if member.hasPermissions(channel, ['MESSAGE_EMBED_LINKS', 'MESSAGE_SEND']) %}
You can send messages and embed links in this channel
{% endif %}
```

:::

### `hasFlag(Flag)` { #method-hasflag .template-method }

::: tabs

\== Description | mdi-text

Checks if member has this flag.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter | Type       | Description   |
|:----------|:-----------|:--------------|
| `Flag`    | \[UserFlag] | Flag to check |

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

```template{1}
{% if member.hasFlag('VERIFIED_DEVELOPER') %}
You are verified developer
{% endif %}
```

:::

### `addRole(Role)` { #method-addrole .template-method }

::: tabs

\== Description | mdi-text

Adds role to the member. Returns `true` if member roles were updated.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter | Type             | Description            |
|:----------|:-----------------|:-----------------------|
| `Role`    | \[Number], \[Role] | Role ID or role object |

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

```template
{% do member.addRole(686162482703630374) %}
```

```template{1}
{% if member.addRole(686162482703630374) %}
Role has been added
{% else %}
You already have this role
{% endif %}
```

:::

### `addRoles(Roles)` { #method-addroles .template-method }

::: tabs

\== Description | mdi-text

Adds roles to the member. Returns `true` if member roles were updated.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter | Type             | Description      |
|:----------|:-----------------|:-----------------|
| `Roles`   | \[List]<\[Number]> | List of role IDs |

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

```template
{% do member.addRoles([686162482703630374, 686162513146150914]) %}
```

```template{1}
{% if member.addRoles([686162482703630374, 686162513146150914]) %}
Roles have been added
{% else %}
You already have those roles
{% endif %}
```

:::

### `addTempRole(Role, Duration)` { #method-addtemprole .template-method }

::: tabs

\== Description | mdi-text

Adds role to the member temporary. Returns `true` if member roles were updated (not less than 15 seconds).

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter  | Type                 | Description                                                                       |
|:-----------|:---------------------|:----------------------------------------------------------------------------------|
| `Role`     | \[Number], \[Role]     | Role ID or role object                                                            |
| `Duration` | \[DateTime], \[Number] | Absolute removal date or relative amount of millis after which it will be removed |

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

```template
{% do member.addTempRole(686162482703630374, 20000) %}
```

```template{1}
{% if member.addTempRole(686162482703630374, 20000) %}
Role has been added for 20 seconds
{% else %}
You already have this role
{% endif %}
```

:::

### `addTempRoles(Roles, Duration)` { #method-addtemproles .template-method }

::: tabs

\== Description | mdi-text

Adds roles to the member temporary. Returns `true` if member roles were updated (not less than 15 seconds).

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter  | Type                 | Description                                                                         |
|:-----------|:---------------------|:------------------------------------------------------------------------------------|
| `Roles`    | \[List]<\[Number]>     | List of role IDs                                                                    |
| `Duration` | \[DateTime], \[Number] | Absolute removal date or relative amount of millis after which they will be removed |

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

```template
{% do member.addTempRoles([686162482703630374, 686162513146150914], 20000) %}
```

```template{1}
{% if member.addTempRoles([686162482703630374, 686162513146150914], 20000) %}
Roles have been added for 20 seconds
{% else %}
You already have those roles
{% endif %}
```

:::

### `removeRole(Role)` { #method-removerole .template-method }

::: tabs

\== Description | mdi-text

Removes role from the member. Returns `true` if member roles were updated.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter | Type             | Description            |
|:----------|:-----------------|:-----------------------|
| `Role`    | \[Number], \[Role] | Role ID or role object |

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

```template
{% do member.removeRole(686162482703630374) %}
```

```template{1}
{% if member.removeRole(686162482703630374) %}
Role has been removed
{% else %}
You don't have this role
{% endif %}
```

:::

### `removeRoles(Roles)` { #method-removeroles .template-method }

::: tabs

\== Description | mdi-text

Removes roles from the member. Returns `true` if member roles were updated.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter | Type             | Description      |
|:----------|:-----------------|:-----------------|
| `Roles`   | \[List]<\[Number]> | List of role IDs |

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

```template
{% do member.removeRoles([686162482703630374, 686162513146150914]) %}
```

```template{1}
{% if member.removeRoles([686162482703630374, 686162513146150914]) %}
Roles have been removed
{% else %}
You don't have those roles
{% endif %}
```

:::

### `modifyRoles(Add, Remove)` { #method-modifyroles .template-method }

::: tabs

\== Description | mdi-text

Adds and removes roles from the member automatically. Returns `true` if member roles were updated.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter | Type             | Description      |
|:----------|:-----------------|:-----------------|
| `Add`     | \[List]<\[Number]> | List of role IDs |
| `Remove`  | \[List]<\[Number]> | List of role IDs |

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

```template
{% do member.modifyRoles([686162482703630374], [686162513146150914]) %}
```

```template{1}
{% if member.modifyRoles([686162482703630374], [686162513146150914]) %}
Roles have been updated
{% else %}
Roles weren't updated
{% endif %}
```

:::

### `modifyNickname(Name)` { #method-modifynickname .template-method }

::: tabs

\== Description | mdi-text

Changes member's nickname. Nickname length must be in range 2 to 32.

Returns `true` if name was updated.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

| Parameter | Type     | Description           |
|:----------|:---------|:----------------------|
| `Name`    | \[String] | Member's new nickname |

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

```template
{% do member.modifyNickname('NewName') %}
```

```template{1}
{% if member.modifyNickname('NewName') %}
Nickname has been updated
{% else %}
Nickname wasn't updated
{% endif %}
```

:::

### `getAttribute(Key)` { #method-getattribute .template-method }

::: tabs

\== Description | mdi-text

Returns member attribute (stored value).

**Returns:** \[MemberAttribute]

\== Parameters | mdi-code-parentheses

| Parameter | Type     | Description   |
|:----------|:---------|:--------------|
| `Key`     | \[String] | Attribute key |

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

```template
{% set attribute = member.getAttribute('myAttribute') %}
```

:::
