From 66f4df19c8043d3caaccf5507fa0cc19fc6ad975 Mon Sep 17 00:00:00 2001 From: Christopher F Date: Mon, 22 Jul 2019 00:12:21 -0400 Subject: [PATCH] faeture: add last_pin_timestamp to Channel struct (#596) This resolves #547. Adds a "LastPinTimestamp" field to the Channel structure, which reflects the `last_pin_timestamp` field on the Discord API. This field is indicative of whether or not the channel has any pinned messages, and can save an API request from being sent if there are none. FWIW, The API doesn't seem to return a 404 anymore when there are no pinned messages; it returns a 200 with `[]`. --- structs.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/structs.go b/structs.go index bb00368..fd0050a 100644 --- a/structs.go +++ b/structs.go @@ -224,6 +224,10 @@ type Channel struct { // guaranteed to be an ID of a valid message. LastMessageID string `json:"last_message_id"` + // The timestamp of the last pinned message in the channel. + // Empty if the channel has no pinned messages. + LastPinTimestamp Timestamp `json:"last_pin_timestamp"` + // Whether the channel is marked as NSFW. NSFW bool `json:"nsfw"`