GameBot
Epic
Gamify working environment with a online Teams board game lobby to tighten up colleagues bonds in unprecedented time.
Stack
- Bot Framework on Teams to support P2P/GroupChat communication.
- LUIS Text Intent Recognition to implement core AI natural language processing capabilities.
- MongoDB as database backend
- NodeJs v12 as node interpreter to start up server process
Architecture
Main Flow Overview
index.js (server hosting)
=> adapter (convert HTTP request into turnContext)
=> bots (application module activity handlers)
=> dialogs (dialogs stack handling using dialogs)
=> steps (steps in waterfall state machine)
=> resolvers (database access layer)
Folder Structure:
- .env: process environment variable will be propagated into process.env. dictionary
- index.js: entrypoint of the application
- bots: bot modules need to be loaded
- config: constants will be used inside the application
- dialogs: conversation handlers
- helpers: miscellaneous functions
- models: database model mapping, like the M in ASP.NET MVC framework
- resolvers: database access layer, operations on data
- static: static resources, like json and images
- tests: unittesting scenarios
Prerequisites
Essential
Optional
Setup Development Environment
- Ensure
nodejs>=12.is installed- Open a shell (cmd/powershell),
node --versionshould returnv12.x.x npm --versionshould return6.x.x
- Open a shell (cmd/powershell),
- Ensure
ngrokis installed.\ngrok.exe --versionshould returnngrok version 2.x.x
- Git Clone this repository
- Resolve the NodeJs package.json dependencies using
npm install - Create a personal Microsoft Teams application for development
- Setup environment
./.envcorrectly
Everyday Development
- Sync the repository by
git pullorgit fetch; git rebase. - Start the bot server with
npm run startor VSCode F5 - After the server starts up, use
ngrok.exe http 3978 -host-header=localhost:3978to expose your local port into public. DO NOT TURN OFF ngrok.exe when restarting NodeJs server. Otherwise, you need to replay step 4. - Change bot message endpoint

LUIS application to enable language understanding
The LUIS model for this example can be found under cognitiveModels/FlightBooking.json and the LUIS language model setup, training, and application configuration steps can be found here.
Once you created the LUIS model, update .env with your LuisAppId, LuisAPIKey and LuisAPIHostName.
LuisAppId="Your LUIS App Id"
LuisAPIKey="Your LUIS Subscription key here"
LuisAPIHostName="Your LUIS App region here (i.e: westus.api.cognitive.microsoft.com)"
Testing the bot using Bot Framework Emulator
Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.
- Install the Bot Framework Emulator version 4.3.0 or greater from here
Connect to the bot using Bot Framework Emulator
- Launch Bot Framework Emulator
- File -> Open Bot
- Enter a Bot URL of
http://localhost:3978/api/messages
Deploy the bot to Azure
To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.



