diff --git a/discord/command.go b/discord/command.go index 5c77ae5..c2de315 100644 --- a/discord/command.go +++ b/discord/command.go @@ -708,3 +708,15 @@ func (m *MentionableOption) MarshalJSON() ([]byte, error) { raw: (*raw)(m), }) } + +// MarshalJSON marshals NumberOption to JSON with the "type" field. +func (n *NumberOption) MarshalJSON() ([]byte, error) { + type raw NumberOption + return json.Marshal(struct { + Type CommandOptionType `json:"type"` + *raw + }{ + Type: n.Type(), + raw: (*raw)(n), + }) +} diff --git a/utils/generate-option-marshalers.sh b/utils/generate-option-marshalers.sh index 06cfd54..8b8f168 100755 --- a/utils/generate-option-marshalers.sh +++ b/utils/generate-option-marshalers.sh @@ -10,6 +10,7 @@ types=( ChannelOption RoleOption MentionableOption + NumberOption ) for ((i = 0; i < ${#types[@]}; i++)); {