From 05743e256d4016ab64aecbe0413303bb1fa257c1 Mon Sep 17 00:00:00 2001 From: Yury Nevalenny Date: Sun, 17 Mar 2024 18:06:28 +0000 Subject: [PATCH] validate user usage --- backend/app/telegram/telegram.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/app/telegram/telegram.go b/backend/app/telegram/telegram.go index 8dd79e3..31400b8 100644 --- a/backend/app/telegram/telegram.go +++ b/backend/app/telegram/telegram.go @@ -423,6 +423,11 @@ func handleInlineQuery(bot *telego.Bot, inlineQuery telego.InlineQuery) { } log.Infof("Inline query from ID: %d, query size: %d", inlineQuery.From.ID, len(inlineQuery.Query)) + ok := lib.ValidateUserUsage(ctx) + if !ok { + config.CONFIG.DataDogClient.Incr("telegram.usage_exceeded", []string{"client:telegram", "channel_type:inline"}, 1) + } + // get the response response, err := BOT.API.ChatComplete(ctx, models.ChatCompletion{ Messages: []models.Message{