parent
a948670657
commit
43bf6cf0d0
1 changed files with 18 additions and 2 deletions
20
structs.go
20
structs.go
|
@ -12,6 +12,7 @@
|
||||||
package discordgo
|
package discordgo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
@ -338,8 +339,23 @@ type Game struct {
|
||||||
|
|
||||||
// A TimeStamps struct contains start and end times used in the rich presence "playing .." Game
|
// A TimeStamps struct contains start and end times used in the rich presence "playing .." Game
|
||||||
type TimeStamps struct {
|
type TimeStamps struct {
|
||||||
EndTimestamp uint `json:"end,omitempty"`
|
EndTimestamp int64 `json:"end,omitempty"`
|
||||||
StartTimestamp uint `json:"start,omitempty"`
|
StartTimestamp int64 `json:"start,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON unmarshals JSON into TimeStamps struct
|
||||||
|
func (t *TimeStamps) UnmarshalJSON(b []byte) error {
|
||||||
|
temp := struct {
|
||||||
|
End float64 `json:"end,omitempty"`
|
||||||
|
Start float64 `json:"start,omitempty"`
|
||||||
|
}{}
|
||||||
|
err := json.Unmarshal(b, &temp)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
t.EndTimestamp = int64(temp.End)
|
||||||
|
t.StartTimestamp = int64(temp.Start)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// An Assets struct contains assets and labels used in the rich presence "playing .." Game
|
// An Assets struct contains assets and labels used in the rich presence "playing .." Game
|
||||||
|
|
Loading…
Reference in a new issue