Skip to content

Role panel

A panel where every member picks their roles. Each role is a Section with a button next to it, and a menu at the end handles colors.

Preview
My BotAPPToday at 12:00 PM

🎭 Pick your roles

Click a button to add or remove the role.


🎮 Gamer

Access to the gaming channels

🎨 Artist

Share your drawings

📢 Announcements

Get pinged on every announcement


Name color

Pick a color
payload.json
{
"flags": 32768,
"components": [
{
"type": 17,
"accent_color": 15418782,
"components": [
{
"type": 10,
"content": "## 🎭 Pick your roles\nClick a button to add or remove the role."
},
{
"type": 14
},
{
"type": 9,
"components": [
{
"type": 10,
"content": "🎮 **Gamer**\n-# Access to the gaming channels"
}
],
"accessory": {
"type": 2,
"style": 2,
"label": "Gamer",
"custom_id": "role:111111111111111111"
}
},
{
"type": 9,
"components": [
{
"type": 10,
"content": "🎨 **Artist**\n-# Share your drawings"
}
],
"accessory": {
"type": 2,
"style": 2,
"label": "Artist",
"custom_id": "role:222222222222222222"
}
},
{
"type": 9,
"components": [
{
"type": 10,
"content": "📢 **Announcements**\n-# Get pinged on every announcement"
}
],
"accessory": {
"type": 2,
"style": 2,
"label": "Announcements",
"custom_id": "role:333333333333333333"
}
},
{
"type": 14,
"spacing": 2
},
{
"type": 10,
"content": "**Name color**"
},
{
"type": 1,
"components": [
{
"type": 3,
"custom_id": "color",
"placeholder": "Pick a color",
"min_values": 0,
"options": [
{
"label": "Red",
"value": "444444444444444444",
"emoji": {
"name": "🔴"
}
},
{
"label": "Green",
"value": "555555555555555555",
"emoji": {
"name": "🟢"
}
},
{
"label": "Blue",
"value": "666666666666666666",
"emoji": {
"name": "🔵"
}
}
]
}
]
}
]
}
]
}
  • Each button’s custom_id is role: + the role ID. That way a single handler covers all of them.
  • On click: if the member has the role, remove it; otherwise, add it.
  • Reply with an ephemeral message to confirm (only the clicker sees it).
  • The panel doesn’t change, so there’s no need to edit it.
  1. Read data.custom_id and extract the role ID.
  2. Add the role with PUT /guilds/{guild.id}/members/{user.id}/roles/{role.id} or remove it with DELETE on the same route.
  3. Respond to the interaction with type: 4 and flags: 32832 (V2 + ephemeral).