MCPcopy Create free account
hub / github.com/codebymitch/TitanBot / createLinkButton

Function createLinkButton

src/utils/components.js:94–119  ·  view source on GitHub ↗
(label, url, emoji = null)

Source from the content-addressed store, hash-verified

92}
93
94export function createLinkButton(label, url, emoji = null) {
95
96 if (!label || typeof label !== 'string') {
97 throw new Error('label must be a non-empty string');
98 }
99 if (!url || typeof url !== 'string') {
100 throw new Error('url must be a non-empty string');
101 }
102
103 const validLabel = label.substring(0, 80);
104
105 const button = new ButtonBuilder()
106 .setLabel(validLabel)
107 .setURL(url)
108 .setStyle(ButtonStyle.Link);
109
110 if (emoji && typeof emoji === 'string' && emoji.length > 0) {
111 try {
112 button.setEmoji(emoji);
113 } catch (error) {
114
115 }
116 }
117
118 return button;
119}
120
121export function createButtonRow(buttons) {
122 const row = new ActionRowBuilder();

Callers 1

createButtonRowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected