diff --git a/.github/workflows/cd-dev-botnorrea-v2-telegram.yml b/.github/workflows/cd-dev-botnorrea-v2-telegram.yml index b9e9483..0c3cc34 100644 --- a/.github/workflows/cd-dev-botnorrea-v2-telegram.yml +++ b/.github/workflows/cd-dev-botnorrea-v2-telegram.yml @@ -21,7 +21,7 @@ jobs: node-version: ${{ matrix.node-version }} - name: Install serverless framework - run: npm install -g serverless + run: npm install -g serverless@3.38.0 - name: Install dependencies run: npm i diff --git a/.github/workflows/cd-prod-botnorrea-v2-telegram.yml b/.github/workflows/cd-prod-botnorrea-v2-telegram.yml index 2c64e3b..514cefe 100644 --- a/.github/workflows/cd-prod-botnorrea-v2-telegram.yml +++ b/.github/workflows/cd-prod-botnorrea-v2-telegram.yml @@ -49,7 +49,7 @@ jobs: - name: Install dependencies if: ${{ steps.obtener_autor_commit.outputs.autor_commit == 'botnorrea-v2' }} run: | - npm install -g serverless + npm install -g serverless@3.38.0 npm i - name: Create JSON diff --git a/src/lib/utils/telegramHelper.ts b/src/lib/utils/telegramHelper.ts index 23810f7..3a951df 100644 --- a/src/lib/utils/telegramHelper.ts +++ b/src/lib/utils/telegramHelper.ts @@ -1,5 +1,7 @@ import { EntityTypeTg, UpdateTg } from "../models"; +const { BOT_USERNAME } = process.env; + const filterTextCommandEntity = ({ type, offset }) => type === EntityTypeTg.BOT_COMMAND && offset === 0; @@ -33,7 +35,9 @@ const getTextCommandKey = ( position: { offset: number; length: number } ): string => { const text = body?.message?.text ?? body?.message?.caption; - const key = text!.substring(position?.offset, position?.length); + const key = text! + .substring(position?.offset, position?.length) + .replace(`@${BOT_USERNAME}`, ""); return key?.trim(); };