summaryrefslogtreecommitdiff
path: root/node_modules/discord.js/src/structures/ButtonComponent.js
blob: 7319c3a5f19fd34def1e43e9c75be2cd147c6ce0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
'use strict';

const Component = require('./Component');

/**
 * Represents a button component
 * @extends {Component}
 */
class ButtonComponent extends Component {
  /**
   * The style of this button
   * @type {ButtonStyle}
   * @readonly
   */
  get style() {
    return this.data.style;
  }

  /**
   * The label of this button
   * @type {?string}
   * @readonly
   */
  get label() {
    return this.data.label ?? null;
  }

  /**
   * The emoji used in this button
   * @type {?APIMessageComponentEmoji}
   * @readonly
   */
  get emoji() {
    return this.data.emoji ?? null;
  }

  /**
   * Whether this button is disabled
   * @type {boolean}
   * @readonly
   */
  get disabled() {
    return this.data.disabled ?? false;
  }

  /**
   * The custom id of this button (only defined on non-link buttons)
   * @type {?string}
   * @readonly
   */
  get customId() {
    return this.data.custom_id ?? null;
  }

  /**
   * The URL of this button (only defined on link buttons)
   * @type {?string}
   * @readonly
   */
  get url() {
    return this.data.url ?? null;
  }
}

module.exports = ButtonComponent;