fix(kb.gbapp): Fix importing packages.
This commit is contained in:
parent
67c3495f80
commit
4ecc78e298
3 changed files with 28 additions and 20 deletions
|
@ -1059,7 +1059,13 @@ export class GBConversationalService {
|
||||||
// If it is a group, spells and sends them back.
|
// If it is a group, spells and sends them back.
|
||||||
|
|
||||||
const group = step.context.activity['group'];
|
const group = step.context.activity['group'];
|
||||||
if (textProcessed !== text && group) {
|
|
||||||
|
const groupSpell = group ? await min.core.getParam(
|
||||||
|
min.instance,
|
||||||
|
'Group Spell',
|
||||||
|
false): false;
|
||||||
|
|
||||||
|
if (textProcessed !== text && group && groupSpell) {
|
||||||
await min.whatsAppDirectLine.sendToDevice(group, `Spell: ${text}`);
|
await min.whatsAppDirectLine.sendToDevice(group, `Spell: ${text}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -683,13 +683,13 @@ ENDPOINT_UPDATE=true
|
||||||
value = params ? params[name] : defaultValue;
|
value = params ? params[name] : defaultValue;
|
||||||
}
|
}
|
||||||
if (typeof defaultValue === 'boolean') {
|
if (typeof defaultValue === 'boolean') {
|
||||||
return new Boolean(value ? value.toString().toLowerCase() === 'true' : defaultValue);
|
return new Boolean(value ? value.toString().toLowerCase() === 'true' : defaultValue).valueOf();
|
||||||
}
|
}
|
||||||
if (typeof defaultValue === 'string') {
|
if (typeof defaultValue === 'string') {
|
||||||
return value ? value : defaultValue;
|
return value ? value : defaultValue;
|
||||||
}
|
}
|
||||||
if (typeof defaultValue === 'number') {
|
if (typeof defaultValue === 'number') {
|
||||||
return new Number(value ? value : defaultValue ? defaultValue : 0);
|
return new Number(value ? value : defaultValue ? defaultValue : 0).valueOf();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instance['dataValues'] && !value) {
|
if (instance['dataValues'] && !value) {
|
||||||
|
|
|
@ -419,10 +419,12 @@ export class WhatsappDirectLine extends GBService {
|
||||||
// Bot name must be specified on config.
|
// Bot name must be specified on config.
|
||||||
|
|
||||||
if (botGroupID === group) {
|
if (botGroupID === group) {
|
||||||
|
|
||||||
// Shortcut has been mentioned?
|
// Shortcut has been mentioned?
|
||||||
|
|
||||||
let found = false;
|
let found = false;
|
||||||
parts.forEach(e1 => {
|
parts.forEach(e1 => {
|
||||||
|
|
||||||
botShortcuts.forEach(e2 => {
|
botShortcuts.forEach(e2 => {
|
||||||
if (e1 === e2 && !found) {
|
if (e1 === e2 && !found) {
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -443,17 +445,18 @@ export class WhatsappDirectLine extends GBService {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Ignore group messages without the mention to Bot.
|
// Ignore group messages without the mention to Bot.
|
||||||
|
|
||||||
let smsServiceNumber = this.min.core.getParam<string>(this.min.instance, 'whatsappServiceNumber', null);
|
let botNumber = this.min.core.getParam<string>(this.min.instance, 'Bot Number', null);
|
||||||
if (smsServiceNumber && !answerText) {
|
if (botNumber && !answerText && !found) {
|
||||||
smsServiceNumber = smsServiceNumber.replace('+', '');
|
botNumber = botNumber.replace('+', '');
|
||||||
if (!message.body.startsWith('@' + smsServiceNumber)) {
|
if (!message.body.startsWith('@' + botNumber)) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -691,8 +694,7 @@ export class WhatsappDirectLine extends GBService {
|
||||||
await this.printMessages(response.obj.activities, conversationId, from, fromName);
|
await this.printMessages(response.obj.activities, conversationId, from, fromName);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
GBLog.error(
|
GBLog.error(
|
||||||
`Error calling printMessages on Whatsapp channel ${err.data === undefined ? err : err.data} ${
|
`Error calling printMessages on Whatsapp channel ${err.data === undefined ? err : err.data} ${err.errObj ? err.errObj.message : ''
|
||||||
err.errObj ? err.errObj.message : ''
|
|
||||||
}`
|
}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue