mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-30 18:53:30 +00:00
discord: Add {Min,Max} into {Integer,Number}Option
This commit is contained in:
parent
7af6e23569
commit
172d448e74
|
@ -5,6 +5,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/diamondburned/arikawa/v3/utils/json"
|
"github.com/diamondburned/arikawa/v3/utils/json"
|
||||||
|
"github.com/diamondburned/arikawa/v3/utils/json/option"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -401,6 +402,8 @@ func (i *IntegerOption) _val() {}
|
||||||
type IntegerChoice struct {
|
type IntegerChoice struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Value int `json:"value"`
|
Value int `json:"value"`
|
||||||
|
Min option.Int `json:"min_value,omitempty"`
|
||||||
|
Max option.Int `json:"max_value,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// BooleanOption is a subcommand option that fits into a CommandOptionValue.
|
// BooleanOption is a subcommand option that fits into a CommandOptionValue.
|
||||||
|
@ -493,6 +496,8 @@ func (n *NumberOption) _val() {}
|
||||||
type NumberChoice struct {
|
type NumberChoice struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Value float64 `json:"value"`
|
Value float64 `json:"value"`
|
||||||
|
Min option.Float `json:"min_value,omitempty"`
|
||||||
|
Max option.Float `json:"max_value,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCommand creates a new command.
|
// NewCommand creates a new command.
|
||||||
|
|
|
@ -24,6 +24,17 @@ var ZeroInt = NewInt(0)
|
||||||
// NewInt creates a new Int using the value of the passed int.
|
// NewInt creates a new Int using the value of the passed int.
|
||||||
func NewInt(i int) Int { return &i }
|
func NewInt(i int) Int { return &i }
|
||||||
|
|
||||||
|
// ================================ Float ================================
|
||||||
|
|
||||||
|
// Float is the option type for floating-point numbers (float64).
|
||||||
|
type Float *float64
|
||||||
|
|
||||||
|
// ZeroFloat is an Float with 0 as value.
|
||||||
|
var ZeroFloat = NewFloat(0)
|
||||||
|
|
||||||
|
// NewFloat creates a new Float using the value of the passed float64.
|
||||||
|
func NewFloat(i float64) Float { return &i }
|
||||||
|
|
||||||
// ================================ NullableUint ================================
|
// ================================ NullableUint ================================
|
||||||
|
|
||||||
// NullableUint is a nullable version of an unsigned integer (uint).
|
// NullableUint is a nullable version of an unsigned integer (uint).
|
||||||
|
|
Loading…
Reference in a new issue