forked from pothtonswer/discordmuffin
Fix presence unmarshal with game names as numbers (#381)
* Game name is also not validated on the server * Use json.Number instead
This commit is contained in:
parent
aa3973f956
commit
eed1d20f1a
1 changed files with 2 additions and 2 deletions
|
@ -304,7 +304,7 @@ type Game struct {
|
||||||
// UnmarshalJSON unmarshals json to Game struct
|
// UnmarshalJSON unmarshals json to Game struct
|
||||||
func (g *Game) UnmarshalJSON(bytes []byte) error {
|
func (g *Game) UnmarshalJSON(bytes []byte) error {
|
||||||
temp := &struct {
|
temp := &struct {
|
||||||
Name string `json:"name"`
|
Name json.Number `json:"name"`
|
||||||
Type json.RawMessage `json:"type"`
|
Type json.RawMessage `json:"type"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
}{}
|
}{}
|
||||||
|
@ -312,8 +312,8 @@ func (g *Game) UnmarshalJSON(bytes []byte) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
g.Name = temp.Name
|
|
||||||
g.URL = temp.URL
|
g.URL = temp.URL
|
||||||
|
g.Name = temp.Name.String()
|
||||||
|
|
||||||
if temp.Type != nil {
|
if temp.Type != nil {
|
||||||
err = json.Unmarshal(temp.Type, &g.Type)
|
err = json.Unmarshal(temp.Type, &g.Type)
|
||||||
|
|
Loading…
Reference in a new issue