fix(core.gbapp): BASIC fixed on WhatsApp channel.

This commit is contained in:
Rodrigo Rodriguez 2020-06-05 14:40:21 -03:00
parent c36640e519
commit 1d316ef83b
4 changed files with 13 additions and 9 deletions

View file

@ -349,6 +349,7 @@ export class GBVMService extends GBService {
step.activeDialog.state.options = {};
step.activeDialog.state.options.cbId = (step.options as any).id;
step.activeDialog.state.options.previousResolve = (step.options as any).previousResolve;
GBLog.info('BASIC: Asking for input (HEAR).');
return await min.conversationalService.prompt(min, step, null);
},
async step => {

View file

@ -236,12 +236,12 @@ export class AskDialog extends IGBDialog {
if (answer.content.endsWith('.docx')) {
const mainName = answer.content.replace(/\s|\-/gi, '').split('.')[0];
await GBMinService.callVM(mainName, min, step);
return await GBMinService.callVM(mainName, min, step);
} else {
await service.sendAnswer(min, AskDialog.getChannel(step), step, answer);
}
return await step.replaceDialog('/ask', { isReturning: true });
}
}

View file

@ -431,7 +431,9 @@ export class KBService implements IGBKBService {
});
// MSFT Translator breaks markdown, so we need to fix it:
text = text.replace('! [', '![').replace('] (', '](');
text = text.replace(`[[embed url=`, process.env.BOT_URL + '/').replace(']]', ''); // TODO: Improve it.
const html = marked(text);

View file

@ -427,14 +427,15 @@ export class WhatsappDirectLine extends GBService {
await this.sendToDevice(to, text);
}
public async sendToDevice(to, msg) {
const cmd = '/audio ';
if (msg.startsWith(cmd)) {
msg = msg.substr(cmd.length);
return await this.sendTextAsAudioToDevice(to, msg);
}
else {
} else {
const options = {
method: 'POST',