From edae08383b3ed69e4405cfb6004fdc43c7efb142 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 26 Sep 2024 00:23:05 +0300 Subject: [PATCH] event: add Has method for Mentions --- event/message.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/event/message.go b/event/message.go index 3c6edfdd..097c585e 100644 --- a/event/message.go +++ b/event/message.go @@ -220,6 +220,10 @@ func (m *Mentions) Add(userID id.UserID) { } } +func (m *Mentions) Has(userID id.UserID) bool { + return m != nil && slices.Contains(m.UserIDs, userID) +} + type EncryptedFileInfo struct { attachment.EncryptedFile URL id.ContentURIString `json:"url"`