fix(all): Corrected mobile number to WhatsApp while output md.

This commit is contained in:
Rodrigo Rodriguez 2021-10-12 16:13:47 -03:00
parent 95524a902c
commit 9257ac7271
2 changed files with 5 additions and 5 deletions

View file

@ -315,6 +315,8 @@ export class DialogKeywords {
* *
*/ */
public async sendFile(step, filename, caption) { public async sendFile(step, filename, caption) {
const mobile = this.userMobile(step);
GBLog.info(`BASIC: SEND FILE (current: ${mobile}', filename '${filename}'.`);
return await this.internalSendFile(step, null, filename, caption); return await this.internalSendFile(step, null, filename, caption);
} }
@ -505,7 +507,7 @@ export class DialogKeywords {
} }
await this.min.conversationalService['playMarkdown'](this.min, md, await this.min.conversationalService['playMarkdown'](this.min, md,
DialogKeywords.getChannel(step), step); DialogKeywords.getChannel(step), step, mobile);
} else { } else {
GBLog.info(`BASIC: Sending the file ${filename} to mobile ${mobile}.`); GBLog.info(`BASIC: Sending the file ${filename} to mobile ${mobile}.`);
const url = urlJoin( const url = urlJoin(

View file

@ -373,7 +373,8 @@ export class GBConversationalService {
min: GBMinInstance, min: GBMinInstance,
answer: string, answer: string,
channel: string, channel: string,
step: GBDialogStep step: GBDialogStep,
mobile: string
) { ) {
const user = await min.userProfile.get(step.context, {}); const user = await min.userProfile.get(step.context, {});
@ -420,12 +421,9 @@ export class GBConversationalService {
// MSFT Translator breaks markdown, so we need to fix it: // MSFT Translator breaks markdown, so we need to fix it:
text = text.replace('! [', '![').replace('] (', ']('); text = text.replace('! [', '![').replace('] (', '](');
text = text.replace(`[[embed url=`, process.env.BOT_URL + '/').replace(']]', ''); // TODO: Improve it. text = text.replace(`[[embed url=`, process.env.BOT_URL + '/').replace(']]', ''); // TODO: Improve it.
text = text.replace(`](kb`, "](" + process.env.BOT_URL + '/kb'); // TODO: Improve it. text = text.replace(`](kb`, "](" + process.env.BOT_URL + '/kb'); // TODO: Improve it.
// According to the channel, formats the output optimized to it.
const mobile = this.userMobile(step);
if (mobile) { if (mobile) {
await this.sendMarkdownToMobile(min, step, mobile, text); await this.sendMarkdownToMobile(min, step, mobile, text);