Need help with creating an exception to a word detection discord bot..

to add on to this, possible add 'hate' to a list or a tuple since it takes less resources, and op would probably be manually adding the words in the code rather than being read from a file or something, that way if OP finds another words that doesn't want triggered included with bread, they can just add it to the list

badwords = ['hate','some','other','words','too']
text = message.content.lower()
if 'bread' in text and badwords in text:
    await message.channel.send('I like bread.')

that way OP won't have something like.

if 'bread' in text and 'hate' not in text and 'some' not in text and 'other' not in text:

but thats completely up to OP, just throwing it out there.

/r/learnpython Thread Parent