-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbutton.go
58 lines (46 loc) · 1.03 KB
/
button.go
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
package discog
import "github.com/bwmarrin/discordgo"
// Represents a Button Component
type Button struct {
button discordgo.Button
}
// Creates a new Button Component
func NewButton() *Button {
return &Button{
button: discordgo.Button{},
}
}
// Adds label to Button.
func (b *Button) SetLabel(label string) *Button {
b.button.Label = label
return b
}
// Disabled the button.
func (b *Button) SetDisabled() *Button {
b.button.Disabled = true
return b
}
// Sets ID for the button.
func (b *Button) SetID(id string) *Button {
b.button.CustomID = id
return b
}
// Sets URL for the button.
func (b *Button) SetURL(url string) *Button {
b.button.URL = url
return b
}
// Adds style to the Button Component
func (b *Button) SetStyle(style discordgo.ButtonStyle) *Button {
b.button.Style = style
return b
}
// Adds emoji to the Button Component
func (b *Button) AnyEmoji(emoji Emoji) *Button {
b.button.Emoji = &emoji.emoji
return b
}
// Returns the Button Component
func (b *Button) GetComponent() interface{} {
return b.button
}