Recently, discordgo
v0.24.0 is finally released! With this version, you can use threads or slash commands which is awesome.
In this release, type of Timestamp is changed to string
to time.Time
.
https://github.com/bwmarrin/discordgo/commit/fccf6db03e622e339dcc1dab0dba2ff17bbaa7cb
My bot was blocked to upgrade due to this problem. So I inspected.
In the fix commit, time.Parse(time.RFC3339, string(t))
is used, which implies Discord uses RF3339
internally to express timestamp.
On the other hand, Go's default time.Time.String()
returns 2006-01-02 15:04:05.999999999 -0700 MST
style, which is not RFC3339
.
https://pkg.go.dev/time#Time.String
The problem is, the fix is not applied to all the timestamp in discordgo. Like https://pkg.go.dev/github.com/bwmarrin/discordgo#MessageEmbed , timestamp in string type remains.
Therefore, you have to use time.Format(time.RFC3339)
to pass the timestamp to, for example discordgo.MessageEmbed.Timestamp
.
Top comments (0)