fix(basic.gblib): Refactoring processInfo into all methods.
This commit is contained in:
parent
5166db205e
commit
50d3fccd0d
2 changed files with 38 additions and 22 deletions
|
@ -1035,15 +1035,31 @@ export class DialogKeywords {
|
|||
}
|
||||
}
|
||||
|
||||
public async getProcessInfo(pid: number) {
|
||||
const proc = GBServer.globals.processes[pid];
|
||||
|
||||
const min = GBServer.globals.minInstances.filter(p =>
|
||||
p.instance.instanceId == proc.instanceId)[0];
|
||||
const sec = new SecService();
|
||||
const user = await sec.getUserFromId(min.instance.instanceId, proc.userId);
|
||||
return {
|
||||
min, user
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Talks to the user by using the specified text.
|
||||
*/
|
||||
public async talk({ pid, text }) {
|
||||
GBLog.info(`BASIC: TALK '${text}'.`);
|
||||
if (this.user) {
|
||||
const translate = this.user ? this.user.basicOptions.translatorOn : false;
|
||||
const {
|
||||
min, user
|
||||
} = await this.getProcessInfo(pid);
|
||||
if (user) {
|
||||
// TODO: const translate = this.user ? this.user.basicOptions.translatorOn : false;
|
||||
|
||||
await this.min.conversationalService['sendOnConversation'](this.min, this.user.systemUser, text);
|
||||
await min.conversationalService['sendOnConversation'](min, user, text);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,11 +104,11 @@ export class GBDeployer implements IGBDeployer {
|
|||
* Retrives token and initialize drive client API.
|
||||
*/
|
||||
public static async internalGetDriveClient (min: GBMinInstance) {
|
||||
let token = await min.adminService.acquireElevatedToken(min.instance.instanceId);
|
||||
let siteId = process.env.STORAGE_SITE_ID;
|
||||
let libraryId = process.env.STORAGE_LIBRARY;
|
||||
const token = await min.adminService.acquireElevatedToken(min.instance.instanceId);
|
||||
const siteId = process.env.STORAGE_SITE_ID;
|
||||
const libraryId = process.env.STORAGE_LIBRARY;
|
||||
|
||||
let client = MicrosoftGraph.Client.init({
|
||||
const client = MicrosoftGraph.Client.init({
|
||||
authProvider: done => {
|
||||
done(null, token);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue