@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.
@@ -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
- const type = this.classifyActivity(context.activity);
2045
- switch (type) {
2046
- case ActivityType.CurrentBotMessaged:
2047
- // Invoke corresponding command handler for the command response
2048
- const commandText = this.getActivityText(context.activity);
2049
- const message = {
2050
- text: commandText,
2051
- };
2052
- for (const handler of this.commandHandlers) {
2053
- const matchResult = this.shouldTrigger(handler.triggerPatterns, commandText);
2054
- // It is important to note that the command bot will stop processing handlers
2055
- // when the first command handler is matched.
2056
- if (!!matchResult) {
2057
- message.matches = Array.isArray(matchResult) ? matchResult : void 0;
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
- break;
2059
+ }
2060
+ else {
2061
+ const replyActivity = response;
2062
+ if (replyActivity) {
2063
+ yield context.sendActivity(replyActivity);
2064
+ }
2061
2065
  }
2062
2066
  }
2063
- break;
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") {