diff --git a/pom.xml b/pom.xml
index 1ad4d8d..79299db 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,9 +74,9 @@
29.0-jre
- com.github.seratch
- jslack-lightning
- 3.4.2
+ com.slack.api
+ slack-api-client
+ 1.39.3
javax.websocket
diff --git a/src/main/java/com/botdarr/clients/matrix/MatrixBootstrap.java b/src/main/java/com/botdarr/clients/matrix/MatrixBootstrap.java
index 4438c2b..9b305ec 100644
--- a/src/main/java/com/botdarr/clients/matrix/MatrixBootstrap.java
+++ b/src/main/java/com/botdarr/clients/matrix/MatrixBootstrap.java
@@ -7,6 +7,8 @@
import com.botdarr.scheduling.Scheduler;
import org.apache.logging.log4j.util.Strings;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Properties;
public class MatrixBootstrap extends ChatClientBootstrap {
@@ -28,13 +30,28 @@ public void init() throws Exception {
chatClient.listen();
}
+ private boolean isValidURL(String urlString) {
+ try {
+ new URL(urlString);
+ return true;
+ } catch (MalformedURLException e) {
+ return false;
+ }
+ }
+
@Override
public boolean isConfigured(Properties properties) {
- return
+ final boolean isConfigured =
!Strings.isBlank(properties.getProperty(Config.Constants.MATRIX_USERNAME)) &&
- !Strings.isBlank(properties.getProperty(Config.Constants.MATRIX_PASSWORD)) &&
- !Strings.isBlank(properties.getProperty(Config.Constants.MATRIX_ROOM)) &&
- !Strings.isBlank(properties.getProperty(Config.Constants.MATRIX_HOME_SERVER));
+ !Strings.isBlank(properties.getProperty(Config.Constants.MATRIX_PASSWORD)) &&
+ !Strings.isBlank(properties.getProperty(Config.Constants.MATRIX_ROOM)) &&
+ !Strings.isBlank(properties.getProperty(Config.Constants.MATRIX_HOME_SERVER));
+
+ if (isConfigured && !isValidURL(properties.getProperty(Config.Constants.MATRIX_HOME_SERVER))) {
+ throw new RuntimeException("Matrix home server must be a url");
+ }
+
+ return isConfigured;
}
@Override
diff --git a/src/main/java/com/botdarr/clients/slack/SlackBootstrap.java b/src/main/java/com/botdarr/clients/slack/SlackBootstrap.java
index bb0bc93..6c5a99e 100644
--- a/src/main/java/com/botdarr/clients/slack/SlackBootstrap.java
+++ b/src/main/java/com/botdarr/clients/slack/SlackBootstrap.java
@@ -5,13 +5,13 @@
import com.botdarr.clients.ChatClientResponseBuilder;
import com.botdarr.commands.CommandContext;
import com.botdarr.scheduling.Scheduler;
-import com.github.seratch.jslack.Slack;
-import com.github.seratch.jslack.api.model.Message;
-import com.github.seratch.jslack.api.model.User;
-import com.github.seratch.jslack.api.model.block.LayoutBlock;
-import com.github.seratch.jslack.api.model.block.SectionBlock;
-import com.github.seratch.jslack.api.model.block.composition.MarkdownTextObject;
-import com.github.seratch.jslack.api.rtm.RTMMessageHandler;
+import com.slack.api.Slack;
+import com.slack.api.model.Message;
+import com.slack.api.model.User;
+import com.slack.api.model.block.LayoutBlock;
+import com.slack.api.model.block.SectionBlock;
+import com.slack.api.model.block.composition.MarkdownTextObject;
+import com.slack.api.rtm.RTMMessageHandler;
import com.google.common.base.Splitter;
import com.google.common.collect.Sets;
import com.google.gson.Gson;
@@ -62,7 +62,7 @@ public void handle(String message) {
}
if (conversationMessages != null) {
conversationMessageLoop:
- for (com.github.seratch.jslack.api.model.Message conversationMessage : conversationMessages) {
+ for (com.slack.api.model.Message conversationMessage : conversationMessages) {
for (LayoutBlock layoutBlock : conversationMessage.getBlocks()) {
if (layoutBlock.getType().equals("section")) {
SectionBlock sectionBlock = (SectionBlock) layoutBlock;
diff --git a/src/main/java/com/botdarr/clients/slack/SlackChatClient.java b/src/main/java/com/botdarr/clients/slack/SlackChatClient.java
index 0cda6f5..14eba7a 100644
--- a/src/main/java/com/botdarr/clients/slack/SlackChatClient.java
+++ b/src/main/java/com/botdarr/clients/slack/SlackChatClient.java
@@ -2,22 +2,22 @@
import com.botdarr.Config;
import com.botdarr.clients.ChatClient;
-import com.github.seratch.jslack.Slack;
-import com.github.seratch.jslack.api.methods.SlackApiException;
-import com.github.seratch.jslack.api.methods.request.chat.ChatPostMessageRequest;
-import com.github.seratch.jslack.api.methods.request.conversations.ConversationsHistoryRequest;
-import com.github.seratch.jslack.api.methods.request.conversations.ConversationsListRequest;
-import com.github.seratch.jslack.api.methods.request.groups.GroupsHistoryRequest;
-import com.github.seratch.jslack.api.methods.request.users.UsersInfoRequest;
-import com.github.seratch.jslack.api.methods.response.conversations.ConversationsListResponse;
-import com.github.seratch.jslack.api.model.Conversation;
-import com.github.seratch.jslack.api.model.ConversationType;
-import com.github.seratch.jslack.api.model.Message;
-import com.github.seratch.jslack.api.model.User;
-import com.github.seratch.jslack.api.model.block.DividerBlock;
-import com.github.seratch.jslack.api.model.block.LayoutBlock;
-import com.github.seratch.jslack.api.rtm.RTMClient;
-import com.github.seratch.jslack.api.rtm.RTMMessageHandler;
+import com.slack.api.Slack;
+import com.slack.api.methods.SlackApiException;
+import com.slack.api.methods.request.chat.ChatPostMessageRequest;
+import com.slack.api.methods.request.conversations.ConversationsHistoryRequest;
+import com.slack.api.methods.request.conversations.ConversationsListRequest;
+import com.slack.api.methods.request.groups.GroupsHistoryRequest;
+import com.slack.api.methods.request.users.UsersInfoRequest;
+import com.slack.api.methods.response.conversations.ConversationsListResponse;
+import com.slack.api.model.Conversation;
+import com.slack.api.model.ConversationType;
+import com.slack.api.model.Message;
+import com.slack.api.model.User;
+import com.slack.api.model.block.DividerBlock;
+import com.slack.api.model.block.LayoutBlock;
+import com.slack.api.rtm.RTMClient;
+import com.slack.api.rtm.RTMMessageHandler;
import com.google.common.base.Splitter;
import com.google.common.collect.Sets;
import org.apache.logging.log4j.LogManager;
diff --git a/src/main/java/com/botdarr/clients/slack/SlackResponse.java b/src/main/java/com/botdarr/clients/slack/SlackResponse.java
index d4fe9be..b601a62 100644
--- a/src/main/java/com/botdarr/clients/slack/SlackResponse.java
+++ b/src/main/java/com/botdarr/clients/slack/SlackResponse.java
@@ -1,7 +1,7 @@
package com.botdarr.clients.slack;
import com.botdarr.clients.ChatClientResponse;
-import com.github.seratch.jslack.api.model.block.LayoutBlock;
+import com.slack.api.model.block.LayoutBlock;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/main/java/com/botdarr/clients/slack/SlackResponseBuilder.java b/src/main/java/com/botdarr/clients/slack/SlackResponseBuilder.java
index 438ad3d..0dddf47 100644
--- a/src/main/java/com/botdarr/clients/slack/SlackResponseBuilder.java
+++ b/src/main/java/com/botdarr/clients/slack/SlackResponseBuilder.java
@@ -11,10 +11,10 @@
import com.botdarr.commands.*;
import com.botdarr.commands.responses.*;
import com.botdarr.utilities.ListUtils;
-import com.github.seratch.jslack.api.model.block.*;
-import com.github.seratch.jslack.api.model.block.composition.MarkdownTextObject;
-import com.github.seratch.jslack.api.model.block.composition.PlainTextObject;
-import com.github.seratch.jslack.api.model.block.element.ButtonElement;
+import com.slack.api.model.block.*;
+import com.slack.api.model.block.composition.MarkdownTextObject;
+import com.slack.api.model.block.composition.PlainTextObject;
+import com.slack.api.model.block.element.ButtonElement;
import org.apache.logging.log4j.util.Strings;
import java.io.IOException;