Skip to content

Commit

Permalink
Merge pull request #10 from jotacemarin/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jotacemarin authored Jul 6, 2024
2 parents 8be8e48 + f5ae629 commit cb92bfa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd-dev-botnorrea-v2-telegram.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd-prod-botnorrea-v2-telegram.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/lib/utils/telegramHelper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { EntityTypeTg, UpdateTg } from "../models";

const { BOT_USERNAME } = process.env;

const filterTextCommandEntity = ({ type, offset }) =>
type === EntityTypeTg.BOT_COMMAND && offset === 0;

Expand Down Expand Up @@ -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();
};
Expand Down

0 comments on commit cb92bfa

Please sign in to comment.