From aaf3652c0e3a671004a3777e1ddce7fa0bfd779a Mon Sep 17 00:00:00 2001 From: Matthias Nordgauer Date: Wed, 21 May 2025 08:34:49 +0200 Subject: [PATCH] fix(api/panels): use the category label and emoji even if its only a single button --- src/routes/api/admin/guilds/[guild]/panels.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/routes/api/admin/guilds/[guild]/panels.js b/src/routes/api/admin/guilds/[guild]/panels.js index f7cd6704a..67340ccbf 100644 --- a/src/routes/api/admin/guilds/[guild]/panels.js +++ b/src/routes/api/admin/guilds/[guild]/panels.js @@ -82,15 +82,16 @@ module.exports.post = fastify => ({ const components = []; if (categories.length === 1) { + let category = categories[0]; components.push( new ButtonBuilder() .setCustomId(JSON.stringify({ action: 'create', - target: categories[0].id, + target: category.id, })) .setStyle(Primary) - .setLabel(getMessage('buttons.create.text')) - .setEmoji(getMessage('buttons.create.emoji')), + .setLabel(category.name) + .setEmoji(emoji.hasEmoji(category.emoji) ? emoji.get(category.emoji) : { id: category.emoji }), ); } else if (data.type === 'BUTTON') { components.push(