1

I have a button 'Send promocode' in my bot, when user clicks on these button i receive message in my admin channel,

@dp.message_handler(Text(equals="requset promo"))
async def get_promocode(message: types.Message):
    id = message.from_user.id
    username = message.from_user.username


    dt_now = str(datetime.today().strftime('%d.%m.%Y'))
    await PromoSend.req.set()
    await bot.send_message(Config.admin_chat_id, text=f'''
    ID {id}
    Username: {username}
    Date: {dt_now}''', reply_markup=send_button(id, username))
    #await message.answer('Request sended !', reply_markup=menu2())

When i receive message in admin channel i have 1 inline button "send", want to after clicking on these button and sending text in the channel bot sends same text to the user who clicked the button before

@dp.callback_query_handler(lambda call: "send_message" in call.data)
async def send_button_callback(call: types.CallbackQuery, state: FSMContext):
    id = call.data.split('/')[1]
    username = call.data.split('/')[2]
    #mess = bot.copy_message()

    await call.message.delete()
    await bot.send_message(Config.admin_chat_id,f'Send, {username}', reply_markup=button_cancel_mailing())
    await PromoSend.ans.set()

@dp.message_handler(state='PromoSend.ans')
async def send_message_to_user(message: types.Message, state: FSMContext):
    print("Debug")

The problem is that nothing works as script doesn't go to next state Please help me

CallMeStag
  • 5,467
  • 1
  • 7
  • 22

0 Answers0