feat(ui): add link buttons builder

Refs: #99
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
nocodeandClaude Opus 5 committed 2026-09-13 12:19:10 +02:00
1 parent 55c0322217
commit af5f7e0b30
1 file changed
+11
+11
View File
@@ -0,0 +1,11 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';
/** Builds a row of link buttons, skipping links without a URL (M12-T03). */
export function linkButtons(links) {
const buttons = links
.filter((link) => link.url)
.slice(0, 5)
.map((link) => new ButtonBuilder().setStyle(ButtonStyle.Link).setLabel(link.label).setURL(link.url));
return buttons.length > 0 ? [new ActionRowBuilder().addComponents(buttons)] : [];
}