fix(core.gbapp): #372 fix.
This commit is contained in:
parent
49d47f6e6c
commit
dfd6981907
2 changed files with 33 additions and 31 deletions
|
@ -1230,7 +1230,7 @@ export class DialogKeywords {
|
||||||
GBLog.info(`BASIC: Markdown file ${filename} not found on database for ${min.instance.botId}.`);
|
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 {
|
} else {
|
||||||
const gbaiName = DialogKeywords.getGBAIPath(min.botId, `gbkb`);
|
const gbaiName = DialogKeywords.getGBAIPath(min.botId, `gbkb`);
|
||||||
|
|
||||||
|
|
|
@ -311,7 +311,7 @@ export class GBConversationalService {
|
||||||
caption: string,
|
caption: string,
|
||||||
channel: string
|
channel: string
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return await this.sendFile(min, step, mobile, url , caption);
|
return await this.sendFile(min, step, mobile, url, caption);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async sendFile(
|
public async sendFile(
|
||||||
|
@ -462,7 +462,7 @@ export class GBConversationalService {
|
||||||
return new Promise<string>(async (resolve, reject) => {
|
return new Promise<string>(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
const oggFile = new Readable();
|
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(buffer);
|
||||||
oggFile.push(null);
|
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 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;
|
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();
|
const sec = new SecService();
|
||||||
|
|
||||||
text = text.replace(/<([^>]+?)([^>]*?)>(.*?)<\/\1>/gi, '');
|
text = text.replace(/<([^>]+?)([^>]*?)>(.*?)<\/\1>/gi, '');
|
||||||
|
@ -1065,7 +1067,7 @@ export class GBConversationalService {
|
||||||
const groupSpell = group ? await min.core.getParam(
|
const groupSpell = group ? await min.core.getParam(
|
||||||
min.instance,
|
min.instance,
|
||||||
'Group Spell',
|
'Group Spell',
|
||||||
false): false;
|
false) : false;
|
||||||
|
|
||||||
if (textProcessed !== text && group && groupSpell) {
|
if (textProcessed !== text && group && groupSpell) {
|
||||||
await min.whatsAppDirectLine.sendToDevice(group, `Spell: ${text}`);
|
await min.whatsAppDirectLine.sendToDevice(group, `Spell: ${text}`);
|
||||||
|
@ -1229,7 +1231,7 @@ export class GBConversationalService {
|
||||||
*/
|
*/
|
||||||
public async sendOnConversation(min: GBMinInstance, user: GuaribasUser, message: any) {
|
public async sendOnConversation(min: GBMinInstance, user: GuaribasUser, message: any) {
|
||||||
if (message['buttons'] || message['sections']) {
|
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')) {
|
} else if (user.conversationReference.startsWith('spaces')) {
|
||||||
await min['googleDirectLine'].sendToDevice(user.userSystemId, null, user.conversationReference, message);
|
await min['googleDirectLine'].sendToDevice(user.userSystemId, null, user.conversationReference, message);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue