mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-30 10:43:30 +00:00
Compare commits
2 commits
3312c66515
...
fd818e181e
Author | SHA1 | Date | |
---|---|---|---|
diamondburned | fd818e181e | ||
diamondburned | 87c648ae1d |
|
@ -30,12 +30,12 @@ func ParseSnowflake(sf string) (Snowflake, error) {
|
|||
return NullSnowflake, nil
|
||||
}
|
||||
|
||||
i, err := strconv.ParseInt(sf, 10, 64)
|
||||
u, err := strconv.ParseUint(sf, 10, 64)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return Snowflake(i), nil
|
||||
return Snowflake(u), nil
|
||||
}
|
||||
|
||||
func (s *Snowflake) UnmarshalJSON(v []byte) error {
|
||||
|
|
|
@ -120,7 +120,7 @@ type GuildFolder struct {
|
|||
|
||||
// GuildFolderID is possibly a snowflake. It can also be 0 (null) or a low
|
||||
// number of unknown significance.
|
||||
type GuildFolderID uint64
|
||||
type GuildFolderID int64
|
||||
|
||||
func (g *GuildFolderID) UnmarshalJSON(b []byte) error {
|
||||
var body = string(b)
|
||||
|
@ -130,7 +130,7 @@ func (g *GuildFolderID) UnmarshalJSON(b []byte) error {
|
|||
|
||||
body = strings.Trim(body, `"`)
|
||||
|
||||
u, err := strconv.ParseUint(body, 10, 64)
|
||||
u, err := strconv.ParseInt(body, 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -144,5 +144,5 @@ func (g GuildFolderID) MarshalJSON() ([]byte, error) {
|
|||
return []byte("null"), nil
|
||||
}
|
||||
|
||||
return []byte(strconv.FormatUint(uint64(g), 10)), nil
|
||||
return []byte(strconv.FormatInt(int64(g), 10)), nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue