mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-30 18:53:30 +00:00
Discord: Marshalled Snowflakes are now -1 when null
This commit is contained in:
parent
55323ee753
commit
2cad0e87b6
|
@ -38,6 +38,8 @@ func ParseSnowflake(sf string) (Snowflake, error) {
|
||||||
func (s *Snowflake) UnmarshalJSON(v []byte) error {
|
func (s *Snowflake) UnmarshalJSON(v []byte) error {
|
||||||
id := strings.Trim(string(v), `"`)
|
id := strings.Trim(string(v), `"`)
|
||||||
if id == "null" {
|
if id == "null" {
|
||||||
|
// Use -1 for null.
|
||||||
|
*s = -1
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue