From e2ed76abbe7b46a639b4fdae499ee6d03d49f884 Mon Sep 17 00:00:00 2001 From: Mark Struchkov Date: Fri, 12 Jul 2019 12:05:57 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 10 ++++----- .../vkbot/core/convert/KeyBoardConvert.java | 22 +++++++++++-------- .../core/convert/MessageMailConvert.java | 12 +++++----- .../convert/TopicCommentToBoardComment.java | 4 ++-- .../core/distribution/AccountSubscribe.java | 8 +++---- .../distribution/BoardCommentSubscribe.java | 4 ++-- .../core/distribution/EventDistributor.java | 3 ++- .../core/distribution/MailSubscriber.java | 4 ++-- .../vkbot/core/listener/EventListenerVk.java | 6 ++--- .../core/sender/BoardCommentSenderVk.java | 14 ++++++------ .../vkbot/core/sender/MailSenderVk.java | 6 ++--- 11 files changed, 49 insertions(+), 44 deletions(-) diff --git a/pom.xml b/pom.xml index 621fbc2..81ab502 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.sadtech.vkbot vkbot-core - 0.2.1-RELEASE + 0.2.2-SNAPSHOT jar @@ -23,7 +23,7 @@ - 0.6.2-RELEASE + 0.6.3-SNAPSHOT 0.5.13-FORK 1.2.17 @@ -43,9 +43,9 @@ - org.sadtech.bot - bot-core - ${bot.core.ver} + org.sadtech.social + social-core + ${social.core.ver} diff --git a/src/main/java/org/sadtech/vkbot/core/convert/KeyBoardConvert.java b/src/main/java/org/sadtech/vkbot/core/convert/KeyBoardConvert.java index 0b4c60a..cc84173 100644 --- a/src/main/java/org/sadtech/vkbot/core/convert/KeyBoardConvert.java +++ b/src/main/java/org/sadtech/vkbot/core/convert/KeyBoardConvert.java @@ -1,12 +1,16 @@ package org.sadtech.vkbot.core.convert; -import com.vk.api.sdk.objects.messages.*; -import org.sadtech.bot.core.domain.keyboard.ButtonColor; -import org.sadtech.bot.core.domain.keyboard.KeyBoard; -import org.sadtech.bot.core.domain.keyboard.KeyBoardButton; -import org.sadtech.bot.core.domain.keyboard.KeyBoardLine; -import org.sadtech.bot.core.domain.keyboard.button.KeyBoardButtonAccount; -import org.sadtech.bot.core.domain.keyboard.button.KeyBoardButtonText; +import com.vk.api.sdk.objects.messages.Keyboard; +import com.vk.api.sdk.objects.messages.KeyboardButton; +import com.vk.api.sdk.objects.messages.KeyboardButtonAction; +import com.vk.api.sdk.objects.messages.KeyboardButtonActionType; +import com.vk.api.sdk.objects.messages.KeyboardButtonColor; +import org.sadtech.social.core.domain.keyboard.ButtonColor; +import org.sadtech.social.core.domain.keyboard.KeyBoard; +import org.sadtech.social.core.domain.keyboard.KeyBoardButton; +import org.sadtech.social.core.domain.keyboard.KeyBoardLine; +import org.sadtech.social.core.domain.keyboard.button.KeyBoardButtonAccount; +import org.sadtech.social.core.domain.keyboard.button.KeyBoardButtonText; import org.sadtech.vkbot.core.config.VkConnect; import java.util.ArrayList; @@ -73,7 +77,7 @@ public class KeyBoardConvert { private String createHash(KeyBoardButtonAccount button) { StringBuilder stringBuilder = new StringBuilder(); - if (button.getAmount()!=null) { + if (button.getAmount() != null) { stringBuilder .append("action=pay-to-group&amount=") .append(button.getAmount()).append("&group_id=") @@ -84,7 +88,7 @@ public class KeyBoardConvert { .append(button.getAmount()).append("&group_id=") .append(vkConnect.getGroupActor().getGroupId()); } - if (button.getAccountId()!=null) { + if (button.getAccountId() != null) { stringBuilder.append("&description=").append(button.getAccountId()); } return stringBuilder.append("&aid=").append(vkConnect.getServiceActor().getId()).toString(); diff --git a/src/main/java/org/sadtech/vkbot/core/convert/MessageMailConvert.java b/src/main/java/org/sadtech/vkbot/core/convert/MessageMailConvert.java index 19555cf..1cd3d60 100644 --- a/src/main/java/org/sadtech/vkbot/core/convert/MessageMailConvert.java +++ b/src/main/java/org/sadtech/vkbot/core/convert/MessageMailConvert.java @@ -2,10 +2,10 @@ package org.sadtech.vkbot.core.convert; import com.vk.api.sdk.objects.messages.Message; import com.vk.api.sdk.objects.messages.MessageAttachment; -import org.sadtech.bot.core.domain.content.Mail; -import org.sadtech.bot.core.domain.content.attachment.Attachment; -import org.sadtech.bot.core.domain.content.attachment.AudioMessage; -import org.sadtech.bot.core.domain.content.attachment.Geo; +import org.sadtech.social.core.domain.content.Mail; +import org.sadtech.social.core.domain.content.attachment.Attachment; +import org.sadtech.social.core.domain.content.attachment.AudioMessage; +import org.sadtech.social.core.domain.content.attachment.Geo; import java.time.Instant; import java.time.LocalDateTime; @@ -17,7 +17,7 @@ public class MessageMailConvert implements Convert { @Override public Mail converting(Message message) { Mail mail = new Mail(); - mail.setMessage(message.getText()); + mail.setText(message.getText()); mail.setCreateDate(LocalDateTime.ofInstant(Instant.ofEpochSecond(message.getDate()), TimeZone.getDefault().toZoneId())); mail.setId(message.getId()); mail.setPersonId(message.getPeerId()); @@ -25,7 +25,7 @@ public class MessageMailConvert implements Convert { .stream() .map(this::convertAttachment) .collect(Collectors.toList())); - if (message.getGeo()!=null) { + if (message.getGeo() != null) { mail.getAttachments().add(convertGeo(message.getGeo())); } return mail; diff --git a/src/main/java/org/sadtech/vkbot/core/convert/TopicCommentToBoardComment.java b/src/main/java/org/sadtech/vkbot/core/convert/TopicCommentToBoardComment.java index c3d1187..a2cf364 100644 --- a/src/main/java/org/sadtech/vkbot/core/convert/TopicCommentToBoardComment.java +++ b/src/main/java/org/sadtech/vkbot/core/convert/TopicCommentToBoardComment.java @@ -1,7 +1,7 @@ package org.sadtech.vkbot.core.convert; import com.vk.api.sdk.objects.board.TopicComment; -import org.sadtech.bot.core.domain.content.BoardComment; +import org.sadtech.social.core.domain.content.BoardComment; import java.time.Instant; import java.time.LocalDateTime; @@ -13,7 +13,7 @@ public class TopicCommentToBoardComment implements Convert implements Runnable { private static final Logger log = Logger.getLogger(EventDistributor.class); diff --git a/src/main/java/org/sadtech/vkbot/core/distribution/MailSubscriber.java b/src/main/java/org/sadtech/vkbot/core/distribution/MailSubscriber.java index 64e218b..0004c08 100644 --- a/src/main/java/org/sadtech/vkbot/core/distribution/MailSubscriber.java +++ b/src/main/java/org/sadtech/vkbot/core/distribution/MailSubscriber.java @@ -3,8 +3,8 @@ package org.sadtech.vkbot.core.distribution; import com.google.gson.Gson; import com.google.gson.JsonObject; import com.vk.api.sdk.objects.messages.Message; -import org.sadtech.bot.core.domain.content.Mail; -import org.sadtech.bot.core.service.MailService; +import org.sadtech.social.core.domain.content.Mail; +import org.sadtech.social.core.service.MailService; import org.sadtech.vkbot.core.convert.Convert; import org.sadtech.vkbot.core.convert.MessageMailConvert; diff --git a/src/main/java/org/sadtech/vkbot/core/listener/EventListenerVk.java b/src/main/java/org/sadtech/vkbot/core/listener/EventListenerVk.java index a292455..32bfc94 100644 --- a/src/main/java/org/sadtech/vkbot/core/listener/EventListenerVk.java +++ b/src/main/java/org/sadtech/vkbot/core/listener/EventListenerVk.java @@ -8,9 +8,9 @@ import com.vk.api.sdk.exceptions.LongPollServerKeyExpiredException; import com.vk.api.sdk.objects.callback.longpoll.responses.GetLongPollEventsResponse; import com.vk.api.sdk.objects.groups.LongPollServer; import org.apache.log4j.Logger; -import org.sadtech.bot.core.repository.impl.EventRepositoryQueue; -import org.sadtech.bot.core.service.RawEventService; -import org.sadtech.bot.core.service.impl.RawEventServiceImpl; +import org.sadtech.social.core.repository.impl.EventRepositoryQueue; +import org.sadtech.social.core.service.RawEventService; +import org.sadtech.social.core.service.impl.RawEventServiceImpl; import org.sadtech.vkbot.core.config.VkConnect; public class EventListenerVk implements Runnable { diff --git a/src/main/java/org/sadtech/vkbot/core/sender/BoardCommentSenderVk.java b/src/main/java/org/sadtech/vkbot/core/sender/BoardCommentSenderVk.java index 076e3e6..8879f5f 100644 --- a/src/main/java/org/sadtech/vkbot/core/sender/BoardCommentSenderVk.java +++ b/src/main/java/org/sadtech/vkbot/core/sender/BoardCommentSenderVk.java @@ -5,12 +5,12 @@ import com.vk.api.sdk.client.actors.GroupActor; import com.vk.api.sdk.client.actors.UserActor; import com.vk.api.sdk.exceptions.ApiException; import com.vk.api.sdk.exceptions.ClientException; -import org.sadtech.bot.core.domain.BoxAnswer; -import org.sadtech.bot.core.domain.keyboard.KeyBoardButton; -import org.sadtech.bot.core.domain.keyboard.KeyBoardLine; -import org.sadtech.bot.core.domain.keyboard.button.KeyBoardButtonText; -import org.sadtech.bot.core.exception.MailSendException; -import org.sadtech.bot.core.service.sender.Sent; +import org.sadtech.social.core.domain.BoxAnswer; +import org.sadtech.social.core.domain.keyboard.KeyBoardButton; +import org.sadtech.social.core.domain.keyboard.KeyBoardLine; +import org.sadtech.social.core.domain.keyboard.button.KeyBoardButtonText; +import org.sadtech.social.core.exception.MailSendException; +import org.sadtech.social.core.service.sender.Sent; import org.sadtech.vkbot.core.config.VkConnect; import org.sadtech.vkbot.core.utils.VkInsertData; @@ -43,7 +43,7 @@ public class BoardCommentSenderVk implements Sent { for (KeyBoardButton keyBoardButton : keyBoardLine.getKeyBoardButtons()) { switch (keyBoardButton.getType()) { case TEXT: - insertAnswer.append("- ").append(((KeyBoardButtonText)keyBoardButton).getLabel()).append("\n"); + insertAnswer.append("- ").append(((KeyBoardButtonText) keyBoardButton).getLabel()).append("\n"); } } diff --git a/src/main/java/org/sadtech/vkbot/core/sender/MailSenderVk.java b/src/main/java/org/sadtech/vkbot/core/sender/MailSenderVk.java index 556ba28..90a895f 100644 --- a/src/main/java/org/sadtech/vkbot/core/sender/MailSenderVk.java +++ b/src/main/java/org/sadtech/vkbot/core/sender/MailSenderVk.java @@ -7,9 +7,9 @@ import com.vk.api.sdk.exceptions.ClientException; import com.vk.api.sdk.objects.messages.Keyboard; import com.vk.api.sdk.queries.messages.MessagesSendQuery; import org.apache.log4j.Logger; -import org.sadtech.bot.core.domain.BoxAnswer; -import org.sadtech.bot.core.domain.keyboard.KeyBoard; -import org.sadtech.bot.core.service.sender.Sent; +import org.sadtech.social.core.domain.BoxAnswer; +import org.sadtech.social.core.domain.keyboard.KeyBoard; +import org.sadtech.social.core.service.sender.Sent; import org.sadtech.vkbot.core.config.VkConnect; import org.sadtech.vkbot.core.convert.KeyBoardConvert; import org.sadtech.vkbot.core.utils.VkInsertData;