github.com/diamondburned/arikawa/v2@v2.1.0/discord/application.go (about)

     1  package discord
     2  
     3  import "time"
     4  
     5  type Command struct {
     6  	ID          CommandID       `json:"id"`
     7  	AppID       AppID           `json:"application_id"`
     8  	Name        string          `json:"name"`
     9  	Description string          `json:"description"`
    10  	Options     []CommandOption `json:"options,omitempty"`
    11  }
    12  
    13  // CreatedAt returns a time object representing when the command was created.
    14  func (c Command) CreatedAt() time.Time {
    15  	return c.ID.Time()
    16  }
    17  
    18  type CommandOption struct {
    19  	Type        CommandOptionType     `json:"type"`
    20  	Name        string                `json:"name"`
    21  	Description string                `json:"description"`
    22  	Required    bool                  `json:"required"`
    23  	Choices     []CommandOptionChoice `json:"choices,omitempty"`
    24  	Options     []CommandOption       `json:"options,omitempty"`
    25  }
    26  
    27  type CommandOptionType uint
    28  
    29  const (
    30  	SubcommandOption CommandOptionType = iota + 1
    31  	SubcommandGroupOption
    32  	StringOption
    33  	IntegerOption
    34  	BooleanOption
    35  	UserOption
    36  	ChannelOption
    37  	RoleOption
    38  )
    39  
    40  type CommandOptionChoice struct {
    41  	Name  string `json:"name"`
    42  	Value string `json:"value"`
    43  }