Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Create server
let server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log(`${server.name} listening to ${server.url}`);
});
// Create adapter and listen to our servers '/api/messages' route.
const botFrameworkAdapter = new BotFrameworkAdapter({
appId: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_APP_PASSWORD
});
server.post('/api/messages', botFrameworkAdapter.listen());
// Setup bot
const bot = new botbuilder.Bot(botFrameworkAdapter)
.use(new botbuilder.ConsoleLogger())
.use(new botbuilder.MemoryStorage())
.use(new botbuilder.BotStateManager())
.onReceive((context) => {
if (context.request.type === botbuilder.ActivityTypes.message) {
// Check to see if the user said cancel or menu
const utterance = (context.request.text || '').trim();
if (/^cancel/i.test(utterance)) {
endDemo(context);
} else if (/^menu/i.test(utterance)) {
menu(context);
} else {
// Route incoming message to active prompt
return prompts.Prompt.routeTo(context).then((handled) => {
// If no active prompt then start the task
if (!handled) { startDemo(context) }
// init server
let server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log(`${server.name} listing to ${server.url}`);
});
// init adapter
const botFrameworkAdapter = new BotFrameworkAdapter({
appId: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_APP_PASSWORD
});
// bind adapter to messages route
server.post('/api/messages', botFrameworkAdapter.listen());
// init bot
const bot = new botbuilder.Bot(botFrameworkAdapter)
.use(new FileStorage())
.use(new botbuilder.BotStateManager())
.use(new rive.RiveScriptReceiver(path.join(__dirname, "./rive/complex.rive")));
// END OF LINE
const botbuilder_core_1 = require("botbuilder-core");
const botbuilder_node_1 = require("botbuilder-node");
const botbuilder_services_1 = require("botbuilder-services");
const botbuilder_rivescript_1 = require("botbuilder-rivescript");
const restify = require("restify");
const path = require("path");
// Create server
let server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log('%s listening to %s', server.name, server.url);
});
// Create connector
const botFrameworkAdapter = new botbuilder_services_1.BotFrameworkAdapter({ appId: process.env.MICROSOFT_APP_ID, appPassword: process.env.MICROSOFT_APP_PASSWORD });
server.post('/api/messages', botFrameworkAdapter.listen());
// Initialize bot
const bot = new botbuilder_core_1.Bot(botFrameworkAdapter)
.use(new botbuilder_node_1.FileStorage())
.use(new botbuilder_core_1.BotStateManager())
.use(new botbuilder_rivescript_1.RiveScriptReceiver(path.join(__dirname, "../rive/complex.rive")));
// END OF LINE
import 'skeleton-css/css/normalize.css';
import 'skeleton-css/css/skeleton.css';
import './css/alarmBot.css';
import {Bot, ConversationState, MemoryStorage} from 'botbuilder-core';
import {WebChatAdapter} from "./webChatAdapter";
import {ChatComponent} from "./chatComponent";
import {AlarmRenderer} from "./alarmRenderer";
import {routes} from "./routes";
const webChatAdapter = new WebChatAdapter();
const bot = new Bot(webChatAdapter)
.use(new MemoryStorage(),
new BotStateManager(),
new AlarmRenderer());
ChatComponent.bootstrap(webChatAdapter.getMessagePipelineToBot(), document.querySelector('section'));
// handle activities
bot.onReceive((context) => routes(context));
// FOUC
document.addEventListener('DOMContentLoaded', function () {
requestAnimationFrame(() => document.body.style.visibility = 'visible');
});