feat: add timestamp - #12
Conversation
|
@msstoci Thanks for you contribution, it's really appreciated. I have question though, based on https://birdie0.github.io/discord-webhooks-guide/discord_webhook.html the timestamp should be ISO8601. I am not sure the timestamp coming from golang is in this format, could you provide me with more info/details here |
// MarshalJSON implements the json.Marshaler interface.
// The time is a quoted string in the RFC 3339 format with sub-second precision.
// If the timestamp cannot be represented as valid RFC 3339
// (e.g., the year is out of range), then an error is reported.
func (t Time) MarshalJSON() ([]byte, error) {
b := make([]byte, 0, len(RFC3339Nano)+len(`""`))
b = append(b, '"')
b, err := t.appendStrictRFC3339(b)
b = append(b, '"')
if err != nil {
return nil, errors.New("Time.MarshalJSON: " + err.Error())
}
return b, nil
}Pulled from Go v1.20.7 source code, looks like cc @gtuk |
|
@msstoci Hi. the timestamp field should be added to the Embed struct and not to Message |
|
@TheFiordi Appreciate the review, and you're totally right, but the PR was raised by @msstoci :) |
You're right, I'm so sorry!! |
|
@msstoci do you want to update your PR, with the suggestion from @TheFiordi |
add timestamp on Embeds
reference: https://birdie0.github.io/discord-webhooks-guide/structure/embed/timestamp.html