discord: Fix style issues (#272)

* Discord: Fix comment style issues

* Discord: use URL type alias for URls instead of string
This commit is contained in:
Maximilian von Lindern 2021-08-30 22:15:59 +02:00 committed by GitHub
parent f334491dee
commit 2647267460
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 11 deletions

View File

@ -72,7 +72,7 @@ type Component interface {
Type() ComponentType Type() ComponentType
} }
// ActionRow is a row of components at the bottom of a message. // ActionRowComponent is a row of components at the bottom of a message.
type ActionRowComponent struct { type ActionRowComponent struct {
Components []Component `json:"components"` Components []Component `json:"components"`
} }
@ -135,15 +135,16 @@ func (a *ActionRowComponent) UnmarshalJSON(b []byte) error {
return nil return nil
} }
// Button is a clickable button that may be added to an interaction response. // ButtonComponent is a clickable button that may be added to an interaction
// response.
type ButtonComponent struct { type ButtonComponent struct {
Label string `json:"label"` Label string `json:"label"`
// CustomID attached to InteractionCreate event when clicked. // CustomID attached to InteractionCreate event when clicked.
CustomID string `json:"custom_id"` CustomID string `json:"custom_id"`
Style ButtonStyle `json:"style"` Style ButtonStyle `json:"style"`
Emoji *ButtonEmoji `json:"emoji,omitempty"` Emoji *ButtonEmoji `json:"emoji,omitempty"`
// Present on link-style buttons. // URL is only present on link-style buttons.
URL string `json:"url,omitempty"` URL URL `json:"url,omitempty"`
Disabled bool `json:"disabled,omitempty"` Disabled bool `json:"disabled,omitempty"`
} }
@ -157,11 +158,16 @@ type ButtonStyle uint
// All types of ButtonStyle documented. // All types of ButtonStyle documented.
const ( const (
PrimaryButton ButtonStyle = iota + 1 // Blurple button. // PrimaryButton is a blurple button.
SecondaryButton // Grey button. PrimaryButton ButtonStyle = iota + 1
SuccessButton // Green button. // SecondaryButton is a grey button.
DangerButton // Red button. SecondaryButton
LinkButton // Button that navigates to a URL. // SuccessButton is a green button.
SuccessButton
// DangerButton is a red button.
DangerButton
// LinkButton is a button that navigates to a URL.
LinkButton
) )
// ButtonEmoji is the emoji displayed on the button before the text. // ButtonEmoji is the emoji displayed on the button before the text.
@ -188,7 +194,8 @@ func (b ButtonComponent) MarshalJSON() ([]byte, error) {
}) })
} }
// Select is a clickable button that may be added to an interaction response. // SelectComponent is a clickable button that may be added to an interaction
// response.
type SelectComponent struct { type SelectComponent struct {
CustomID string `json:"custom_id"` CustomID string `json:"custom_id"`
Options []SelectComponentOption `json:"options"` Options []SelectComponentOption `json:"options"`