Добавил преобразование ссылок во вложения
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
790264ee96
commit
901a1cdc05
@ -129,7 +129,12 @@ public final class MessageMailConvert {
|
|||||||
private static Optional<Attachment> convertEntity(Message message, MessageEntity entity) {
|
private static Optional<Attachment> convertEntity(Message message, MessageEntity entity) {
|
||||||
switch (entity.getType()) {
|
switch (entity.getType()) {
|
||||||
case "text_link" -> {
|
case "text_link" -> {
|
||||||
return Optional.of(new LinkAttachment(entity.getUrl()));
|
return Optional.of(entity.getUrl())
|
||||||
|
.map(LinkAttachment::new);
|
||||||
|
}
|
||||||
|
case "url" -> {
|
||||||
|
return Optional.of(entity.getText())
|
||||||
|
.map(LinkAttachment::new);
|
||||||
}
|
}
|
||||||
case "bot_command" -> {
|
case "bot_command" -> {
|
||||||
final String commandValue = entity.getText();
|
final String commandValue = entity.getText();
|
||||||
|
@ -31,4 +31,8 @@ public class TriggerChecks {
|
|||||||
return mail -> Attachments.findFirstButtonClick(mail.getAttachments()).isPresent();
|
return mail -> Attachments.findFirstButtonClick(mail.getAttachments()).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Predicate<Mail> isLinks() {
|
||||||
|
return mail -> Attachments.findFirstLink(mail.getAttachments()).isPresent();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user