From 2713a120ac9c55e697b77e0959c86b98269560f0 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Tue, 9 Jan 2024 17:18:26 -0300 Subject: [PATCH] fix(basic.gblib): Fixes #395 talk with no quotes. --- packages/basic.gblib/services/DialogKeywords.ts | 3 +-- .../basic.gblib/services/KeywordsExpressions.ts | 14 ++++++++------ packages/basic.gblib/services/SystemKeywords.ts | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/basic.gblib/services/DialogKeywords.ts b/packages/basic.gblib/services/DialogKeywords.ts index 3abcdf54..47cfc6d6 100644 --- a/packages/basic.gblib/services/DialogKeywords.ts +++ b/packages/basic.gblib/services/DialogKeywords.ts @@ -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'; diff --git a/packages/basic.gblib/services/KeywordsExpressions.ts b/packages/basic.gblib/services/KeywordsExpressions.ts index 344b382f..b5253f77 100644 --- a/packages/basic.gblib/services/KeywordsExpressions.ts +++ b/packages/basic.gblib/services/KeywordsExpressions.ts @@ -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}})`; } ]; diff --git a/packages/basic.gblib/services/SystemKeywords.ts b/packages/basic.gblib/services/SystemKeywords.ts index 8839b834..d7560dbe 100644 --- a/packages/basic.gblib/services/SystemKeywords.ts +++ b/packages/basic.gblib/services/SystemKeywords.ts @@ -1,3 +1,4 @@ + /*****************************************************************************\ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |