]> git.giacomolli.uk - onechat/blobdiff - whatsapp_batch.go
Return known failures without redundant checks
[onechat] / whatsapp_batch.go
index dcdd712a8fdf2e938e3842e5bf2966dd0cb8a62c..16b4b2c3953ec1fde980c08b104867e3fb16cde7 100644 (file)
@@ -48,15 +48,6 @@ type WhatsAppMessage struct {
        Reply   bool      `json:"reply,omitempty"`
 }
 
-// Turn tells if the batch starts a turn: a private batch with a message of
-// another person, or a group batch with a message of another person that
-// mentions the user or replies to a message of the user.
-func (b WhatsAppBatch) Turn() bool {
-       return slices.ContainsFunc(b.Messages, func(message WhatsAppMessage) bool {
-               return !message.Mine && (!b.Chat.Group || message.Mention || message.Reply)
-       })
-}
-
 // Text returns the text of the batch for the log, with the times in location.
 // The first line starts with [WhatsApp] and names the chat, its ID, and the day
 // of the first message. Each message has a line with its time and its sender,
@@ -95,3 +86,12 @@ func (b WhatsAppBatch) Text(location *time.Location) string {
 
        return strings.Join(lines, "\n")
 }
+
+// Turn tells if the batch starts a turn: a private batch with a message of
+// another person, or a group batch with a message of another person that
+// mentions the user or replies to a message of the user.
+func (b WhatsAppBatch) Turn() bool {
+       return slices.ContainsFunc(b.Messages, func(message WhatsAppMessage) bool {
+               return !message.Mine && (!b.Chat.Group || message.Mention || message.Reply)
+       })
+}