diff --git a/src/main/java/org/sadtech/vkbot/core/distribution/impl/CommentSubscriber.java b/src/main/java/org/sadtech/vkbot/core/distribution/impl/CommentSubscriber.java new file mode 100644 index 0000000..7800ef8 --- /dev/null +++ b/src/main/java/org/sadtech/vkbot/core/distribution/impl/CommentSubscriber.java @@ -0,0 +1,13 @@ +package org.sadtech.vkbot.core.distribution.impl; + +import org.sadtech.vkbot.core.distribution.EventSubscribe; +import org.sadtech.vkbot.core.entity.Comment; + +public class CommentSubscriber implements EventSubscribe { + + + @Override + public void update(Comment object) { + + } +} diff --git a/src/main/java/org/sadtech/vkbot/core/distribution/impl/EventDistributorVK.java b/src/main/java/org/sadtech/vkbot/core/distribution/impl/EventDistributorVK.java index d8b5d76..9b16545 100644 --- a/src/main/java/org/sadtech/vkbot/core/distribution/impl/EventDistributorVK.java +++ b/src/main/java/org/sadtech/vkbot/core/distribution/impl/EventDistributorVK.java @@ -26,7 +26,9 @@ public class EventDistributorVK implements EventDistributable, Runnable { if (eventService.getJsonObjects().peek() != null) { JsonObject event = eventService.getJsonObjects().poll(); log.info("Главный дистрибьютор отправил событие дальше"); - eventDistributionMap.get(event.get("type").getAsString()).update(event.getAsJsonObject("object")); + if (eventDistributionMap.containsKey(event.get("type").getAsString())) { + eventDistributionMap.get(event.get("type").getAsString()).update(event.getAsJsonObject("object")); + } } } } diff --git a/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailChatSubscriber.java b/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailChatSubscriber.java index 33c56fa..00c6fcc 100644 --- a/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailChatSubscriber.java +++ b/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailChatSubscriber.java @@ -9,7 +9,7 @@ public class MailChatSubscriber implements EventSubscribe { private MailService mailService; - public MailChatSubscriber(MailService mailService, EventDistributable eventDistributable) { + public MailChatSubscriber(EventDistributable eventDistributable, MailService mailService) { this.mailService = mailService; eventDistributable.registerSubscriber("chat", this); } diff --git a/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailSubscriber.java b/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailSubscriber.java index 55cd800..f55e9e4 100644 --- a/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailSubscriber.java +++ b/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailSubscriber.java @@ -52,7 +52,7 @@ public class MailSubscriber implements EventSubscribe, EventDistribu eventDistributionMap.get("chat").update(userMessage); } } else { - if (admins.contains(userMessage.getUserId())) { + if (admins.contains(userMessage.getUserId()) && eventDistributionMap.containsKey("terminal")) { log.info("Сообщение отправлено в репозиторий команд"); eventDistributionMap.get("terminal").update(userMessage); } else { diff --git a/src/main/java/org/sadtech/vkbot/core/entity/Comment.java b/src/main/java/org/sadtech/vkbot/core/entity/Comment.java new file mode 100644 index 0000000..ebb76d9 --- /dev/null +++ b/src/main/java/org/sadtech/vkbot/core/entity/Comment.java @@ -0,0 +1,4 @@ +package org.sadtech.vkbot.core.entity; + +public class Comment { +} diff --git a/src/main/java/org/sadtech/vkbot/core/sender/MailSanderVk.java b/src/main/java/org/sadtech/vkbot/core/sender/MailSenderVk.java similarity index 75% rename from src/main/java/org/sadtech/vkbot/core/sender/MailSanderVk.java rename to src/main/java/org/sadtech/vkbot/core/sender/MailSenderVk.java index aa72851..08873e6 100644 --- a/src/main/java/org/sadtech/vkbot/core/sender/MailSanderVk.java +++ b/src/main/java/org/sadtech/vkbot/core/sender/MailSenderVk.java @@ -13,16 +13,16 @@ import org.sadtech.vkbot.core.insert.InsertWords; import java.util.List; -public class MailSanderVk implements MailSandler { +public class MailSenderVk implements MailSent { - public static final Logger log = Logger.getLogger(MailSanderVk.class); + public static final Logger log = Logger.getLogger(MailSenderVk.class); private VkApiClient vkApiClient; private GroupActor groupActor; private VkInsertData vkInsertData; - public MailSanderVk(VkConnect vkConnect) { + public MailSenderVk(VkConnect vkConnect) { this.vkApiClient = vkConnect.getVkApiClient(); this.groupActor = vkConnect.getGroupActor(); this.vkInsertData = new VkInsertData(vkConnect); @@ -48,15 +48,6 @@ public class MailSanderVk implements MailSandler { return messages; } - @Override - public void send(MailSend mailSend, Integer peerId) { - MessagesSendQuery messages = createMessage(mailSend, peerId); - if (mailSend.getMessage() != null) { - messages.message(mailSend.getMessage()); - } - sendMessage(messages); - } - @Override public void send(MailSend mailSend, Integer peerId, Integer userId) { MessagesSendQuery messages = createMessage(mailSend, peerId); @@ -66,17 +57,6 @@ public class MailSanderVk implements MailSandler { sendMessage(messages); } - public void send(MailSend mailSend, Integer peerId, List insertWords) { - MessagesSendQuery messages = createMessage(mailSend, peerId); - if (mailSend.getMessage() != null) { - InsertWords insert = new InsertWords(); - insert.setInText(mailSend.getMessage()); - insert.insert(insertWords); - messages.message(insert.getOutText()); - } - sendMessage(messages); - } - @Override public void send(MailSend mailSend, Integer peerId, Integer userId, List insertWords) { MessagesSendQuery messages = createMessage(mailSend, peerId); diff --git a/src/main/java/org/sadtech/vkbot/core/sender/MailSandler.java b/src/main/java/org/sadtech/vkbot/core/sender/MailSent.java similarity index 63% rename from src/main/java/org/sadtech/vkbot/core/sender/MailSandler.java rename to src/main/java/org/sadtech/vkbot/core/sender/MailSent.java index bdcce23..19bab9f 100644 --- a/src/main/java/org/sadtech/vkbot/core/sender/MailSandler.java +++ b/src/main/java/org/sadtech/vkbot/core/sender/MailSent.java @@ -4,14 +4,10 @@ import org.sadtech.vkbot.core.entity.MailSend; import java.util.List; -public interface MailSandler { - - void send(MailSend mailSend, Integer peerId); +public interface MailSent { void send(MailSend mailSend, Integer peerId, Integer userId); - void send(MailSend mailSend, Integer peerId, List insertWords); - void send(MailSend mailSend, Integer peerId, Integer userId, List insertWords); }