fix(whatsapp.gblib): Fix in bot switching.
This commit is contained in:
parent
1e8b66f9b4
commit
d7e00a2154
2 changed files with 15 additions and 3 deletions
|
@ -108,6 +108,10 @@ export class GBDeployer implements IGBDeployer {
|
|||
if (min['cacheToken']) {
|
||||
return min['cacheToken'];
|
||||
} else {
|
||||
|
||||
// Get token as root only if the bot does not have
|
||||
// an custom tenant for retrieving packages.
|
||||
|
||||
token = await (min.adminService as any)['acquireElevatedToken']
|
||||
(min.instance.instanceId, min.instance.authenticatorTenant?false:true);
|
||||
|
||||
|
|
|
@ -60,10 +60,18 @@ export class GBImporter {
|
|||
localPath: string,
|
||||
additionalInstance: IGBInstance = null
|
||||
) {
|
||||
const settingsJson = JSON.parse(Fs.readFileSync(urlJoin(localPath, 'settings.json'), 'utf8'));
|
||||
if (botId === undefined) {
|
||||
botId = settingsJson.botId;
|
||||
const file = urlJoin(localPath, 'settings.json');
|
||||
|
||||
let settingsJson = {botId: botId};
|
||||
if (Fs.existsSync(file)){
|
||||
|
||||
settingsJson = JSON.parse(Fs.readFileSync(file, 'utf8'));
|
||||
if (botId === undefined) {
|
||||
botId = settingsJson.botId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let instance: IGBInstance;
|
||||
if (botId === undefined) {
|
||||
botId = GBConfigService.get('BOT_ID');
|
||||
|
|
Loading…
Add table
Reference in a new issue