@@ -1,6 +1,9 @@
1package message
1package message
3−import "strings"
5+ "strings"
5type Attachment struct {
8type Attachment struct {
6 FilePath string
9 FilePath string
@@ -11,3 +14,10 @@ type Attachment struct {
12func (a Attachment) IsText() bool { return strings.HasPrefix(a.MimeType, "text/") }
15func (a Attachment) IsText() bool { return strings.HasPrefix(a.MimeType, "text/") }
13func (a Attachment) IsImage() bool { return strings.HasPrefix(a.MimeType, "image/") }
16func (a Attachment) IsImage() bool { return strings.HasPrefix(a.MimeType, "image/") }
18+// ContainsTextAttachment returns true if any of the attachments is a text attachment.
19+func ContainsTextAttachment(attachments []Attachment) bool {
20+ return slices.ContainsFunc(attachments, func(a Attachment) bool {