W
W
Winfell2022-03-10 20:35:50
Python
Winfell, 2022-03-10 20:35:50

How to make something in AIOGRAM.KeyboardButton react not to "/command", but react to "command" without "/"?

Hello!
Tell me how to make the bot react not to /command, but so that I can send without it at all and the bot recognizes commands in the telegram chat.
Tried: via

@dp.message_handler(lambda message: 'Текст ' in message.text)
async def test(message: types.Message):
    await bot.send_message(message.from_user.id,reply_markup=keybord)

Did not work out. Then I tried it through @bot_father (I dug out a guide somewhere), it didn’t work either. Tell me how to fix it.
Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SashaN69, 2022-03-10
@Winfl

@dp.message_handler(text='Текст')
async def test(message: types.Message):
    await bot.send_message(message.from_user.id,reply_markup=keybord)

or like this
@dp.message_handler(content_type=['text'])
async def test(message: types.Message):
    if message.text = "Текст":
        await bot.send_message(message.from_user.id,reply_markup=keybord)

And instead
await bot.send_message(message.from_user.id,reply_markup=keybord)

Can
await message.answer("Хмм", reply_markup=keybord )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question