瀏覽代碼

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 `[]`.
Christopher F 5 年之前
父節點
當前提交
66f4df19c8
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      structs.go

+ 4 - 0
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"`