From d727e37bd89b5e016cd09e2b241747c7d07a881a Mon Sep 17 00:00:00 2001 From: Mark Struchkov Date: Sun, 27 Jan 2019 17:15:23 +0300 Subject: [PATCH] =?UTF-8?q?Autoresponder:=20=D0=98=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B0=D1=80=D1=85=D0=B8=D1=82=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D1=83=D1=80=D1=83=20=D1=8E=D0=BD=D0=B8=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Теперь юниты хранять только MailSend, а не поля в разнабой, которые необходимо отправить пользователю --- .../java/org/sadtech/vkbot/core/sender/MailSanderVk.java | 9 +++++++++ .../java/org/sadtech/vkbot/core/sender/MailSend.java | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/main/java/org/sadtech/vkbot/core/sender/MailSanderVk.java b/src/main/java/org/sadtech/vkbot/core/sender/MailSanderVk.java index 82306ad..41e509b 100644 --- a/src/main/java/org/sadtech/vkbot/core/sender/MailSanderVk.java +++ b/src/main/java/org/sadtech/vkbot/core/sender/MailSanderVk.java @@ -24,10 +24,19 @@ public class MailSanderVk implements MailSandler { } if (mailSend.getKeyboard()!=null) { messages.keyboard(mailSend.getKeyboard()); + } else { + messages.keyboard("{\"buttons\":[],\"one_time\":true}"); } if (mailSend.getLat()!=null && mailSend.getaLong()!=null) { messages.lat(mailSend.getLat()).lng(mailSend.getaLong()); } + if (mailSend.getStickerId()!=null) { + try { + vkApiClient.messages().send(groupActor).peerId(mailSend.getIdRecipient()).stickerId(mailSend.getStickerId()).execute(); + } catch (ApiException | ClientException e) { + e.printStackTrace(); + } + } try { messages.execute(); diff --git a/src/main/java/org/sadtech/vkbot/core/sender/MailSend.java b/src/main/java/org/sadtech/vkbot/core/sender/MailSend.java index aa98d1c..75d5462 100644 --- a/src/main/java/org/sadtech/vkbot/core/sender/MailSend.java +++ b/src/main/java/org/sadtech/vkbot/core/sender/MailSend.java @@ -7,6 +7,7 @@ public class MailSend { private Integer idRecipient; private Float lat; private Float aLong; + private Integer stickerId; public MailSend() { @@ -51,4 +52,12 @@ public class MailSend { public void setaLong(Float aLong) { this.aLong = aLong; } + + public Integer getStickerId() { + return stickerId; + } + + public void setStickerId(Integer stickerId) { + this.stickerId = stickerId; + } }