1 file changed
+11
@@ -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)] : [];
|
||||||
|
}
|
||||||
Reference in new issue
Block a user