2021-01-27 17:43:38 +00:00
|
|
|
package discord
|
|
|
|
|
2021-05-20 22:47:44 +00:00
|
|
|
import "time"
|
|
|
|
|
2021-01-27 17:43:38 +00:00
|
|
|
type Command struct {
|
|
|
|
ID CommandID `json:"id"`
|
|
|
|
AppID AppID `json:"application_id"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
Options []CommandOption `json:"options,omitempty"`
|
|
|
|
}
|
|
|
|
|
2021-05-20 22:47:44 +00:00
|
|
|
// CreatedAt returns a time object representing when the command was created.
|
|
|
|
func (c Command) CreatedAt() time.Time {
|
|
|
|
return c.ID.Time()
|
|
|
|
}
|
|
|
|
|
2021-01-27 17:43:38 +00:00
|
|
|
type CommandOption struct {
|
|
|
|
Type CommandOptionType `json:"type"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
Required bool `json:"required"`
|
|
|
|
Choices []CommandOptionChoice `json:"choices,omitempty"`
|
|
|
|
Options []CommandOption `json:"options,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type CommandOptionType uint
|
|
|
|
|
|
|
|
const (
|
|
|
|
SubcommandOption CommandOptionType = iota + 1
|
|
|
|
SubcommandGroupOption
|
|
|
|
StringOption
|
|
|
|
IntegerOption
|
|
|
|
BooleanOption
|
|
|
|
UserOption
|
|
|
|
ChannelOption
|
|
|
|
RoleOption
|
|
|
|
)
|
|
|
|
|
|
|
|
type CommandOptionChoice struct {
|
|
|
|
Name string `json:"name"`
|
|
|
|
Value string `json:"value"`
|
|
|
|
}
|