fix(basic.gblib): Fixes #395 talk with no quotes.

This commit is contained in:
Rodrigo Rodriguez 2024-01-09 17:18:26 -03:00
parent 02d9411671
commit 2713a120ac
3 changed files with 10 additions and 8 deletions

View file

@ -32,7 +32,7 @@
'use strict';
import { GBError, GBLog, GBMinInstance } from 'botlib';
import { GBLog } from 'botlib';
import { GBConfigService } from '../../core.gbapp/services/GBConfigService.js';
import { ChartServices } from './ChartServices.js';
import urlJoin from 'url-join';
@ -40,7 +40,6 @@ import { GBServer } from '../../../src/app.js';
import { GBDeployer } from '../../core.gbapp/services/GBDeployer.js';
import { SecService } from '../../security.gbapp/services/SecService.js';
import { SystemKeywords } from './SystemKeywords.js';
import * as wpp from 'whatsapp-web.js';
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService.js';
import { Messages } from '../strings.js';
import * as Fs from 'fs';

View file

@ -348,7 +348,8 @@ export class KeywordsExpressions {
__pageMode = __data?.pageMode ? __data.pageMode : "none";
__url = __data?.links?.next?.uri;
__seekToken = __data?.links?.self?.headers["MS-ContinuationToken"]
__seekToken = __data?.links?.self?.headers["
"]
__totalCount = __data?.totalCount ? __data.totalCount : __data.length;
while (__next && __totalCount)
@ -951,14 +952,15 @@ export class KeywordsExpressions {
keywords[i++] = [
/^\s*(talk)(\s*)(.*)/gim,
($0, $1, $2, $3) => {
// Issue: #395
// $3 = GBVMService.normalizeQuotes($3);
$3 = GBVMService.normalizeQuotes($3);
// // Uses auto quote if this is a phrase with more then one word.
// if (/\s/.test($3) && $3.substr(0, 1) !== '`') {
// $3 = "`" + $3 + "`";
// }
if (/\s/.test($3) &&
($3.trim().substr(0, 1) !== '`' || $3.trim().substr(0, 1) !== "'")) {
$3 = "`" + $3 + "`";
}
return `await dk.talk ({pid: pid, text: ${$3}})`;
}
];

View file

@ -1,3 +1,4 @@
/*****************************************************************************\
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |