|
1 | | -# 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] |
2 | | -> Template to create conversational bots in Java using Microsoft Bot Framework. |
| 1 | +# generator-botbuilder-java |
| 2 | + |
| 3 | +Yeoman generator for [Bot Framework v4](https://dev.botframework.com). Will let you quickly set up a conversational AI bot |
| 4 | +using core AI capabilities. |
| 5 | + |
| 6 | +## About |
| 7 | + |
| 8 | +`generator-botbuilder-java` will help you build new conversational AI bots using the [Bot Framework v4](https://dev.botframework.com). |
| 9 | + |
| 10 | +## Templates |
| 11 | + |
| 12 | +The generator supports three different template options. The table below can help guide which template is right for you. |
| 13 | + |
| 14 | +| Template | Description | |
| 15 | +| ---------- | --------- | |
| 16 | +| Echo Bot | A good template if you want a little more than "Hello World!", but not much more. This template handles the very basics of sending messages to a bot, and having the bot process the messages by repeating them back to the user. This template produces a bot that simply "echoes" back to the user anything the user says to the bot. | |
| 17 | +| Empty Bot | A good template if you are familiar with Bot Framework v4, and simply want a basic skeleton project. Also a good option if you want to take sample code from the documentation and paste it into a minimal bot in order to learn. | |
| 18 | + |
| 19 | +### How to Choose a Template |
| 20 | + |
| 21 | +| Template | When This Template is a Good Choice | |
| 22 | +| -------- | -------- | |
| 23 | +| Echo Bot | You are new to Bot Framework v4 and want a working bot with minimal features. | |
| 24 | +| Empty Bot | You are a seasoned Bot Framework v4 developer. You've built bots before, and want the minimum skeleton of a bot. | |
| 25 | + |
| 26 | +### Template Overview |
| 27 | + |
| 28 | +#### Echo Bot Template |
| 29 | + |
| 30 | +The Echo Bot template is slightly more than the a classic "Hello World!" example, but not by much. This template shows the basic structure of a bot, how a bot recieves messages from a user, and how a bot sends messages to a user. The bot will "echo" back to the user, what the user says to the bot. It is a good choice for first time, new to Bot Framework v4 developers. |
| 31 | + |
| 32 | +#### Empty Bot Template |
| 33 | + |
| 34 | +The Empty Bot template is the minimal skeleton code for a bot. It provides a stub `onTurn` handler but does not perform any actions. If you are experienced writing bots with Bot Framework v4 and want the minimum scaffolding, the Empty template is for you. |
3 | 35 |
|
4 | 36 | ## Installation |
5 | 37 |
|
6 | | -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/)). |
| 38 | +1. Install [Yeoman](http://yeoman.io) using [npm](https://www.npmjs.com) (we assume you have pre-installed [node.js](https://nodejs.org/)). |
| 39 | + |
| 40 | + ```bash |
| 41 | + # Make sure both are installed globally |
| 42 | + npm install -g yo |
| 43 | + ``` |
| 44 | + |
| 45 | +2. Install generator-botbuilder-java by typing the following in your console: |
| 46 | + |
| 47 | + ```bash |
| 48 | + # Make sure both are installed globally |
| 49 | + npm install -g generator-botbuilder-java |
| 50 | + ``` |
| 51 | + |
| 52 | +3. Verify that Yeoman and generator-botbuilder-java have been installed correctly by typing the following into your console: |
| 53 | + |
| 54 | + ```bash |
| 55 | + yo botbuilder-java --help |
| 56 | + ``` |
| 57 | + |
| 58 | +## Usage |
| 59 | + |
| 60 | +### Creating a New Bot Project |
| 61 | + |
| 62 | +When the generator is launched, it will prompt for the information required to create a new bot. |
7 | 63 |
|
8 | 64 | ```bash |
9 | | -npm install -g yo |
10 | | -npm install -g generator-botbuilder-java |
| 65 | +# Run the generator in interactive mode |
| 66 | +yo botbuilder-java |
11 | 67 | ``` |
12 | 68 |
|
13 | | -Then generate your new project: |
| 69 | +### Generator Command Line Options |
| 70 | + |
| 71 | +The generator supports a number of command line options that can be used to change the generator's default options or to pre-seed a prompt. |
| 72 | +
|
| 73 | +| Command line Option | Description | |
| 74 | +| ------------------- | ----------- | |
| 75 | +| --help, -h | List help text for all supported command-line options | |
| 76 | +| --botName, -N | The name given to the bot project | |
| 77 | +| --packageName, -P | The Java package name to use for the bot | |
| 78 | +| --template, -T | The template used to generate the project. Options are `empty`, or `echo`. See [https://aka.ms/botbuilder-generator](https://aka.ms/botbuilder-generator) for additional information regarding the different template option and their functional differences. | |
| 79 | +| --noprompt | The generator will not prompt for confirmation before creating a new bot. Any requirement options not passed on the command line will use a reasonable default value. This option is intended to enable automated bot generation for testing purposes. | |
| 80 | +
|
| 81 | +#### Example Using Command Line Options |
| 82 | +
|
| 83 | +This example shows how to pass command line options to the generator, setting the default language to TypeScript and the default template to Core. |
14 | 84 |
|
15 | 85 | ```bash |
16 | | -yo botbuilder-java |
| 86 | +# Run the generator defaulting the pacakge name and the template |
| 87 | +yo botbuilder-java --P "com.mycompany.bot" --T "echo" |
17 | 88 | ``` |
18 | 89 |
|
19 | | -## Getting To Know Yeoman |
| 90 | +### Generating a Bot Using --noprompt |
20 | 91 |
|
21 | | - * Yeoman has a heart of gold. |
22 | | - * Yeoman is a person with feelings and opinions, but is very easy to work with. |
23 | | - * Yeoman can be too opinionated at times but is easily convinced not to be. |
24 | | - * Feel free to [learn more about Yeoman](http://yeoman.io/). |
| 92 | +The generator can be run in `--noprompt` mode, which can be used for automated bot creation. When run in `--noprompt` mode, the generator can be configured using command line options as documented above. If a command line option is ommitted a reasonable default will be used. In addition, passing the `--noprompt` option will cause the generator to create a new bot project without prompting for confirmation before generating the bot. |
25 | 93 |
|
26 | | -## License |
| 94 | +#### Default Options |
27 | 95 |
|
28 | | -MIT © [Microsoft]() |
| 96 | +| Command line Option | Default Value | |
| 97 | +| ------------------- | ----------- | |
| 98 | +| --botname, -N | `echo` | |
| 99 | +| --packageName, -p | `echo` | |
| 100 | +| --template, -T | `echo` | |
| 101 | +
|
| 102 | +#### Examples Using --noprompt |
| 103 | +
|
| 104 | +This example shows how to run the generator in --noprompt mode, setting all required options on the command line. |
| 105 | +
|
| 106 | +```bash |
| 107 | +# Run the generator, setting all command line options |
| 108 | +yo botbuilder-java --noprompt -N "MyEchoBot" -P "com.mycompany.bot.echo" -T "echo" |
| 109 | +``` |
| 110 | +
|
| 111 | +This example shows how to run the generator in --noprompt mode, using all the default command line options. The generator will create a bot project using all the default values specified in the **Default Options** table above. |
| 112 | +
|
| 113 | +```bash |
| 114 | +# Run the generator using all default options |
| 115 | +yo botbuilder-java --noprompt |
| 116 | +``` |
29 | 117 |
|
| 118 | +## Logging Issues and Providing Feedback |
30 | 119 |
|
31 | | -[npm-image]: https://badge.fury.io/js/generator-botbuilder-java.svg |
32 | | -[npm-url]: https://npmjs.org/package/generator-botbuilder-java |
33 | | -[travis-image]: https://travis-ci.org/Microsoft/generator-botbuilder-java.svg?branch=master |
34 | | -[travis-url]: https://travis-ci.org/Microsoft/generator-botbuilder-java |
35 | | -[daviddm-image]: https://david-dm.org/Microsoft/generator-botbuilder-java.svg?theme=shields.io |
36 | | -[daviddm-url]: https://david-dm.org/Microsoft/generator-botbuilder-java |
37 | | -[coveralls-image]: https://coveralls.io/repos/Microsoft/generator-botbuilder-java/badge.svg |
38 | | -[coveralls-url]: https://coveralls.io/r/Microsoft/generator-botbuilder-java |
| 120 | +Issues and feedback about the botbuilder generator can be submitted through the project's [GitHub Issues](https://github.com/Microsoft/botbuilder-samples/issues) page. |
0 commit comments