Answer the question
In order to leave comments, you need to log in
How to implement if or or in a bot?
I am writing a simple telegram bot
if message.text == "Дима":
bot.send_message(message.from_user.id, "ок")
else:
bot.send_message(message.from_user.id, "Ошибка")
Answer the question
In order to leave comments, you need to log in
Wrong
Correct
if message.text == 'Дима' or 'Вася':
if message.text == 'Дима' or message.text == 'Вася':
names = ['Дима', 'Вася']
if message.text in names:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question