Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
call query telebot
#1
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:
@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.
Reply
#2
bro, i have same problem. did you manage to solve it?
Larz60+ write May-14-2024, 10:06 AM:
You were just advised here (by deanhystad) not to reply to old post as your request will never be answered, yet you continue...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Handling receiving updates from user in Telebot mohsenamiri 0 1,255 Aug-26-2024, 09:25 AM
Last Post: mohsenamiri
  Question of Telebot mohsenamiri 0 512 Aug-14-2024, 07:03 AM
Last Post: mohsenamiri

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020