The error is in the following line:
elif message.text.lower() == 'hello' or 'hi':
This statement is always true as @Klaus has pointed out. This is coz message.text.lower() == 'hello'
and 'hi'
are two separate conditions. The second one(‘hi’
) is always true since it’s just a string and the Boolean value of a non-empty string in Python is True. To make the statement work, change the aforementioned line to:
elif message.text.lower() == 'hello' or message.text.lower() == 'hi':