Skip to content
This repository was archived by the owner on Mar 5, 2023. It is now read-only.

Commit bd0ead5

Browse files
author
jonas747
committed
more lenient presence update handling
note that this is just a bandaid and i need to 1. not rely on presence update formatting at all since it's not enforced 2. implement proper snowflake decoding
1 parent 5e74aa5 commit bd0ead5

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

structs.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"encoding/json"
1616
"fmt"
1717
"net/http"
18+
"strconv"
1819
"sync"
1920
"time"
2021

@@ -639,7 +640,19 @@ func (g *Game) UnmarshalJSONObject(dec *gojay.Decoder, key string) error {
639640
return dec.Object(&g.TimeStamps)
640641
case "assets":
641642
case "application_id":
642-
return dec.String(&g.ApplicationID)
643+
var i interface{}
644+
err := dec.Interface(&i)
645+
if err != nil {
646+
return err
647+
}
648+
switch t := i.(type) {
649+
case int64:
650+
g.ApplicationID = strconv.FormatInt(t, 10)
651+
case int32:
652+
g.ApplicationID = strconv.FormatInt(int64(t), 10)
653+
case string:
654+
g.ApplicationID = t
655+
}
643656
case "instance":
644657
return dec.Int8(&g.Instance)
645658
}

0 commit comments

Comments
 (0)