T
T
t1sherrrrrrrrr2022-04-14 22:29:04
Python
t1sherrrrrrrrr, 2022-04-14 22:29:04

How to assign a value to a variable from a callbackQuery handler?

@dp.callback_query_handler(text = 'cub')
async def send_message(call:CallbackQuery):
await call.message.edit_text('What's your bet?!')
await call.message.edit_reply_markup(reply_markup = nav.back)
game_stavka = int(call.text)
print(game_stavka)

I have a piece of code like this, which, according to my idea, should return what the user entered. but it turns out that there is no .text in the callbackquery.
Maybe you can tell me how to assign to a variable what the user entered?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SYS ADM, 2022-04-14
@kavermoki

use callback_data

M
Maxim Kravchuk, 2022-04-14
@MaxKra1985

call has data

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question