@microsoft/teamsfx 0.7.1-beta.15e156d38.0 → 0.7.1-beta.65870165d.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm2017.mjs +21 -23
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.node.cjs.js +21 -23
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +4 -4
- package/types/teamsfx.d.ts +2 -1
package/dist/index.esm2017.mjs
CHANGED
|
@@ -1972,35 +1972,33 @@ class CommandResponseMiddleware {
|
|
|
1972
1972
|
}
|
|
1973
1973
|
}
|
|
1974
1974
|
async onTurn(context, next) {
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
const response = await handler.handleCommandReceived(context, message);
|
|
1975
|
+
if (context.activity.type === ActivityTypes.Message) {
|
|
1976
|
+
// Invoke corresponding command handler for the command response
|
|
1977
|
+
const commandText = this.getActivityText(context.activity);
|
|
1978
|
+
const message = {
|
|
1979
|
+
text: commandText,
|
|
1980
|
+
};
|
|
1981
|
+
for (const handler of this.commandHandlers) {
|
|
1982
|
+
const matchResult = this.shouldTrigger(handler.triggerPatterns, commandText);
|
|
1983
|
+
// It is important to note that the command bot will stop processing handlers
|
|
1984
|
+
// when the first command handler is matched.
|
|
1985
|
+
if (!!matchResult) {
|
|
1986
|
+
message.matches = Array.isArray(matchResult) ? matchResult : void 0;
|
|
1987
|
+
const response = await handler.handleCommandReceived(context, message);
|
|
1988
|
+
if (typeof response === "string") {
|
|
1990
1989
|
await context.sendActivity(response);
|
|
1991
|
-
|
|
1990
|
+
}
|
|
1991
|
+
else {
|
|
1992
|
+
const replyActivity = response;
|
|
1993
|
+
if (replyActivity) {
|
|
1994
|
+
await context.sendActivity(replyActivity);
|
|
1995
|
+
}
|
|
1992
1996
|
}
|
|
1993
1997
|
}
|
|
1994
|
-
|
|
1998
|
+
}
|
|
1995
1999
|
}
|
|
1996
2000
|
await next();
|
|
1997
2001
|
}
|
|
1998
|
-
classifyActivity(activity) {
|
|
1999
|
-
if (activity.type === ActivityTypes.Message) {
|
|
2000
|
-
return ActivityType.CurrentBotMessaged;
|
|
2001
|
-
}
|
|
2002
|
-
return ActivityType.Unknown;
|
|
2003
|
-
}
|
|
2004
2002
|
matchPattern(pattern, text) {
|
|
2005
2003
|
if (text) {
|
|
2006
2004
|
if (typeof pattern === "string") {
|