diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..ad136dfa8 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,15 @@ +# Lines starting with '#' are comments. +# Each line is a file pattern followed by one or more owners. + +# More details are here: https://help.github.com/articles/about-codeowners/ + +# The '*' pattern is global owners. + +# Order is important. The last matching pattern has the most precedence. +# The folders are ordered as follows: + +# In each subsection folders are ordered first by depth, then alphabetically. +# This should make it easy to add new rules without breaking existing ones. + +# Global rule: +* @microsoft/botframework-sdk \ No newline at end of file diff --git a/.github/workflows/create-parity-issue.yml b/.github/workflows/create-parity-issue.yml new file mode 100644 index 000000000..51f47a190 --- /dev/null +++ b/.github/workflows/create-parity-issue.yml @@ -0,0 +1,43 @@ +name: create-parity-issue.yml + +on: + workflow_dispatch: + inputs: + prDescription: + description: PR description + default: 'No description provided' + required: true + prNumber: + description: PR number + required: true + prTitle: + description: PR title + required: true + sourceRepo: + description: repository PR is sourced from + required: true + +jobs: + createIssue: + name: create issue + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: joshgummersall/create-issue@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + title: | + port: ${{ github.event.inputs.prTitle }} (#${{ github.event.inputs.prNumber }}) + labels: | + ["parity", "needs-triage", "ExemptFromDailyDRIReport"] + body: | + The changes in [${{ github.event.inputs.prTitle }} (#${{ github.event.inputs.prNumber }})](https://github.com/${{ github.event.inputs.sourceRepo }}/pull/${{ github.event.inputs.prNumber }}) may need to be ported to maintain parity with `${{ github.event.inputs.sourceRepo }}`. + +
+ ${{ github.event.inputs.prDescription }} ++ + Please review and, if necessary, port the changes. diff --git a/.github/workflows/pr-style.yml b/.github/workflows/pr-style.yml new file mode 100644 index 000000000..51dbf531a --- /dev/null +++ b/.github/workflows/pr-style.yml @@ -0,0 +1,18 @@ +name: pr-style.yml + +on: + pull_request: + types: [opened, edited, synchronize] + +jobs: + prStyle: + name: pr-style + runs-on: ubuntu-latest + + steps: + - uses: joshgummersall/pr-style@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + require_issue: "true" + skip_authors: "dependabot" diff --git a/.gitignore b/.gitignore index ce2912fb5..d80f28b79 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,14 @@ dependency-reduced-pom.xml .vscode/settings.json pom.xml.versionsBackup libraries/swagger/generated +/javabotframework_pub.gpg +/javabotframework_sec.gpg +/private.pgp +/privatekey.txt +/public.pgp +/.vs/slnx.sqlite +/.vs/botbuilder-java/v16/.suo +/.vs/ProjectSettings.json +/.vs/botbuilder-java/v16/TestStore/0/000.testlog +/.vs/botbuilder-java/v16/TestStore/0/testlog.manifest +/.vs/VSWorkspaceState.json diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index d3ff17639..f9ba8cf65 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,5 +1,9 @@ -## Code of Conduct +# Microsoft Open Source Code of Conduct -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact - [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. \ No newline at end of file +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). + +Resources: + +- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) +- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns diff --git a/Generator/generator-botbuilder-java/.editorconfig b/Generator/generator-botbuilder-java/.editorconfig deleted file mode 100644 index beffa3084..000000000 --- a/Generator/generator-botbuilder-java/.editorconfig +++ /dev/null @@ -1,11 +0,0 @@ -root = true - -[*] -indent_style = space -indent_size = 2 -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false diff --git a/Generator/generator-botbuilder-java/.eslintignore b/Generator/generator-botbuilder-java/.eslintignore deleted file mode 100644 index 515dfdf4f..000000000 --- a/Generator/generator-botbuilder-java/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -coverage -**/templates diff --git a/Generator/generator-botbuilder-java/.gitattributes b/Generator/generator-botbuilder-java/.gitattributes deleted file mode 100644 index 176a458f9..000000000 --- a/Generator/generator-botbuilder-java/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto diff --git a/Generator/generator-botbuilder-java/.travis.yml b/Generator/generator-botbuilder-java/.travis.yml deleted file mode 100644 index 335ea2d0a..000000000 --- a/Generator/generator-botbuilder-java/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -node_js: - - v10 - - v8 - - v6 - - v4 -after_script: cat ./coverage/lcov.info | coveralls diff --git a/Generator/generator-botbuilder-java/.yo-rc.json b/Generator/generator-botbuilder-java/.yo-rc.json deleted file mode 100644 index 0904532be..000000000 --- a/Generator/generator-botbuilder-java/.yo-rc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "generator-node": { - "promptValues": { - "authorName": "Microsoft", - "authorEmail": "", - "authorUrl": "" - } - } -} \ No newline at end of file diff --git a/Generator/generator-botbuilder-java/LICENSE b/Generator/generator-botbuilder-java/LICENSE deleted file mode 100644 index 08ea44557..000000000 --- a/Generator/generator-botbuilder-java/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/Generator/generator-botbuilder-java/README.md b/Generator/generator-botbuilder-java/README.md deleted file mode 100644 index 4796cad67..000000000 --- a/Generator/generator-botbuilder-java/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# generator-botbuilder-java [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url] -> Template to create conversational bots in Java using Microsoft Bot Framework. - -## Installation - -First, install [Yeoman](http://yeoman.io) and generator-botbuilder-java using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)). - -```bash -npm install -g yo -npm install -g generator-botbuilder-java -``` - -Then generate your new project: - -```bash -yo botbuilder-java -``` - -## Getting To Know Yeoman - - * Yeoman has a heart of gold. - * Yeoman is a person with feelings and opinions, but is very easy to work with. - * Yeoman can be too opinionated at times but is easily convinced not to be. - * Feel free to [learn more about Yeoman](http://yeoman.io/). - -## License - -MIT © [Microsoft]() - - -[npm-image]: https://badge.fury.io/js/generator-botbuilder-java.svg -[npm-url]: https://npmjs.org/package/generator-botbuilder-java -[travis-image]: https://travis-ci.org/Microsoft/generator-botbuilder-java.svg?branch=master -[travis-url]: https://travis-ci.org/Microsoft/generator-botbuilder-java -[daviddm-image]: https://david-dm.org/Microsoft/generator-botbuilder-java.svg?theme=shields.io -[daviddm-url]: https://david-dm.org/Microsoft/generator-botbuilder-java -[coveralls-image]: https://coveralls.io/repos/Microsoft/generator-botbuilder-java/badge.svg -[coveralls-url]: https://coveralls.io/r/Microsoft/generator-botbuilder-java diff --git a/Generator/generator-botbuilder-java/__tests__/app.js b/Generator/generator-botbuilder-java/__tests__/app.js deleted file mode 100644 index 72f8b04db..000000000 --- a/Generator/generator-botbuilder-java/__tests__/app.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; -const path = require('path'); -const assert = require('yeoman-assert'); -const helpers = require('yeoman-test'); - -describe('generator-botbuilder-java:app', () => { - beforeAll(() => { - return helpers - .run(path.join(__dirname, '../generators/app')) - .withPrompts({ someAnswer: true }); - }); - - it('creates files', () => { - assert.file(['dummyfile.txt']); - }); -}); diff --git a/Generator/generator-botbuilder-java/generators/app/index.js b/Generator/generator-botbuilder-java/generators/app/index.js deleted file mode 100644 index 59930463f..000000000 --- a/Generator/generator-botbuilder-java/generators/app/index.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; -const Generator = require('yeoman-generator'); -const chalk = require('chalk'); -const yosay = require('yosay'); -const path = require('path'); -const _ = require('lodash'); -const extend = require('deep-extend'); -const mkdirp = require('mkdirp'); - -module.exports = class extends Generator { - prompting() { - // Have Yeoman greet the user. - this.log( - yosay(`Welcome to the badass ${chalk.red('generator-botbuilder-java')} generator!`) - ); - - const prompts = [ - { name: 'botName', message: `What 's the name of your bot?`, default: 'sample' }, - { name: 'description', message: 'What will your bot do?', default: 'sample' }, - { name: 'dialog', type: 'list', message: 'What default dialog do you want?', choices: ['Echo'] }, - ]; - - return this.prompt(prompts).then(props => { - // To access props later use this.props.someAnswer; - this.props = props; - }); - } - - writing() { - const directoryName = _.kebabCase(this.props.botName); - const defaultDialog = this.props.dialog.split(' ')[0].toLowerCase(); - - if (path.basename(this.destinationPath()) !== directoryName) { - this.log(`Your bot should be in a directory named ${directoryName}\nI'll automatically create this folder.`); - mkdirp(directoryName); - this.destinationRoot(this.destinationPath(directoryName)); - } - - this.fs.copyTpl(this.templatePath('pom.xml'), this.destinationPath('pom.xml'), { botName: directoryName }); - this.fs.copy(this.templatePath(`app.java`), this.destinationPath(`app.java`)); - this.fs.copyTpl(this.templatePath('README.md'), this.destinationPath('README.md'), { - botName: this.props.botName, description: this.props.description - }); - } - - install() { - this.installDependencies({bower: false}); - } -}; diff --git a/Generator/generator-botbuilder-java/generators/app/templates/README.md b/Generator/generator-botbuilder-java/generators/app/templates/README.md deleted file mode 100644 index 47ace33f4..000000000 --- a/Generator/generator-botbuilder-java/generators/app/templates/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# <%= botName %> Bot - -This bot has been created using [Microsoft Bot Framework](https://dev.botframework.com), - -This bot is designed to do the following: - -<%= description %> - -## About the generator - -The goal of the BotBuilder Yeoman generator is to both scaffold out a bot according to general best practices, and to provide some templates you can use when implementing commonly requested features and dialogs in your bot. - -### Dialogs - -This generator provides the following dialogs: -- Echo Dialog, for simple bots - -## Getting Started - -### Dependencies - -### Structure - -### Configuring the bot - -### The dialogs - -- Echo dialog is designed for simple Hello, World demos and to get you started. - -### Running the bot - -## Additional Resources - -- [Microsoft Virtual Academy Bots Course](http://aka.ms/botcourse) -- [Bot Framework Documentation](https://docs.botframework.com) -- [LUIS](https://luis.ai) -- [QnA Maker](https://qnamaker.ai) \ No newline at end of file diff --git a/Generator/generator-botbuilder-java/generators/app/templates/app.java b/Generator/generator-botbuilder-java/generators/app/templates/app.java deleted file mode 100644 index 25f1d699b..000000000 --- a/Generator/generator-botbuilder-java/generators/app/templates/app.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.bot.connector.sample; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.bot.connector.customizations.CredentialProvider; -import com.microsoft.bot.connector.customizations.CredentialProviderImpl; -import com.microsoft.bot.connector.customizations.JwtTokenValidation; -import com.microsoft.bot.connector.customizations.MicrosoftAppCredentials; -import com.microsoft.bot.connector.rest.ConnectorClientImpl; -import com.microsoft.bot.schema.models.Activity; -import com.microsoft.bot.schema.models.ActivityTypes; -import com.microsoft.bot.schema.models.ResourceResponse; -import com.sun.net.httpserver.HttpExchange; -import com.sun.net.httpserver.HttpHandler; -import com.sun.net.httpserver.HttpServer; - -import java.io.IOException; -import java.io.InputStream; -import java.net.InetSocketAddress; -import java.net.URLDecoder; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class App { - private static final Logger LOGGER = Logger.getLogger( App.class.getName() ); - private static String appId = ""; // <-- app id --> - private static String appPassword = ""; // <-- app password --> - - public static void main( String[] args ) throws IOException { - CredentialProvider credentialProvider = new CredentialProviderImpl(appId, appPassword); - HttpServer server = HttpServer.create(new InetSocketAddress(3978), 0); - server.createContext("/api/messages", new MessageHandle(credentialProvider)); - server.setExecutor(null); - server.start(); - } - - static class MessageHandle implements HttpHandler { - private ObjectMapper objectMapper; - private CredentialProvider credentialProvider; - private MicrosoftAppCredentials credentials; - - MessageHandle(CredentialProvider credentialProvider) { - this.objectMapper = new ObjectMapper() - .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) - .findAndRegisterModules(); - this.credentialProvider = credentialProvider; - this.credentials = new MicrosoftAppCredentials(appId, appPassword); - } - - public void handle(HttpExchange httpExchange) throws IOException { - if (httpExchange.getRequestMethod().equalsIgnoreCase("POST")) { - Activity activity = getActivity(httpExchange); - String authHeader = httpExchange.getRequestHeaders().getFirst("Authorization"); - try { - JwtTokenValidation.assertValidActivity(activity, authHeader, credentialProvider); - - // send ack to user activity - httpExchange.sendResponseHeaders(202, 0); - httpExchange.getResponseBody().close(); - - if (activity.type().equals(ActivityTypes.MESSAGE)) { - // reply activity with the same text - ConnectorClientImpl connector = new ConnectorClientImpl(activity.serviceUrl(), this.credentials); - ResourceResponse response = connector.conversations().sendToConversation(activity.conversation().id(), - new Activity() - .withType(ActivityTypes.MESSAGE) - .withText("Echo: " + activity.text()) - .withRecipient(activity.from()) - .withFrom(activity.recipient()) - ); - } - } catch (AuthenticationException ex) { - httpExchange.sendResponseHeaders(401, 0); - httpExchange.getResponseBody().close(); - LOGGER.log(Level.WARNING, "Auth failed!", ex); - } catch (Exception ex) { - LOGGER.log(Level.WARNING, "Execution failed", ex); - } - } - } - - private Activity getActivity(HttpExchange httpExchange) { - try (InputStream is = httpExchange.getRequestBody()) { - return objectMapper.readValue(is, Activity.class); - } catch (Exception ex) { - LOGGER.log(Level.WARNING, "Failed to get activity", ex); - return null; - } - - } - } -} diff --git a/Generator/generator-botbuilder-java/generators/app/templates/pom.xml b/Generator/generator-botbuilder-java/generators/app/templates/pom.xml deleted file mode 100644 index f519f3db7..000000000 --- a/Generator/generator-botbuilder-java/generators/app/templates/pom.xml +++ /dev/null @@ -1,89 +0,0 @@ -
+ * The @Component annotation could be used on the Bot class instead of this method with the + * @Bean annotation. + *
+ * + * @return The Bot implementation for this application. + */ + @Bean + public Bot getBot( + Configuration configuration, + UserState userState, + ConversationState conversationState + ) { + FlightBookingRecognizer recognizer = new FlightBookingRecognizer(configuration); + MainDialog dialog = new MainDialog(recognizer, new BookingDialog()); + return new DialogAndWelcomeBot<>(conversationState, userState, dialog); + } + + /** + * Returns a custom Adapter that provides error handling. + * + * @param configuration The Configuration object to use. + * @return An error handling BotFrameworkHttpAdapter. + */ + @Override + public BotFrameworkHttpAdapter getBotFrameworkHttpAdaptor(Configuration configuration) { + return new AdapterWithErrorHandler(configuration); + } +} + diff --git a/generators/generators/app/templates/core/src/main/java/BookingDetails.java b/generators/generators/app/templates/core/src/main/java/BookingDetails.java new file mode 100644 index 000000000..160242106 --- /dev/null +++ b/generators/generators/app/templates/core/src/main/java/BookingDetails.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package <%= packageName %>; + +/** + * The model class to retrieve the information of the booking. + */ +public class BookingDetails { + + private String destination; + private String origin; + private String travelDate; + + /** + * Gets the destination of the booking. + * + * @return The destination. + */ + public String getDestination() { + return destination; + } + + /** + * Sets the destination of the booking. + * + * @param withDestination The new destination. + */ + public void setDestination(String withDestination) { + this.destination = withDestination; + } + + /** + * Gets the origin of the booking. + * + * @return The origin. + */ + public String getOrigin() { + return origin; + } + + /** + * Sets the origin of the booking. + * + * @param withOrigin The new origin. + */ + public void setOrigin(String withOrigin) { + this.origin = withOrigin; + } + + /** + * Gets the travel date of the booking. + * + * @return The travel date. + */ + public String getTravelDate() { + return travelDate; + } + + /** + * Sets the travel date of the booking. + * + * @param withTravelDate The new travel date. + */ + public void setTravelDate(String withTravelDate) { + this.travelDate = withTravelDate; + } +} diff --git a/generators/generators/app/templates/core/src/main/java/BookingDialog.java b/generators/generators/app/templates/core/src/main/java/BookingDialog.java new file mode 100644 index 000000000..d5e7322b3 --- /dev/null +++ b/generators/generators/app/templates/core/src/main/java/BookingDialog.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package <%= packageName %>; + +import java.util.Arrays; +import java.util.concurrent.CompletableFuture; + +import com.microsoft.bot.builder.MessageFactory; +import com.microsoft.bot.dialogs.DialogTurnResult; +import com.microsoft.bot.dialogs.WaterfallDialog; +import com.microsoft.bot.dialogs.WaterfallStep; +import com.microsoft.bot.dialogs.WaterfallStepContext; +import com.microsoft.bot.dialogs.prompts.ConfirmPrompt; +import com.microsoft.bot.dialogs.prompts.PromptOptions; +import com.microsoft.bot.dialogs.prompts.TextPrompt; +import com.microsoft.bot.schema.Activity; +import com.microsoft.bot.schema.InputHints; +import com.microsoft.recognizers.datatypes.timex.expression.Constants; +import com.microsoft.recognizers.datatypes.timex.expression.TimexProperty; + +/** + * The class containing the booking dialogs. + */ +public class BookingDialog extends CancelAndHelpDialog { + + private final String destinationStepMsgText = "Where would you like to travel to?"; + private final String originStepMsgText = "Where are you traveling from?"; + + /** + * The constructor of the Booking Dialog class. + */ + public BookingDialog() { + super("BookingDialog"); + + addDialog(new TextPrompt("TextPrompt")); + addDialog(new ConfirmPrompt("ConfirmPrompt")); + addDialog(new DateResolverDialog(null)); + WaterfallStep[] waterfallSteps = { + this::destinationStep, + this::originStep, + this::travelDateStep, + this::confirmStep, + this::finalStep + }; + addDialog(new WaterfallDialog("WaterfallDialog", Arrays.asList(waterfallSteps))); + + // The initial child Dialog to run. + setInitialDialogId("WaterfallDialog"); + } + + private CompletableFuture+ * The @Component annotation could be used on the Bot class instead of this method + * with the @Bean annotation. + *
+ * + * @return The Bot implementation for this application. + */ + @Bean + public Bot getBot() { + return new EchoBot(); + } + + /** + * Returns a custom Adapter that provides error handling. + * + * @param configuration The Configuration object to use. + * @return An error handling BotFrameworkHttpAdapter. + */ + @Override + public BotFrameworkHttpAdapter getBotFrameworkHttpAdaptor(Configuration configuration) { + return new AdapterWithErrorHandler(configuration); + } +} diff --git a/generators/generators/app/templates/echo/src/main/java/EchoBot.java b/generators/generators/app/templates/echo/src/main/java/EchoBot.java new file mode 100644 index 000000000..9a474ab44 --- /dev/null +++ b/generators/generators/app/templates/echo/src/main/java/EchoBot.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package <%= packageName %>; + +import com.codepoetics.protonpack.collectors.CompletableFutures; +import com.microsoft.bot.builder.ActivityHandler; +import com.microsoft.bot.builder.MessageFactory; +import com.microsoft.bot.builder.TurnContext; +import com.microsoft.bot.schema.ChannelAccount; +import org.apache.commons.lang3.StringUtils; + +import java.util.List; +import java.util.concurrent.CompletableFuture; + +/** + * This class implements the functionality of the Bot. + * + *+ * This is where application specific logic for interacting with the users would be added. For this + * sample, the {@link #onMessageActivity(TurnContext)} echos the text back to the user. The {@link + * #onMembersAdded(List, TurnContext)} will send a greeting to new conversation participants. + *
+ */ +public class EchoBot extends ActivityHandler { + + @Override + protected CompletableFuture+ * The @Component annotation could be used on the Bot class instead of this method + * with the @Bean annotation. + *
+ * + * @return The Bot implementation for this application. + */ + @Bean + public Bot getBot() { + return new EmptyBot(); + } + + /** + * Returns a custom Adapter that provides error handling. + * + * @param configuration The Configuration object to use. + * @return An error handling BotFrameworkHttpAdapter. + */ + @Override + public BotFrameworkHttpAdapter getBotFrameworkHttpAdaptor(Configuration configuration) { + return new AdapterWithErrorHandler(configuration); + } +} diff --git a/generators/generators/app/templates/empty/src/main/java/EmptyBot.java b/generators/generators/app/templates/empty/src/main/java/EmptyBot.java new file mode 100644 index 000000000..3f8d6208d --- /dev/null +++ b/generators/generators/app/templates/empty/src/main/java/EmptyBot.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package <%= packageName %>; + +import com.codepoetics.protonpack.collectors.CompletableFutures; +import com.microsoft.bot.builder.ActivityHandler; +import com.microsoft.bot.builder.MessageFactory; +import com.microsoft.bot.builder.TurnContext; +import com.microsoft.bot.schema.ChannelAccount; +import org.apache.commons.lang3.StringUtils; + +import java.util.List; +import java.util.concurrent.CompletableFuture; + +/** + * This class implements the functionality of the Bot. + * + *+ * This is where application specific logic for interacting with the users would be added. For this + * sample, the {@link #onMessageActivity(TurnContext)} echos the text back to the user. The {@link + * #onMembersAdded(List, TurnContext)} will send a greeting to new conversation participants. + *
+ */ +public class EmptyBot extends ActivityHandler { + + @Override + protected CompletableFuture