Prevent onMessage activity calling when command is send in the CommandBot

I have scaffolded the project and want to implement the scenario where user can instruct bot to configure itself for the the current conversation through commands and if no command is sent it should then treat it as query.

I have defined the onMessage handler as follows

import {MessageFactory, TeamsActivityHandler, TurnContext} from "botbuilder";

// An empty teams activity handler.
// You can add your customization code here to extend your bot logic if needed.
export class TeamsBot extends TeamsActivityHandler {
  constructor() {
    super();

    this.onMessage(async (context, next) => {
      const query = TurnContext.removeRecipientMention(context.activity);
      await context.sendActivity(MessageFactory.text(`User Query: ${query}`));
      await next();
    });
  }
}

It logs the command request as well. For example, the template provided HelloWorldCommand class which triggers the function on HelloWorld text, bot builder sdk current.

import {Activity, CardFactory, MessageFactory, TurnContext} from "botbuilder";
import {
  CommandMessage,
  TeamsFxBotCommandHandler,
  TriggerPatterns,
} from "@microsoft/teamsfx";
import {AdaptiveCards} from "@microsoft/adaptivecards-tools";
import helloWorldCard from "./adaptiveCards/helloworldCommand.json";
import {CardData} from "./cardModels";

/**
 * The `HelloWorldCommandHandler` registers a pattern with the `TeamsFxBotCommandHandler` and responds
 * with an Adaptive Card if the user types the `triggerPatterns`.
 */
export class HelloWorldCommandHandler implements TeamsFxBotCommandHandler {
  triggerPatterns: TriggerPatterns = "helloWorld";

  async handleCommandReceived(
    context: TurnContext,
    message: CommandMessage
  ): Promise<string | Partial<Activity> | void> {
    // Render your adaptive card for reply message
    const cardData: CardData = {
      title: "Your Hello World App is Running",
      body: "Congratulations! Your Hello World App is running. Open the documentation below to learn more about how to build applications with the Teams Toolkit.",
    };

    const cardJson = AdaptiveCards.declare(helloWorldCard).render(cardData);
    return MessageFactory.attachment(CardFactory.adaptiveCard(cardJson));
  }
}

teams bot

The onMessage callback only works when the query text doesn’t match command pattern.