Skip to content

Commit

Permalink
fix(all): Corrected mobile number to WhatsApp while output md.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Oct 12, 2021
1 parent 95524a9 commit 9257ac7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/basic.gblib/services/DialogKeywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ export class DialogKeywords {
*
*/
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);
}

Expand Down Expand Up @@ -505,7 +507,7 @@ export class DialogKeywords {
}

await this.min.conversationalService['playMarkdown'](this.min, md,
DialogKeywords.getChannel(step), step);
DialogKeywords.getChannel(step), step, mobile);
} else {
GBLog.info(`BASIC: Sending the file ${filename} to mobile ${mobile}.`);
const url = urlJoin(
Expand Down
6 changes: 2 additions & 4 deletions packages/core.gbapp/services/GBConversationalService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ export class GBConversationalService {
min: GBMinInstance,
answer: string,
channel: string,
step: GBDialogStep
step: GBDialogStep,
mobile: string
) {
const user = await min.userProfile.get(step.context, {});

Expand Down Expand Up @@ -420,12 +421,9 @@ export class GBConversationalService {
// 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.
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) {
await this.sendMarkdownToMobile(min, step, mobile, text);
Expand Down

0 comments on commit 9257ac7

Please sign in to comment.