fix(basic.gblib): update ChatServices.ts #420

Closed
eltociear wants to merge 2540 commits from patch-1 into main
2 changed files with 27 additions and 9 deletions
Showing only changes of commit e596f31de6 - Show all commits

View file

@ -557,10 +557,17 @@ export class DialogKeywords {
// throw new Error(`Not possible to define ${name} as it is a reserved system param name.`);
// }
let { min, user, params } = await DialogKeywords.getProcessInfo(pid);
const sec = new SecService();
await sec.setParam(user.userId, name , value);
GBLog.info(`BASIC: ${name} = ${value} (botId: ${min.botId})`);
return { min, user, params };
const sec = new SecService();
if (user)
{
await sec.setParam(user.userId, name , value);
return { min, user, params };
}
else
{
min[name] = value;
}
}
public static async getOption({ pid, name }) {
@ -568,8 +575,15 @@ export class DialogKeywords {
throw new Error(`Not possible to retrieve ${name} system param.`);
}
let { min, user, params } = await DialogKeywords.getProcessInfo(pid);
const sec = new SecService();
return await sec.getParam(user, name);
if (user){
const sec = new SecService();
return await sec.getParam(user, name);
}
else
{
return min[name];
}
}
/**

View file

@ -284,10 +284,14 @@ export class GBSSR {
// Tries to find botId from URL.
const minBoot = GBServer.globals.minBoot;
let botId =
req.originalUrl && req.originalUrl === '/' ?
minBoot.botId :
/\/([A-Za-z0-9\-\_]+)\/*/.exec(req.originalUrl)[1]
let botId = minBoot.botId;
if (req.originalUrl && req.originalUrl === '/') {
let tmp = /\/([A-Za-z0-9\-\_]+)\/*/.exec(req.originalUrl);
if (tmp) {
botId = tmp[1];
}
}
let min: GBMinInstance =
req.url === '/'
? minBoot