prg-chatbot
Advanced tools
Comparing version 0.10.1 to 0.10.2
{ | ||
"name": "prg-chatbot", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"description": "Facebook Messenger Chatbot Framework", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -159,3 +159,3 @@ /* | ||
} else { | ||
this.options.log.warn('Bot received bad message', message); | ||
this.options.log.warn('Bot received bad message', { message, pageId }); | ||
return Promise.resolve(null); | ||
@@ -176,3 +176,3 @@ } | ||
return this._loadState(isRef, senderId, pageId) | ||
return this._loadState(isRef, senderId) | ||
.then(stateObject => | ||
@@ -222,9 +222,13 @@ this._ensureUserProfileLoaded(isRef, senderId, pageId, stateObject)) | ||
if (!refHandler.called) { | ||
throw new Error('Call any send method, when optin is received!'); | ||
this.options.log.warn('No text message was sent, when optin arrived!', { message, pageId }); | ||
return null; | ||
} | ||
return refHandler.promise() | ||
.then(recipientId => this._loadState(false, recipientId, pageId)); | ||
.then(recipientId => this._loadState(false, recipientId)); | ||
}) | ||
.then((stateObject) => { | ||
if (!stateObject) { | ||
return null; | ||
} | ||
Object.assign(stateObject, { | ||
@@ -288,3 +292,3 @@ state, | ||
_loadState (isRef, senderId, pageId) { | ||
_loadState (isRef, senderId) { | ||
if (isRef) { | ||
@@ -306,3 +310,3 @@ return Promise.resolve({ | ||
this._model(senderId, pageId) | ||
this._model(senderId) | ||
.then(onLoad) | ||
@@ -323,5 +327,5 @@ .catch(reject); | ||
_model (senderId, pageId) { | ||
_model (senderId) { | ||
const { timeout, defaultState } = this.options; | ||
return this.stateStorage.getOrCreateAndLock(senderId, defaultState, timeout, pageId) | ||
return this.stateStorage.getOrCreateAndLock(senderId, defaultState, timeout) | ||
.catch((err) => { | ||
@@ -328,0 +332,0 @@ if (!err || err.code !== 11000) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
140694
3038