From f561786d58a0b61747274119f6a4604cfdddbbc7 Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Sun, 9 Apr 2023 11:24:12 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=20=D0=B2=20UnitTrigger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../godfather/telegram/simple/core/util/UnitTrigger.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/telegram-core/telegram-core-simple/src/main/java/dev/struchkov/godfather/telegram/simple/core/util/UnitTrigger.java b/telegram-core/telegram-core-simple/src/main/java/dev/struchkov/godfather/telegram/simple/core/util/UnitTrigger.java index b243647..6c3e3ab 100644 --- a/telegram-core/telegram-core-simple/src/main/java/dev/struchkov/godfather/telegram/simple/core/util/UnitTrigger.java +++ b/telegram-core/telegram-core-simple/src/main/java/dev/struchkov/godfather/telegram/simple/core/util/UnitTrigger.java @@ -4,6 +4,7 @@ import dev.struchkov.godfather.main.domain.content.Mail; import dev.struchkov.godfather.telegram.domain.attachment.ButtonClickAttachment; import dev.struchkov.godfather.telegram.main.core.util.Attachments; +import java.util.Arrays; import java.util.Optional; import java.util.function.Predicate; @@ -41,4 +42,8 @@ public class UnitTrigger { .isPresent(); } + public static Predicate isPersonId(String... personId) { + return mail -> Arrays.stream(personId).anyMatch(id -> id.equals(mail.getFromPersonId())); + } + }