@microsoft/teamsfx 0.7.0-rc.1 → 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/README.md +27 -7
- 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.node.cjs.js
CHANGED
|
@@ -2041,36 +2041,34 @@ class CommandResponseMiddleware {
|
|
|
2041
2041
|
}
|
|
2042
2042
|
onTurn(context, next) {
|
|
2043
2043
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
const response = yield handler.handleCommandReceived(context, message);
|
|
2044
|
+
if (context.activity.type === botbuilder.ActivityTypes.Message) {
|
|
2045
|
+
// Invoke corresponding command handler for the command response
|
|
2046
|
+
const commandText = this.getActivityText(context.activity);
|
|
2047
|
+
const message = {
|
|
2048
|
+
text: commandText,
|
|
2049
|
+
};
|
|
2050
|
+
for (const handler of this.commandHandlers) {
|
|
2051
|
+
const matchResult = this.shouldTrigger(handler.triggerPatterns, commandText);
|
|
2052
|
+
// It is important to note that the command bot will stop processing handlers
|
|
2053
|
+
// when the first command handler is matched.
|
|
2054
|
+
if (!!matchResult) {
|
|
2055
|
+
message.matches = Array.isArray(matchResult) ? matchResult : void 0;
|
|
2056
|
+
const response = yield handler.handleCommandReceived(context, message);
|
|
2057
|
+
if (typeof response === "string") {
|
|
2059
2058
|
yield context.sendActivity(response);
|
|
2060
|
-
|
|
2059
|
+
}
|
|
2060
|
+
else {
|
|
2061
|
+
const replyActivity = response;
|
|
2062
|
+
if (replyActivity) {
|
|
2063
|
+
yield context.sendActivity(replyActivity);
|
|
2064
|
+
}
|
|
2061
2065
|
}
|
|
2062
2066
|
}
|
|
2063
|
-
|
|
2067
|
+
}
|
|
2064
2068
|
}
|
|
2065
2069
|
yield next();
|
|
2066
2070
|
});
|
|
2067
2071
|
}
|
|
2068
|
-
classifyActivity(activity) {
|
|
2069
|
-
if (activity.type === botbuilder.ActivityTypes.Message) {
|
|
2070
|
-
return ActivityType.CurrentBotMessaged;
|
|
2071
|
-
}
|
|
2072
|
-
return ActivityType.Unknown;
|
|
2073
|
-
}
|
|
2074
2072
|
matchPattern(pattern, text) {
|
|
2075
2073
|
if (text) {
|
|
2076
2074
|
if (typeof pattern === "string") {
|