@bot.callback_query_handler(func=lambda call: call.data == 'current_sending')
def serch(call):
keyboard = types.InlineKeyboardMarkup()
for clients in sqlite_db.get_all_clients():
button_user = types.InlineKeyboardButton(text=clients[1], callback_data=clients[0])
button = button_user
keyboard.add(button)
bot.send_message(call.message.chat.id, text='Select user', reply_markup=keyboard)
@bot.callback_query_handler(func=lambda call: int(call.data) == ???)
def current_sending(call):
bot.send_message(call.message.chat.id, text=f'Write a message for the user {???}')
@bot.message_handler(content_types=['text'])
def message(mesg):
sending_tg.send_current_client(name=???, mesg.text)
@bot.callback_query_handler(func=lambda call: call.data == 'select_all')
def select_all(call):
bot.send_message(call.message.chat.id, text=f'{sqlite_db.get_all_clients()}')
how to connect callback_data with callback_query_handler when a new user is added and so that I can send him a message via a telegram bot, I create buttons through a loop and then I don’t know what to do. This is my non-working option, help