From f94d49803c5cefa4d3f6d2cce8690edaa50d21a3 Mon Sep 17 00:00:00 2001 From: Philipp Dolif Date: Thu, 11 Aug 2022 15:52:20 +0200 Subject: [PATCH 1/4] BotAction service function call: Include messenger type in body #124 --- .../socialBotManagerService/SocialBotManagerService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java index dee1b68c..49a7091c 100644 --- a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java +++ b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java @@ -1559,7 +1559,12 @@ private void performTrigger(VLE vle, ServiceFunction sf, BotAgent botAgent, Stri } //client.setLogin("alice", "pwalice"); client.setLogin(botAgent.getLoginName(), botPass); + + Bot bot = vle.getBots().get(botAgent.getIdentifier()); + String messengerID = sf.getMessengerName(); + triggeredBody.put("messenger", bot.getMessenger(messengerID).getName()); triggeredBody.put("botName", botAgent.getIdentifier()); + HashMap headers = new HashMap(); System.out.println(sf.getServiceName() + functionPath + " ; " + triggeredBody.toJSONString() + " " + sf.getConsumes() + " " + sf.getProduces() + " My string is" + ":" + triggeredBody.toJSONString()); @@ -1576,8 +1581,6 @@ private void performTrigger(VLE vle, ServiceFunction sf, BotAgent botAgent, Stri if (Boolean.parseBoolean(triggeredBody.getAsString("contextOn"))) { JSONParser parser = new JSONParser(JSONParser.MODE_PERMISSIVE); try { - Bot bot = vle.getBots().get(botAgent.getIdentifier()); - String messengerID = sf.getMessengerName(); JSONObject response = (JSONObject) parser.parse(r.getResponse()); System.out.println(response); triggeredBody.put("text", response.getAsString("text")); From 410469a2fe93dcc55aa142472b7fc954e135702f Mon Sep 17 00:00:00 2001 From: Philipp Dolif Date: Fri, 12 Aug 2022 13:01:29 +0200 Subject: [PATCH 2/4] Use messenger type instead of name #124 --- .../socialBotManagerService/SocialBotManagerService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java index 49a7091c..9afc3437 100644 --- a/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java +++ b/social-bot-manager/src/main/java/i5/las2peer/services/socialBotManagerService/SocialBotManagerService.java @@ -1562,7 +1562,7 @@ private void performTrigger(VLE vle, ServiceFunction sf, BotAgent botAgent, Stri Bot bot = vle.getBots().get(botAgent.getIdentifier()); String messengerID = sf.getMessengerName(); - triggeredBody.put("messenger", bot.getMessenger(messengerID).getName()); + triggeredBody.put("messenger", bot.getMessenger(messengerID).getChatService().toString()); triggeredBody.put("botName", botAgent.getIdentifier()); HashMap headers = new HashMap(); From 0b8cbd350c30384fd833f4561e969771c4420d5d Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 16 Sep 2022 16:06:37 +0200 Subject: [PATCH 3/4] Update build.gradle --- social-bot-manager/build.gradle | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/social-bot-manager/build.gradle b/social-bot-manager/build.gradle index 67187a53..77ee8629 100644 --- a/social-bot-manager/build.gradle +++ b/social-bot-manager/build.gradle @@ -31,7 +31,9 @@ dependencies { // implementation "net.minidev:json-smart:1.3.1" implementation "junit:junit:4.12" implementation "javax.websocket:javax.websocket-api:1.1" - implementation "org.glassfish.tyrus.bundles:tyrus-standalone-client:1.13" + implementation("org.glassfish.tyrus.bundles:tyrus-standalone-client:1.13"){ + exclude module: "grizzly-http-server" + } // implementation "com.github.seratch:jslack:3.4.2" implementation "com.slack.api:slack-api-client:1.20.2" From 57f742d5a5547c37e610488b29f098e854f0630d Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 16 Sep 2022 16:16:38 +0200 Subject: [PATCH 4/4] Update build.gradle --- social-bot-manager/build.gradle | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/social-bot-manager/build.gradle b/social-bot-manager/build.gradle index 77ee8629..9ebff4a0 100644 --- a/social-bot-manager/build.gradle +++ b/social-bot-manager/build.gradle @@ -31,10 +31,7 @@ dependencies { // implementation "net.minidev:json-smart:1.3.1" implementation "junit:junit:4.12" implementation "javax.websocket:javax.websocket-api:1.1" - implementation("org.glassfish.tyrus.bundles:tyrus-standalone-client:1.13"){ - exclude module: "grizzly-http-server" - } - + implementation "org.glassfish.tyrus.bundles:tyrus-standalone-client:1.15" // implementation "com.github.seratch:jslack:3.4.2" implementation "com.slack.api:slack-api-client:1.20.2" implementation "com.slack.api:slack-api-model:1.20.2"