@@ -6,7 +6,7 @@ const { MessageButtonStyles, MessageComponentTypes } = require('../util/Constant
66const Util = require ( '../util/Util' ) ;
77
88/**
9- * Represents a Button message component.
9+ * Represents a button message component.
1010 * @extends {BaseMessageComponent }
1111 */
1212class MessageButton extends BaseMessageComponent {
@@ -15,7 +15,7 @@ class MessageButton extends BaseMessageComponent {
1515 * @property {string } [label] The text to be displayed on this button
1616 * @property {string } [customID] A unique string to be sent in the interaction when clicked
1717 * @property {MessageButtonStyleResolvable } [style] The style of this button
18- * @property {Emoji } [emoji] The emoji to be displayed to the left of the text
18+ * @property {EmojiIdentifierResolvable } [emoji] The emoji to be displayed to the left of the text
1919 * @property {string } [url] Optional URL for link-style buttons
2020 * @property {boolean } [disabled=false] Disables the button to prevent interactions
2121 */
@@ -50,9 +50,9 @@ class MessageButton extends BaseMessageComponent {
5050
5151 /**
5252 * Emoji for this button
53- * @type {?Emoji|string }
53+ * @type {?RawEmoji }
5454 */
55- this . emoji = data . emoji ?? null ;
55+ this . emoji = data . emoji ? Util . resolvePartialEmoji ( data . emoji ) : null ;
5656
5757 /**
5858 * The URL this button links to, if it is a Link style button
@@ -93,8 +93,7 @@ class MessageButton extends BaseMessageComponent {
9393 * @returns {MessageButton }
9494 */
9595 setEmoji ( emoji ) {
96- if ( / ^ \d { 17 , 19 } $ / . test ( emoji ) ) this . emoji = { id : emoji } ;
97- else this . emoji = Util . parseEmoji ( `${ emoji } ` ) ;
96+ this . emoji = Util . resolvePartialEmoji ( emoji ) ;
9897 return this ;
9998 }
10099
@@ -119,7 +118,8 @@ class MessageButton extends BaseMessageComponent {
119118 }
120119
121120 /**
122- * Sets the URL of this button. MessageButton#style should be LINK
121+ * Sets the URL of this button.
122+ * <note>MessageButton#style must be LINK when setting a URL</note>
123123 * @param {string } url The URL of this button
124124 * @returns {MessageButton }
125125 */
@@ -146,14 +146,14 @@ class MessageButton extends BaseMessageComponent {
146146
147147 /**
148148 * Data that can be resolved to a MessageButtonStyle. This can be
149- * * { @link MessageButtonStyle}
149+ * * MessageButtonStyle
150150 * * string
151151 * * number
152152 * @typedef {string|number|MessageButtonStyle } MessageButtonStyleResolvable
153153 */
154154
155155 /**
156- * Resolves the style of a MessageButton
156+ * Resolves the style of a button
157157 * @param {MessageButtonStyleResolvable } style The style to resolve
158158 * @returns {MessageButtonStyle }
159159 * @private
0 commit comments