Skip to content

Commit

Permalink
fix payload of Edit Application Command Permissions and omitting of d…
Browse files Browse the repository at this point in the history
…efault_permissions
  • Loading branch information
topi314 committed Mar 18, 2022
1 parent aeea9da commit 1750445
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions discord/application_command_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type SlashCommandCreate struct {
CommandName string `json:"name"`
Description string `json:"description"`
Options []ApplicationCommandOption `json:"options,omitempty"`
DefaultPermission bool `json:"default_permission,omitempty"`
DefaultPermission bool `json:"default_permission"`
}

func (c SlashCommandCreate) MarshalJSON() ([]byte, error) {
Expand All @@ -39,7 +39,7 @@ func (SlashCommandCreate) applicationCommandCreate() {}

type UserCommandCreate struct {
CommandName string `json:"name"`
DefaultPermission bool `json:"default_permission,omitempty"`
DefaultPermission bool `json:"default_permission"`
}

func (c UserCommandCreate) MarshalJSON() ([]byte, error) {
Expand All @@ -65,7 +65,7 @@ func (UserCommandCreate) applicationCommandCreate() {}

type MessageCommandCreate struct {
CommandName string `json:"name"`
DefaultPermission bool `json:"default_permission,omitempty"`
DefaultPermission bool `json:"default_permission"`
}

func (c MessageCommandCreate) MarshalJSON() ([]byte, error) {
Expand Down
2 changes: 1 addition & 1 deletion discord/application_command_permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (

// ApplicationCommandPermissionsSet is used to bulk overwrite all ApplicationCommandPermissions
type ApplicationCommandPermissionsSet struct {
ID snowflake.Snowflake `json:"id"`
ID snowflake.Snowflake `json:"id,omitempty"`
Permissions []ApplicationCommandPermission `json:"permissions"`
}

Expand Down
2 changes: 1 addition & 1 deletion rest/application_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (s *applicationServiceImpl) SetGuildCommandPermissions(applicationID snowfl
if err != nil {
return
}
err = s.restClient.Do(compiledRoute, commandPermissions, &commandPerms, opts...)
err = s.restClient.Do(compiledRoute, discord.ApplicationCommandPermissionsSet{Permissions: commandPermissions}, &commandPerms, opts...)
return
}

Expand Down

0 comments on commit 1750445

Please sign in to comment.