Skip to content

Commit

Permalink
client context
Browse files Browse the repository at this point in the history
  • Loading branch information
radiantspace committed Oct 25, 2023
1 parent e144987 commit fb428f4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/app/telegram/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ func handleCallbackQuery(bot *telego.Bot, callbackQuery telego.CallbackQuery) {
func handleCommandsInCallbackQuery(callbackQuery telego.CallbackQuery) {
chatIDString := fmt.Sprint(callbackQuery.From.ID)
ctx := context.WithValue(context.Background(), models.UserContext{}, chatIDString)
ctx = context.WithValue(ctx, models.ClientContext{}, "telegram")
message := telego.Message{
Chat: telego.Chat{ID: callbackQuery.From.ID},
Text: "/" + callbackQuery.Data,
Expand All @@ -206,6 +207,7 @@ func handleCommandsInCallbackQuery(callbackQuery telego.CallbackQuery) {
func handleEngineSwitchCallbackQuery(callbackQuery telego.CallbackQuery) {
chatIDString := fmt.Sprint(callbackQuery.From.ID)
ctx := context.WithValue(context.Background(), models.UserContext{}, chatIDString)
ctx = context.WithValue(ctx, models.ClientContext{}, "telegram")
currentEngine := redis.GetChatEngine(chatIDString)
if callbackQuery.Data == string(currentEngine) {
err := BOT.AnswerCallbackQuery(&telego.AnswerCallbackQueryParams{
Expand Down

0 comments on commit fb428f4

Please sign in to comment.