I want to add the server custom emoji in the selection list. I think the format is correct. But it isn't show up correctly.
view = TicketTypeSelectView(ticket_data['ticket_types'])
await interaction.response.send_message("Please select the type of ticket you want to create:", view=view, ephemeral=True, delete_after=60.0)
class TicketTypeSelectView(discord.ui.View):
def __init__(self, ticket_types):
super().__init__(timeout=None)
options = []
for name, data in ticket_types.items():
emoji = data.get('emoji', '') # Retrieve the emoji if available
options.append(discord.SelectOption(label=f"{emoji} {name}", value=name))
self.add_item(TicketTypeSelect(options))
This is my JSON:
"TruckersMP Event": {
"staff_role_ids": [
1269190673492607078
],
"ticket_category_id": 1267312898217218128,
"ticket_name": "TruckersMP Event",
"emoji": "<:ProEvent:1274673606239981598>"
}
You simply forgot to add the emoji
parameter :D
options.append(discord.SelectOption(label=f"{emoji} {name}", value=name, emoji=emoji))