Skip to content

Commit

Permalink
remove comments in YMLs, remove unused libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
jotacemarin committed Feb 8, 2024
1 parent a59ce5e commit 1eab84c
Show file tree
Hide file tree
Showing 15 changed files with 478 additions and 1,077 deletions.
1,447 changes: 454 additions & 993 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,10 @@
"dependencies": {
"@aws-sdk/client-dynamodb": "3.388.0",
"@aws-sdk/lib-dynamodb": "3.388.0",
"@xenova/transformers": "2.8.0",
"axios": "1.4.0",
"dayjs": "1.11.10",
"http-status": "1.6.2",
"mongoose": "8.0.0",
"onnxruntime-node": "1.16.2",
"transformers.ts": "1.0.2"
"mongoose": "8.0.0"
},
"devDependencies": {
"@babel/preset-env": "7.22.10",
Expand Down
5 changes: 2 additions & 3 deletions src/functions/telegram_debug/function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ handler: index.telegramDebug
memorySize: 128
timeout: 30
reservedConcurrency: 5
events:
- http:
events:
- http:
path: /${self:custom.secrets.service.name}-${self:custom.secrets.provider.stage}/telegram/debug
method: POST
cors: true
# authorizer: authorizer
1 change: 0 additions & 1 deletion src/functions/telegram_edit_message/function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ events:
path: /${self:custom.secrets.service.name}-${self:custom.secrets.provider.stage}/telegram/edit-message
method: POST
cors: true
# authorizer: telegramAuthorizer
4 changes: 2 additions & 2 deletions src/functions/telegram_get_chats/function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ handler: index.telegramGetChats
memorySize: 128
timeout: 30
reservedConcurrency: 5
events:
- http:
events:
- http:
path: /${self:custom.secrets.service.name}-${self:custom.secrets.provider.stage}/telegram/get-chats
method: POST
cors: true
4 changes: 2 additions & 2 deletions src/functions/telegram_members_mute/function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ handler: index.telegramMembersMute
memorySize: 128
timeout: 30
reservedConcurrency: 5
events:
- http:
events:
- http:
path: /${self:custom.secrets.service.name}-${self:custom.secrets.provider.stage}/telegram/members/mute
method: POST
cors: true
4 changes: 2 additions & 2 deletions src/functions/telegram_members_unmute/function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ handler: index.telegramMembersUnmute
memorySize: 128
timeout: 30
reservedConcurrency: 5
events:
- http:
events:
- http:
path: /${self:custom.secrets.service.name}-${self:custom.secrets.provider.stage}/telegram/members/unmute
method: POST
cors: true
1 change: 0 additions & 1 deletion src/functions/telegram_send_message/function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ events:
path: /${self:custom.secrets.service.name}-${self:custom.secrets.provider.stage}/telegram/send-message
method: POST
cors: true
# authorizer: telegramAuthorizer
5 changes: 2 additions & 3 deletions src/functions/telegram_send_photo/function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ handler: index.telegramSendPhoto
memorySize: 128
timeout: 30
reservedConcurrency: 10
events:
- http:
events:
- http:
path: /${self:custom.secrets.service.name}-${self:custom.secrets.provider.stage}/telegram/send-photo
method: POST
cors: true
# authorizer: telegramAuthorizer
5 changes: 2 additions & 3 deletions src/functions/telegram_send_video/function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ handler: index.telegramSendVideo
memorySize: 128
timeout: 30
reservedConcurrency: 10
events:
- http:
events:
- http:
path: /${self:custom.secrets.service.name}-${self:custom.secrets.provider.stage}/telegram/send-video
method: POST
cors: true
# authorizer: telegramAuthorizer
4 changes: 2 additions & 2 deletions src/functions/telegram_set_webhook/function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ handler: index.telegramSetWebhook
memorySize: 128
timeout: 30
reservedConcurrency: 1
events:
- http:
events:
- http:
path: /${self:custom.secrets.service.name}-${self:custom.secrets.provider.stage}/telegram/set-webhook
method: POST
cors: true
1 change: 1 addition & 0 deletions src/functions/telegram_webhook/function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ events:
path: /${self:custom.secrets.service.name}-${self:custom.secrets.provider.stage}/telegram/webhook
method: POST
cors: true
# authorizer: telegramAuthorizer
6 changes: 6 additions & 0 deletions src/functions/telegram_webhook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export const telegramWebhook = async (
callback: Callback
): Promise<void> => {
context.callbackWaitsForEmptyEventLoop = false;
const startDate = new Date();

if (!event?.body) {
return callback(null, { statusCode: BAD_REQUEST });
Expand All @@ -116,5 +117,10 @@ export const telegramWebhook = async (
}
const response = await execute(body);

const endDate = new Date();
console.log(
`Telegram Webhook execution: ${endDate.getTime() - startDate.getTime()}ms`
);

return callback(null, response);
};
4 changes: 2 additions & 2 deletions src/lib/services/auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios, { AxiosResponse, AxiosInstance } from "axios";

const { AUTH_URL } = process.env;
const { AUTH_URL, BOT_NAME } = process.env;

interface Auth0GetTokenResponse {
access_token: string;
Expand Down Expand Up @@ -28,7 +28,7 @@ export class AuthService {
return AuthService.instance.post("/oauth/token", {
client_id: clientId,
client_secret: clientSecret,
audience: "botnorrea-v2",
audience: `${BOT_NAME}`,
grant_type: "client_credentials",
});
}
Expand Down
59 changes: 0 additions & 59 deletions src/lib/services/transformers.ts

This file was deleted.

0 comments on commit 1eab84c

Please sign in to comment.