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

# Role

This data type describes all available data about the role.

## Properties { #properties }

| Property         | Type       | Description                                                     |
|:-----------------|:-----------|:----------------------------------------------------------------|
| `id`             | \[Number]   | Unique identifier                                               |
| `name`           | \[String]   | Name                                                            |
| `iconUrl`        | \[String]   | Icon URL                                                        |
| `position`       | \[Number]   | Position number in role list                                    |
| `createdAt`      | \[DateTime] | Creation date and time                                          |
| `permissionsRaw` | \[Number]   | Permissions in raw numeric representation                       |
| `managed`        | \[Boolean]  | `true` if this role is managed by some integration              |
| `hoisted`        | \[Boolean]  | `true` if this role is displayed separately from online members |
| `publicRole`     | \[Boolean]  | `true` if this is public role (`@everyone`)                     |
| `color`          | \[String]   | Color in `#RRGGBB` format                                       |
| `guild`          | \[Guild]    | Server information                                              |

## Methods { #methods }

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

::: tabs

\== Description | mdi-text

Checks if this role has global permission.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

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

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

```template{2}
{% set role = guild.getRole(313987336041922560) %}
{% if role.hasPermission('ADMINISTRATOR') %}
This role is administrator
{% endif %}
```

:::

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

::: tabs

\== Description | mdi-text

Checks if this role has global permissions.

**Returns:** \[Boolean]

\== Parameters | mdi-code-parentheses

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

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

```template{2}
{% set role = guild.getRole(313987336041922560) %}
{% if role.hasPermissions(['KICK_MEMBERS', 'BAN_MEMBERS']) %}
This role can kick and ban
{% endif %}
```

:::

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

::: tabs

\== Description | mdi-text

Checks if this role has permission in 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{2}
{% set role = guild.getRole(313987336041922560) %}
{% if role.hasPermission(channel, 'MESSAGE_MANAGE') %}
This role can manage this channel
{% endif %}
```

:::

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

::: tabs

\== Description | mdi-text

Checks if this role has permissions in 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{2}
{% set role = guild.getRole(313987336041922560) %}
{% if role.hasPermissions(channel, ['MESSAGE_EMBED_LINKS', 'MESSAGE_SEND']) %}
This role can send messages and embed links in this channel
{% endif %}
```

:::
