You can use regular expressions
>>> import re
>>> check_hello = re.compile(r"^\bhi\b|\bhello\b", re.IGNORECASE)
>>> re.search(check_hello, "Hi,de")
<re.Match object; span=(0, 2), match='Hi'>
>>> re.search(check_hello, "Hide")
>>> re.search(check_hello, "Hello,de")
<re.Match object; span=(0, 5), match='Hello'>
>>> re.search(check_hello, "Hellode")
So your code might look like this
import re
check_hello = re.compile(r"^\bhi\b|\bhello\b", re.IGNORECASE)
if re.search(check_hello, message.content):
#await message.reply("Hello Bro ")
Explanation
In a regular expression, the character ^
means the beginning of a line (if you want the message to start with the word you are looking for). The symbol \b
means the word boundary. The |
symbol allows you to use multiple search options.