If I have not provide enough information, please do reply.
First I have added the code which is not executing properly which is using axios to get data from the api, after that at last I have added the same code which is working fine which uses request to get data from the api.
My goal is to make my code look cleaner by using axios
controller.addDialog(testFileUpload);
}
`
When this code is exeuted let's say first addFile is exucuted by user command main.js was the entry point which is normal.
But the problem arise when a user wants to change conversation from addFile to testFileUpload by typing the command
only the question is executed which is present in testFileUpload.ask(Waiting for a file) but the body never executes even when a user uploads the file or enter any commands using keyboard instead conversation ends without the execution of the body and the code in main.js file executes when the code inside conversation body was supposed to execute.
Below I have added the code which is working fine but the code is very bulky.
This code is working fine. When a user want to change conversation from addFile to testFileUpload and vice versa, every code executes fine without any problem
features/main.js
`
var request = require('request');
If I have not provide enough information, please do reply. First I have added the code which is not executing properly which is using axios to get data from the api, after that at last I have added the same code which is working fine which uses request to get data from the api.
My goal is to make my code look cleaner by using axios
helpers/apicall.js file ` const axios = require("axios");
module.exports = { checkContext: async(data) => {
} }
features/main.js file
const apiCall = require('../helpers/apicall');module.exports = function (controller) { controller.on('message,direct_message', async (bot, message) => { console.log('i heard something')
}
features/functions.js file
module.exports = function(controller) { const addFile = new BotkitConversation('addFile', controller);
addFile.ask('Please upload your file.', async (answer, addfile, bot, message) => {
}, { key: 'cccapation' });
controller.addDialog(addFile);
const testFileUpload = new BotkitConversation('testFileUpload', controller);
testFileUpload.ask('Waiting for a file', async (answer, convo, bot, message) => { try{
}, { key: 'qna' });
controller.addDialog(testFileUpload); } ` When this code is exeuted let's say first addFile is exucuted by user command main.js was the entry point which is normal. But the problem arise when a user wants to change conversation from addFile to testFileUpload by typing the command only the question is executed which is present in testFileUpload.ask(Waiting for a file) but the body never executes even when a user uploads the file or enter any commands using keyboard instead conversation ends without the execution of the body and the code in main.js file executes when the code inside conversation body was supposed to execute.
Below I have added the code which is working fine but the code is very bulky. This code is working fine. When a user want to change conversation from addFile to testFileUpload and vice versa, every code executes fine without any problem features/main.js ` var request = require('request');
module.exports = function (controller) { controller.on('message,direct_message', async (bot, message) => { console.log('i heard something')
} `
features/functions.js
` module.exports = function(controller) { const addFile = new BotkitConversation('addFile', controller);
addFile.ask('Please upload your file.', async (answer, addFile, bot, message) => {
}, { key: 'cccapation' });
controller.addDialog(addFile);
const testFileUpload = new BotkitConversation('testFileUpload', controller);
testFileUpload.ask('Waiting for a file', async (answer, convo, bot, message) => { try{ convo.setVar('testname', '')
}, { key: 'qna' }); } `