Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

botnaut

Package Overview
Dependencies
Maintainers
3
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

botnaut - npm Package Compare versions

Comparing version 0.25.0 to 0.25.1

.idea/botnaut.iml

2

package.json
{
"name": "botnaut",
"version": "0.25.0",
"version": "0.25.1",
"description": "Facebook Messenger Chatbot Framework",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -7,3 +7,3 @@ /*

const { marshalItem } = require('dynamodb-marshaler');
const uuidV1 = require('uuid/v1');
const uuidV1 = require('uuid').v1;

@@ -10,0 +10,0 @@

@@ -8,5 +8,7 @@ /*

constructor (onDone) {
constructor (onDone, isTopLevel = true) {
this.onDone = onDone;
this.callToActions = [];
this.menus = [];
this.callToActions = null;
this.isTopLevel = isTopLevel;
}

@@ -61,10 +63,11 @@

addNested (title) {
return new MenuComposer((actions) => {
const nested = new MenuComposer(([{ call_to_actions }]) => {
this.callToActions.push({
type: 'nested',
title,
call_to_actions: actions
call_to_actions
});
return this;
});
}, false);
return nested.menu();
}

@@ -78,7 +81,29 @@

done () {
return this.onDone(this.callToActions);
return this.onDone(this.menus);
}
/**
* Finish the menu for the locale and starts a new menu
*
* @param {string} [locale]
* @param {boolean} [inputDisabled]
* @returns {MenuComposer}
*/
menu (locale = 'default', inputDisabled = false) {
if (!this.isTopLevel && this.menus.length !== 0) {
throw new Error('Call the .done() on nested menu before new menu creation');
}
this.callToActions = [];
this.menus.push({
locale,
composer_input_disabled: inputDisabled,
call_to_actions: this.callToActions
});
return this;
}
}
module.exports = MenuComposer;

@@ -141,4 +141,4 @@ /*

*
* @param {string} [locale]
* @param {boolean} [inputDisabled]
* @param {string} [locale=default]
* @param {boolean} [inputDisabled=false]
* @returns {MenuComposer}

@@ -151,41 +151,44 @@ * @example

*
* settings.menu()
* .addNested('Nested Menu')
* .addUrl('Go to google', 'https://google.com')
* .done()
* .addPostBack('Do something', '/the/action')
* .done();
* settings
* .menu('fr_FR')
* .addNested('Nested Menu')
* .addUrl('Aller à google', 'https://google.com')
* .done()
* .addPostBack('Faire quelque chose', '/the/action')
* .menu() // the default menu
* .addNested('Nested Menu')
* .addUrl('Go to google', 'https://google.com')
* .done()
* .addPostBack('Do something', '/the/action')
* .done();
*/
menu (locale = 'default', inputDisabled = false) {
return new MenuComposer((actions) => {
this._get(['persistent_menu'])
.then((result) => {
const newMenu = [{
locale,
composer_input_disabled: inputDisabled,
call_to_actions: actions
}];
const composer = new MenuComposer((newMenu) => {
this._get(['persistent_menu']).then((result) => {
let updateMenu;
let updateMenu;
if (result.data.length === 0) {
updateMenu = true;
} else {
const existingMenu = result.data[0].persistent_menu;
updateMenu = !deepEqual(newMenu, existingMenu);
}
if (result.data.length === 0) {
updateMenu = true;
} else {
const existingMenu = result.data[0].persistent_menu;
updateMenu = !deepEqual(newMenu, existingMenu);
}
if (!updateMenu) {
return Promise.resolve();
}
if (!updateMenu) {
return Promise.resolve();
}
return this._post({
persistent_menu: newMenu
});
}).catch(e => this.log.error('Bot settings failed', e));
return this._post({
persistent_menu: newMenu
});
}).catch(e => this.log.error('Bot settings failed', e));
return this;
});
return composer.menu(locale, inputDisabled);
}
}
module.exports = Settings;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc