livenote: cache object id

This commit is contained in:
c9s 2024-11-05 17:04:59 +08:00
parent 0471cb2340
commit 0e2eb8ba54
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -14,6 +14,8 @@ type LiveNote struct {
ChannelID string `json:"channelId"`
Object Object
cachedObjID string
}
func NewLiveNote(object Object) *LiveNote {
@ -23,7 +25,12 @@ func NewLiveNote(object Object) *LiveNote {
}
func (n *LiveNote) ObjectID() string {
return n.Object.ObjectID()
if n.cachedObjID != "" {
return n.cachedObjID
}
n.cachedObjID = n.Object.ObjectID()
return n.cachedObjID
}
func (n *LiveNote) SetMessageID(messageID string) {