fix(basic.gblib): SSR error.

This commit is contained in:
Rodrigo Rodriguez 2023-10-30 13:44:52 -03:00
parent afdb3c86b1
commit bfcaf84188
2 changed files with 7 additions and 11 deletions

View file

@ -800,6 +800,7 @@ export class DialogKeywords {
*
*/
public async hear({ pid, kind, args }) {
let { min, user, params } = await DialogKeywords.getProcessInfo(pid);
// Handles first arg as an array of args.
@ -955,7 +956,7 @@ export class DialogKeywords {
return await this.hear({ pid, kind, args });
}
result = value;
result = answer;
} else if (kind === 'name') {
const extractEntity = text => {
return text.match(/[_a-zA-Z][_a-zA-Z0-9]{0,30}/gi);
@ -968,7 +969,7 @@ export class DialogKeywords {
return await this.hear({ pid, kind, args });
}
result = value;
result = answer;
} else if (kind === 'integer') {
const extractEntity = text => {
return text.match(/\d+/gi);
@ -981,13 +982,8 @@ export class DialogKeywords {
return await this.hear({ pid, kind, args });
}
result = value;
result = answer;
} else if (kind === 'date') {
const extractEntity = text => {
return text.match(
/(^(((0[1-9]|1[0-9]|2[0-8])[\/](0[1-9]|1[012]))|((29|30|31)[\/](0[13578]|1[02]))|((29|30)[\/](0[4,6,9]|11)))[\/](19|[2-9][0-9])\d\d$)|(^29[\/]02[\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)/gi
);
};
const parseDate = str => {
function pad(x) {
@ -1020,7 +1016,7 @@ export class DialogKeywords {
return await this.hear({ pid, kind, args });
}
result = value;
result = answer;
} else if (kind === 'money') {
const extractEntity = (text: string) => {
// https://github.com/GeneralBots/BotServer/issues/307
@ -1084,7 +1080,7 @@ export class DialogKeywords {
return await this.hear({ pid, kind, args });
}
result = value[0];
result = answer;
} else if (kind === 'menu') {
const list = args;
result = null;

View file

@ -320,7 +320,7 @@ export class GBSSR {
let parts = req.url.replace(`/${botId}`, '').split('?');
let url = parts[0];
if (min && req.originalUrl && prerender && exclude) {
if (min && req.originalUrl && prerender && exclude && Fs.existsSync(path)) {
// Reads from static HTML when a bot is crawling.