fix(core.gbapp): #372 fix.

This commit is contained in:
Rodrigo Rodriguez 2023-09-29 15:55:35 -03:00
parent 49d47f6e6c
commit dfd6981907
2 changed files with 33 additions and 31 deletions

View file

@ -1230,7 +1230,7 @@ export class DialogKeywords {
GBLog.info(`BASIC: Markdown file ${filename} not found on database for ${min.instance.botId}.`);
}
await min.conversationalService['playMarkdown'](min, md, DialogKeywords.getChannel(), mobile);
await min.conversationalService['playMarkdown'](min, md, DialogKeywords.getChannel(), null, mobile);
} else {
const gbaiName = DialogKeywords.getGBAIPath(min.botId, `gbkb`);

View file

@ -311,7 +311,7 @@ export class GBConversationalService {
caption: string,
channel: string
): Promise<any> {
return await this.sendFile(min, step, mobile, url , caption);
return await this.sendFile(min, step, mobile, url, caption);
}
public async sendFile(
@ -462,7 +462,7 @@ export class GBConversationalService {
return new Promise<string>(async (resolve, reject) => {
try {
const oggFile = new Readable();
oggFile._read = () => {}; // _read is required but you can noop it
oggFile._read = () => { }; // _read is required but you can noop it
oggFile.push(buffer);
oggFile.push(null);
@ -526,9 +526,11 @@ export class GBConversationalService {
});
}
public async playMarkdown(min: GBMinInstance, answer: string, channel: string, step: GBDialogStep, mobile: string) {
public async playMarkdown(min: GBMinInstance, answer: string, channel: string,
step: GBDialogStep, mobile: string) {
const sec = new SecService();
const user = await sec.getUserFromSystemId(mobile?mobile:step.context.activity.from.id);
const user = await sec.getUserFromSystemId(mobile ? mobile : step.context.activity.from.id);
let text = answer;
@ -996,7 +998,7 @@ export class GBConversationalService {
}
}
public static async handleText (min, user, step, text: string){
public static async handleText(min, user, step, text: string) {
const sec = new SecService();
text = text.replace(/<([^>]+?)([^>]*?)>(.*?)<\/\1>/gi, '');
@ -1065,7 +1067,7 @@ export class GBConversationalService {
const groupSpell = group ? await min.core.getParam(
min.instance,
'Group Spell',
false): false;
false) : false;
if (textProcessed !== text && group && groupSpell) {
await min.whatsAppDirectLine.sendToDevice(group, `Spell: ${text}`);
@ -1229,7 +1231,7 @@ export class GBConversationalService {
*/
public async sendOnConversation(min: GBMinInstance, user: GuaribasUser, message: any) {
if (message['buttons'] || message['sections']) {
await min['whatsAppDirectLine'].sendToDevice(user.userSystemId, message, user.conversationReference );
await min['whatsAppDirectLine'].sendToDevice(user.userSystemId, message, user.conversationReference);
} else if (user.conversationReference.startsWith('spaces')) {
await min['googleDirectLine'].sendToDevice(user.userSystemId, null, user.conversationReference, message);
} else {