# Get Roles

> Get all roles in the specified server.

- ID: `get_discord_roles`
- Type: Loop
- Category: [Roles](https://inventor.bot/docs/reference/blocks/roles.md)

- Loop block: write `for item := range get_discord_roles(Args{...}) { ... }` and read the current item's outputs from `item`. See loops.

**Inputs**

| Name | Required | Description | Value |
| --- | --- | --- | --- |
| `server_id` | yes | ID of the server to retrieve roles from. |  |
| `body` |  | Blocks to run for each role. | blocks: `func() { ... }` |

**Outputs**

| Name | Description | Value |
| --- | --- | --- |
| `iteration_number` | Current iteration (1-based). | e.g. `"1"` |
| `total_iterations` | Total number of iterations. | e.g. `"5"` |
| `role_id` | ID of the role. |  |
| `role_name` | Name of the role. |  |
| `role_color` | Hex color of the role. | e.g. `"#000000"` |
| `role_hoist` | Whether the role is hoisted. |  |
| `role_position` | Position of the role. | e.g. `"1"` |
| `role_permissions` | Permission bitset for the role. | e.g. `"104188992"` |
| `role_managed` | Whether the role is managed. |  |
| `role_mentionable` | Whether the role is mentionable. |  |
| `role_mention` | Mention string for the role. |  |
| `role_icon` | URL of the role's icon image, if set. |  |
| `role_unicode_emoji` | Unicode emoji assigned to the role, if set. |  |

**Example**

```go
for role := range get_discord_roles(Args{server_id: trigger.server_id}) {
	send_text_message(Args{channel_id: trigger.channel_id, message_content: "Role ID: " + role.role_id})
}
```