Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build ButtonComponents instead of using the helper #364

Merged
merged 2 commits into from
Jun 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions discord/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,27 +248,47 @@ func NewButton(style ButtonStyle, label string, customID string, url string) But

// NewPrimaryButton creates a new ButtonComponent with ButtonStylePrimary & the provided parameters
func NewPrimaryButton(label string, customID string) ButtonComponent {
return NewButton(ButtonStylePrimary, label, customID, "")
return ButtonComponent{
Style: ButtonStylePrimary,
Label: label,
CustomID: customID,
}
}

// NewSecondaryButton creates a new ButtonComponent with ButtonStyleSecondary & the provided parameters
func NewSecondaryButton(label string, customID string) ButtonComponent {
return NewButton(ButtonStyleSecondary, label, customID, "")
return ButtonComponent{
Style: ButtonStyleSecondary,
Label: label,
CustomID: customID,
}
}

// NewSuccessButton creates a new ButtonComponent with ButtonStyleSuccess & the provided parameters
func NewSuccessButton(label string, customID string) ButtonComponent {
return NewButton(ButtonStyleSuccess, label, customID, "")
return ButtonComponent{
Style: ButtonStyleSuccess,
Label: label,
CustomID: customID,
}
}

// NewDangerButton creates a new ButtonComponent with ButtonStyleDanger & the provided parameters
func NewDangerButton(label string, customID string) ButtonComponent {
return NewButton(ButtonStyleDanger, label, customID, "")
return ButtonComponent{
Style: ButtonStyleDanger,
Label: label,
CustomID: customID,
}
}

// NewLinkButton creates a new link ButtonComponent with ButtonStyleLink & the provided parameters
func NewLinkButton(label string, url string) ButtonComponent {
return NewButton(ButtonStyleLink, label, "", url)
return ButtonComponent{
Style: ButtonStyleLink,
Label: label,
URL: url,
}
}

var (
Expand Down
Loading