Skip to content
Merged

X #8

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions step-1/botpress-platform-webchat.config.yml

This file was deleted.

11 changes: 11 additions & 0 deletions step-1/channel-web.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
/************
Optional settings
*************/

"uploadsUseS3": false,
"uploadsS3Bucket": "bucket-name",
"uploadsS3Region": "eu-west-1",
"uploadsS3AWSAccessKey": "your-aws-key-name",
"uploadsS3AWSAccessSecret": "secret-key"
}
6 changes: 3 additions & 3 deletions step-1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"description": "Botpress tutorial",
"main": "src/index.js",
"engines": {
"node": ">= 6.1 <= 8.9"
"node": ">= 6.1 < 9.0"
},
"dependencies": {
"botpress": "^10.0.1",
"botpress-platform-webchat": "^0.5.0",
"@botpress/channel-web": "^10.11.1",
"botpress": "^10.11.1",
"jsdoc-api": "^4.0.2",
"lodash": "^4.17.5",
"moment": "^2.20.1"
Expand Down
12 changes: 6 additions & 6 deletions step-1/src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
return {
...state, // we clone the existing state
count: 0, // we then reset the number of questions asked to `0`
score: 0, // and we reset the score to `0`
score: 0 // and we reset the score to `0`
}
},

Expand Down Expand Up @@ -34,14 +34,14 @@ module.exports = {
},

validateAnswer: (state, event) => {
const isCorrect = event.text === state.goodAnswer.text
return { ...state, isCorrect: isCorrect, score: isCorrect ? state.score + 1 : state.score }
const isCorrect = state.goodAnswer && event.text === state.goodAnswer.text
return { ...state, isCorrect, score: isCorrect ? state.score + 1 : state.score }
},

/**
* @param {string} args.name - Name of the tag.
* @param {string} args.value - Value of the tag.
*/
* @param {string} args.name - Name of the tag.
* @param {string} args.value - Value of the tag.
*/
setUserTag: async (state, event, { name, value }) => {
await event.bp.users.tag(event.user.id, name, value)
return { ...state }
Expand Down
2 changes: 1 addition & 1 deletion step-1/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = bp => {
})

jsdoc.explain({ files: [__dirname + '/actions.js'] }).then(docs => {
bp.dialogEngine.setFunctionMetadataProvider(fnName => {
bp.dialogEngine.registerActionMetadataProvider(fnName => {
const meta = docs.find(({ name }) => name === fnName)
return {
desciption: meta.description,
Expand Down
Loading