1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-27 17:23:00 +00:00

Discord: Marshalled Snowflakes are now -1 when null

This commit is contained in:
diamondburned (Forefront) 2020-05-08 13:56:00 -07:00
parent 55323ee753
commit 2cad0e87b6

View file

@ -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
} }