From c9829b9e28c196cf1c98ce188d28d84258dc55ad Mon Sep 17 00:00:00 2001 From: "diamondburned (Forefront)" Date: Mon, 30 Mar 2020 21:46:03 -0700 Subject: [PATCH] Gateway: Fixed invalid Since type for UpdateStatusData --- discord/time.go | 4 ++++ gateway/commands.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/discord/time.go b/discord/time.go index febef55..01d205d 100644 --- a/discord/time.go +++ b/discord/time.go @@ -76,6 +76,10 @@ func (t UnixTimestamp) Time() time.Time { type UnixMsTimestamp int64 +func TimeToMilliseconds(t time.Time) UnixMsTimestamp { + return UnixMsTimestamp(t.UnixNano() / int64(time.Millisecond)) +} + func (t UnixMsTimestamp) String() string { return t.Time().String() } diff --git a/gateway/commands.go b/gateway/commands.go index 0f0a429..9a3dbfa 100644 --- a/gateway/commands.go +++ b/gateway/commands.go @@ -88,8 +88,8 @@ func (g *Gateway) UpdateVoiceState(data UpdateVoiceStateData) error { } type UpdateStatusData struct { - Since discord.Milliseconds `json:"since,omitempty"` // 0 if not idle - Game *discord.Activity `json:"game,omitempty"` // nullable + Since discord.UnixMsTimestamp `json:"since,omitempty"` // 0 if not idle + Game *discord.Activity `json:"game,omitempty"` // nullable Status discord.Status `json:"status"` AFK bool `json:"afk"`