How to make detect uppercase and lowercase word format?

OK, so I am working on a say command in I want it to detect if the user use bad word that in my banned.txt list, it won't say it. The problem is, how to make it detect uppercase and lowercase letter? For example, in my list, it has "nigga", but the user use "NiGGa". How to make the BOT detect it and won't let the bot say that? This is my code so far:

    async def say(self, message, *, content):
      fp  = open('banned.txt')
      bad_list = [word.strip() for line in fp.readlines() for word in line.split(',') if word.strip() if word.lower()]
      if any(word in content for word in bad_list):
          await message.reply("Don't you dare!")
          await message.reply(f"```{content}```")    

I can't upload the banned.txt here, as it violate the ToS.

Read more here:

Content Attribution

This content was originally published by JimmyBlue at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: