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})
}
Get Roles
LoopRoles
Get all roles in the specified server.
- Loop block: the blocks placed inside it run once for each item, and can use the current item's outputs.
Inputs
Server IDRequired
ID of the server to retrieve roles from.
Loop Body
Blocks to run for each role.
Holds blocks
Outputs
Iteration Number
Current iteration (1-based).
Example: 1
Total Iterations
Total number of iterations.
Example: 5
Role ID
ID of the role.
Role Name
Name of the role.
Role Color
Hex color of the role.
Example: #000000
Role Hoist
Whether the role is hoisted.
Role Position
Position of the role.
Example: 1
Role Permissions
Permission bitset for the role.
Example: 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
URL of the role's icon image, if set.
Role Unicode Emoji
Unicode emoji assigned to the role, if set.
Build a bot using blocks like Get Roles
Use this block in our visual flow editor. Bots are hosted 24/7 for free on inventor.bot.
Advanced Documentation
This documentation can be useful when using code mode. View as Markdown
ID:
get_discord_roles- Loop block: write
for item := range get_discord_roles(Args{...}) { ... }and read the current item's outputs fromitem. See loops.
Inputs
| Field | InventScript name | Value |
|---|---|---|
| Server ID | server_id | |
| Loop Body | body | blocks: func() { ... } |
Outputs
| Field | InventScript name | Value |
|---|---|---|
| Iteration Number | iteration_number | e.g. "1" |
| Total Iterations | total_iterations | e.g. "5" |
| Role ID | role_id | |
| Role Name | role_name | |
| Role Color | role_color | e.g. "#000000" |
| Role Hoist | role_hoist | |
| Role Position | role_position | e.g. "1" |
| Role Permissions | role_permissions | e.g. "104188992" |
| Role Managed | role_managed | |
| Role Mentionable | role_mentionable | |
| Role Mention | role_mention | |
| Role Icon URL | role_icon | |
| Role Unicode Emoji | role_unicode_emoji |