Nov-16-2022, 07:54 AM
There are 3 functions:
send_docs_shop1()
send_docs_shop2()
send_docs_shop3()
How to call them depending on callback_query. For example if callback_query=='shop1, call send_docs_shop1() or callback_query=='shop2 call send_docs_shop2() and so on.
Now I do this:
send_docs_shop1()
send_docs_shop2()
send_docs_shop3()
How to call them depending on callback_query. For example if callback_query=='shop1, call send_docs_shop1() or callback_query=='shop2 call send_docs_shop2() and so on.
Now I do this:
@bot.callback_query_handler(func=lambda call:call.data=='shop1')
def get_select_button_shop1(call: types.CallbackQuery):
markup_inline_item=types.InlineKeyboardMarkup()
markup_inline_item.add()
bot.edit_message_text(chat_id=call.message.chat.id,message_id=call.message.id,text='welcome to shop1:',reply_markup=markup_inline_item)
@bot.message_handler()
def message_handler(message: types.Message):
if message.text in shop1:
shop1.send_docs_shop1(message)
else:
shop1.send_query_shop1(message)
@bot.callback_query_handler(func=lambda call:call.data=='shop2')
def get_select_button_shop2(call: types.CallbackQuery):
markup_inline_item=types.InlineKeyboardMarkup()
markup_inline_item.add()
bot.edit_message_text(chat_id=call.message.chat.id,message_id=call.message.id,text='welcome to shop2:',reply_markup=markup_inline_item)
@bot.message_handler()
def message_handler(message: types.Message):
if message.text in shop2:
shop2.send_docs_shop2(message)
else:
shop2.send_query_shop2(message)
@bot.callback_query_handler(func=lambda call:call.data=='shop3')
def get_select_button_shop3(call: types.CallbackQuery):
markup_inline_item=types.InlineKeyboardMarkup()
markup_inline_item.add()
bot.edit_message_text(chat_id=call.message.chat.id,message_id=call.message.id,text='welcome to shop3:',reply_markup=markup_inline_item)
@bot.message_handler()
def message_handler(message: types.Message):
if message.text in shop3:
shop3.send_docs_shop3(message)
else:
shop3.send_query_shop3(message)But now, regardless of the callback, only shop1 is called. Please help with the question, I have been suffering for 3 days already, I tried different options, but the result is 0.
