Skip to content

Commit

Permalink
validate user usage
Browse files Browse the repository at this point in the history
  • Loading branch information
radiantspace committed Mar 17, 2024
1 parent 6fd5171 commit 05743e2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/app/telegram/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 05743e2

Please sign in to comment.