fix(basic.gblib): Goto dialog within web.
This commit is contained in:
parent
1bf3176d59
commit
43a3d58cb5
5 changed files with 31 additions and 13 deletions
|
@ -450,6 +450,25 @@ export class DialogKeywords {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares the next dialog to be shown to the specified user.
|
||||||
|
*/
|
||||||
|
public async gotoDialog(step, fromOrDialogName: string, dialogName: string) {
|
||||||
|
if (dialogName) {
|
||||||
|
let sec = new SecService();
|
||||||
|
let user = await sec.getUserFromSystemId(fromOrDialogName);
|
||||||
|
if (!user) {
|
||||||
|
user = await sec.ensureUser(this.min.instance.instanceId, fromOrDialogName,
|
||||||
|
fromOrDialogName, null, 'whatsapp', 'from', null);
|
||||||
|
}
|
||||||
|
await sec.updateUserHearOnDialog(user.userId, dialogName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await step.beginDialog(dialogName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Talks to the user by using the specified text.
|
* Talks to the user by using the specified text.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -242,7 +242,7 @@ export class GBVMService extends GBService {
|
||||||
});
|
});
|
||||||
|
|
||||||
code = code.replace(/(go to)(\s)(.*)/gi, ($0, $1, $2, $3) => {
|
code = code.replace(/(go to)(\s)(.*)/gi, ($0, $1, $2, $3) => {
|
||||||
return `sys().gotoDialog(${$3})\n`;
|
return `sys().gotoDialog(step, ${$3})\n`;
|
||||||
});
|
});
|
||||||
|
|
||||||
code = code.replace(/(hear)\s*(\w+)/gi, ($0, $1, $2) => {
|
code = code.replace(/(hear)\s*(\w+)/gi, ($0, $1, $2) => {
|
||||||
|
|
|
@ -144,17 +144,6 @@ export class SystemKeywords {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Prepares the next dialog to be shown to the specified user.
|
|
||||||
*/
|
|
||||||
public async gotoDialog(from: string, dialogName: string) {
|
|
||||||
let sec = new SecService();
|
|
||||||
let user = await sec.getUserFromSystemId(from);
|
|
||||||
if (!user) {
|
|
||||||
user = await sec.ensureUser(this.min.instance.instanceId, from, from, null, 'whatsapp', 'from', null);
|
|
||||||
}
|
|
||||||
await sec.updateUserHearOnDialog(user.userId, dialogName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds script execution for the number of seconds specified.
|
* Holds script execution for the number of seconds specified.
|
||||||
|
|
|
@ -444,6 +444,10 @@ export class GBDeployer implements IGBDeployer {
|
||||||
*/
|
*/
|
||||||
public async downloadFolder(min: GBMinInstance, localPath: string, remotePath: string,
|
public async downloadFolder(min: GBMinInstance, localPath: string, remotePath: string,
|
||||||
baseUrl: string = null, client = null): Promise<any> {
|
baseUrl: string = null, client = null): Promise<any> {
|
||||||
|
|
||||||
|
|
||||||
|
GBLog.info(`downloadFolder: localPath=${localPath}, remotePath=${remotePath}, baseUrl=${baseUrl}`);
|
||||||
|
|
||||||
if (!baseUrl) {
|
if (!baseUrl) {
|
||||||
[baseUrl, client] = await GBDeployer.internalGetDriveClient(min);
|
[baseUrl, client] = await GBDeployer.internalGetDriveClient(min);
|
||||||
|
|
||||||
|
@ -469,6 +473,8 @@ export class GBDeployer implements IGBDeployer {
|
||||||
const botId = min.instance.botId;
|
const botId = min.instance.botId;
|
||||||
const path = urlJoin(`/${botId}.gbai`, remotePath);
|
const path = urlJoin(`/${botId}.gbai`, remotePath);
|
||||||
let url = `${baseUrl}/drive/root:${path}:/children`;
|
let url = `${baseUrl}/drive/root:${path}:/children`;
|
||||||
|
|
||||||
|
GBLog.info(`Download URL: ${url}`);
|
||||||
|
|
||||||
const res = await client
|
const res = await client
|
||||||
.api(url)
|
.api(url)
|
||||||
|
|
|
@ -894,7 +894,11 @@ export class GBMinService {
|
||||||
// Skips if the bot is talking.
|
// Skips if the bot is talking.
|
||||||
const startDialog = min.core.getParam(min.instance, 'Start Dialog', null);
|
const startDialog = min.core.getParam(min.instance, 'Start Dialog', null);
|
||||||
|
|
||||||
if (context.activity.type === 'conversationUpdate' &&
|
if (context.activity.type === 'conversationUpdate')
|
||||||
|
{
|
||||||
|
GBLog.info(`Bot installed on Teams.`);
|
||||||
|
}
|
||||||
|
else if (context.activity.type === 'conversationUpdate' &&
|
||||||
context.activity.membersAdded.length > 0) {
|
context.activity.membersAdded.length > 0) {
|
||||||
|
|
||||||
// Check if a bot or a human participant is being added to the conversation.
|
// Check if a bot or a human participant is being added to the conversation.
|
||||||
|
|
Loading…
Add table
Reference in a new issue