From 1e47d31af6ac57cd6b893345b908c4e5eab630d7 Mon Sep 17 00:00:00 2001 From: Franco Alvarez Date: Tue, 11 May 2021 15:19:20 -0300 Subject: [PATCH 1/8] Remove autogenerated files --- .../target/classes/application.properties | 3 --- .../target/classes/log4j2.json | 18 ------------------ .../compile/default-compile/createdFiles.lst | 2 -- .../compile/default-compile/inputFiles.lst | 2 -- 4 files changed, 25 deletions(-) delete mode 100644 samples/java_springboot/51.teams-messaging-extensions-action/target/classes/application.properties delete mode 100644 samples/java_springboot/51.teams-messaging-extensions-action/target/classes/log4j2.json delete mode 100644 samples/java_springboot/51.teams-messaging-extensions-action/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst delete mode 100644 samples/java_springboot/51.teams-messaging-extensions-action/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst diff --git a/samples/java_springboot/51.teams-messaging-extensions-action/target/classes/application.properties b/samples/java_springboot/51.teams-messaging-extensions-action/target/classes/application.properties deleted file mode 100644 index d7d0ee8643..0000000000 --- a/samples/java_springboot/51.teams-messaging-extensions-action/target/classes/application.properties +++ /dev/null @@ -1,3 +0,0 @@ -MicrosoftAppId= -MicrosoftAppPassword= -server.port=3978 diff --git a/samples/java_springboot/51.teams-messaging-extensions-action/target/classes/log4j2.json b/samples/java_springboot/51.teams-messaging-extensions-action/target/classes/log4j2.json deleted file mode 100644 index 67c0ad5306..0000000000 --- a/samples/java_springboot/51.teams-messaging-extensions-action/target/classes/log4j2.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "configuration": { - "name": "Default", - "appenders": { - "Console": { - "name": "Console-Appender", - "target": "SYSTEM_OUT", - "PatternLayout": {"pattern": "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"} - } - }, - "loggers": { - "root": { - "level": "debug", - "appender-ref": {"ref": "Console-Appender","level": "debug"} - } - } - } -} diff --git a/samples/java_springboot/51.teams-messaging-extensions-action/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/samples/java_springboot/51.teams-messaging-extensions-action/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst deleted file mode 100644 index ebaa1b6aa0..0000000000 --- a/samples/java_springboot/51.teams-messaging-extensions-action/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ /dev/null @@ -1,2 +0,0 @@ -com\microsoft\bot\sample\teamsaction\Application.class -com\microsoft\bot\sample\teamsaction\TeamsMessagingExtensionsActionBot.class diff --git a/samples/java_springboot/51.teams-messaging-extensions-action/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/samples/java_springboot/51.teams-messaging-extensions-action/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst deleted file mode 100644 index 657ca17eae..0000000000 --- a/samples/java_springboot/51.teams-messaging-extensions-action/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ /dev/null @@ -1,2 +0,0 @@ -H:\BotFramework\botbuilder-java\samples\51.teams-messaging-extensions-action\src\main\java\com\microsoft\bot\sample\teamsaction\TeamsMessagingExtensionsActionBot.java -H:\BotFramework\botbuilder-java\samples\51.teams-messaging-extensions-action\src\main\java\com\microsoft\bot\sample\teamsaction\Application.java From 8ec3d8ed41ae4fca9aba12b09ba7ac759a070318 Mon Sep 17 00:00:00 2001 From: Franco Alvarez Date: Tue, 11 May 2021 15:21:52 -0300 Subject: [PATCH 2/8] Add package file --- .../microsoft/bot/sample/teamsaction/package-info.java | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 samples/java_springboot/51.teams-messaging-extensions-action/src/main/java/com/microsoft/bot/sample/teamsaction/package-info.java diff --git a/samples/java_springboot/51.teams-messaging-extensions-action/src/main/java/com/microsoft/bot/sample/teamsaction/package-info.java b/samples/java_springboot/51.teams-messaging-extensions-action/src/main/java/com/microsoft/bot/sample/teamsaction/package-info.java new file mode 100644 index 0000000000..adad2856cd --- /dev/null +++ b/samples/java_springboot/51.teams-messaging-extensions-action/src/main/java/com/microsoft/bot/sample/teamsaction/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. + +/** + * This package contains the classes for the Teams Messaging Extension Action sample. + */ +package com.microsoft.bot.sample.teamsaction; \ No newline at end of file From bddb23ead800cd522497ef022b8432cb2d3b1c56 Mon Sep 17 00:00:00 2001 From: Franco Alvarez Date: Tue, 11 May 2021 15:22:38 -0300 Subject: [PATCH 3/8] Fix disparities --- .../TeamsMessagingExtensionsActionBot.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/samples/java_springboot/51.teams-messaging-extensions-action/src/main/java/com/microsoft/bot/sample/teamsaction/TeamsMessagingExtensionsActionBot.java b/samples/java_springboot/51.teams-messaging-extensions-action/src/main/java/com/microsoft/bot/sample/teamsaction/TeamsMessagingExtensionsActionBot.java index 2ed3d9f5fa..c8cb421c18 100644 --- a/samples/java_springboot/51.teams-messaging-extensions-action/src/main/java/com/microsoft/bot/sample/teamsaction/TeamsMessagingExtensionsActionBot.java +++ b/samples/java_springboot/51.teams-messaging-extensions-action/src/main/java/com/microsoft/bot/sample/teamsaction/TeamsMessagingExtensionsActionBot.java @@ -42,6 +42,7 @@ private CompletableFuture createCardCommand( TurnContext turnContext, MessagingExtensionAction action ) { + // The user has chosen to create a card by choosing the 'Create Card' context menu command. Map actionData = (Map) action.getData(); HeroCard card = new HeroCard(); @@ -69,19 +70,25 @@ private CompletableFuture shareMessageCommand( TurnContext turnContext, MessagingExtensionAction action ) { + // The user has chosen to share a message by choosing the 'Share Message' context menu command. Map actionData = (Map) action.getData(); HeroCard card = new HeroCard(); card.setTitle( - action.getMessagePayload().getFrom().getUser() != null ? action.getMessagePayload() - .getFrom().getUser().getDisplayName() : ""); + action.getMessagePayload().getFrom() != null && action.getMessagePayload().getFrom().getUser() != null + ? action.getMessagePayload().getFrom().getUser().getDisplayName() : ""); card.setText(action.getMessagePayload().getBody().getContent()); if (action.getMessagePayload().getAttachments() != null && !action.getMessagePayload() .getAttachments().isEmpty()) { - card.setSubtitle("Attachments not included)"); + // This sample does not add the MessagePayload Attachments. This is left as an + // exercise for the user. + card.setSubtitle(String.format("(%d Attachments not included)", + action.getMessagePayload().getAttachments().size())); } + // This Messaging Extension example allows the user to check a box to include an image with the + // shared message. This demonstrates sending custom parameters along with the message payload. boolean includeImage = actionData.get("includeImage") != null ? ( Boolean.valueOf(actionData.get("includeImage")) ) : false; From 4fc7dd7a36296ef6f69e0e494d662bd463a6bc67 Mon Sep 17 00:00:00 2001 From: Franco Alvarez Date: Tue, 11 May 2021 15:23:12 -0300 Subject: [PATCH 4/8] Update index.html --- .../src/main/webapp/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/java_springboot/51.teams-messaging-extensions-action/src/main/webapp/index.html b/samples/java_springboot/51.teams-messaging-extensions-action/src/main/webapp/index.html index d5ba5158e9..a200688b3e 100644 --- a/samples/java_springboot/51.teams-messaging-extensions-action/src/main/webapp/index.html +++ b/samples/java_springboot/51.teams-messaging-extensions-action/src/main/webapp/index.html @@ -4,7 +4,7 @@ - EchoBot + Teams Action Based Messaging Extension