Skip to content

Commit

Permalink
setup context in call backs
Browse files Browse the repository at this point in the history
  • Loading branch information
radiantspace committed Mar 2, 2024
1 parent 6bef860 commit 0e6cf70
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions backend/app/telegram/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,7 @@ func handleCallbackQuery(bot *telego.Bot, callbackQuery telego.CallbackQuery) {
func handleCommandsInCallbackQuery(callbackQuery telego.CallbackQuery) {
chat := callbackQuery.Message.GetChat()
chatIDString := fmt.Sprint(chat.ID)
ctx := context.WithValue(context.Background(), models.UserContext{}, chatIDString)
ctx = context.WithValue(ctx, models.ClientContext{}, "telegram")
_, ctx, _, _ := lib.SetupUserAndContext(chatIDString, "telegram", chatIDString)
message := telego.Message{
Chat: telego.Chat{ID: chat.ID},
Text: "/" + callbackQuery.Data,
Expand All @@ -337,8 +336,7 @@ func handleEngineSwitchCallbackQuery(callbackQuery telego.CallbackQuery) {
chatID = chat.ID
}
chatIDString := fmt.Sprint(chatID)
ctx := context.WithValue(context.Background(), models.UserContext{}, chatIDString)
ctx = context.WithValue(ctx, models.ClientContext{}, "telegram")
_, ctx, _, _ := lib.SetupUserAndContext(chatIDString, "telegram", chatIDString)
currentEngine := redis.GetChatEngine(chatIDString)
if callbackQuery.Data == string(currentEngine) {
err := BOT.AnswerCallbackQuery(&telego.AnswerCallbackQueryParams{
Expand Down

0 comments on commit 0e6cf70

Please sign in to comment.