diff --git a/interactions.go b/interactions.go index 201baa8..d68b2b9 100644 --- a/interactions.go +++ b/interactions.go @@ -15,7 +15,7 @@ const InteractionDeadline = time.Second * 3 // ApplicationCommand represents an application's slash command. type ApplicationCommand struct { - ID string `json:"id"` + ID string `json:"id,omitempty"` ApplicationID string `json:"application_id,omitempty"` Name string `json:"name"` Description string `json:"description,omitempty"` diff --git a/restapi.go b/restapi.go index 8afc1e4..755e4b7 100644 --- a/restapi.go +++ b/restapi.go @@ -2472,6 +2472,25 @@ func (s *Session) ApplicationCommandEdit(appID, guildID, cmdID string, cmd *Appl return } +// ApplicationCommandBulkOverwrite Creates commands overwriting existing commands. Returns a list of commands. +// appID : The application ID. +// commands : The commands to create. +func (s *Session) ApplicationCommandBulkOverwrite(appID string, guildID string, commands []*ApplicationCommand) (createdCommands []*ApplicationCommand, err error) { + endpoint := EndpointApplicationGlobalCommands(appID) + if guildID != "" { + endpoint = EndpointApplicationGuildCommands(appID, guildID) + } + + body, err := s.RequestWithBucketID("PUT", endpoint, commands, endpoint) + if err != nil { + return + } + + err = unmarshal(body, &createdCommands) + + return +} + // ApplicationCommandDelete deletes application command by ID. // appID : The application ID. // cmdID : Application command ID to delete.