Z
Z
Zaz02021-01-12 14:14:06
In contact with
Zaz0, 2021-01-12 14:14:06

How to make a python bot in VK respond to messages that are not in the code, let’s say this: I didn’t understand anything?

maybe through else? explain in simple terms.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey_Lomakin, 2021-01-12
@Sergey_Lomakin

My experience is limited, but I think the easiest way is either via else or exception handling.

C
CheXnik, 2021-01-12
@CheXnik

@dp.message_handler()
async def echo(message: types.__all__):
    if message.text == 'Привет':
        await message.answer('Салам Алейкум')
    else:
        await message.answer('Сори я такого не знаю')

this is the code for the telegram bot, but I think you will understand)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question