title: discord.py: How to check if a message contains text from a list
body: <p>I made a rickroll detector but it needs to check if the message (defined as i) contains a word/text from the &quot;banned&quot; list.</p>
  <p>Code:</p>
  <pre class="lang-py prettyprint-override"><code>import discord
  from discord.ext import commands
  from async_rickroll_detector import RickRollDetector
  
  banned = []
  banned = [&quot;dQw4w9WgXcQ, rW7hXs-81hM&quot;]
  BOT_TOKEN = &quot;&lt;TOKEN&gt;&quot;
  RICKROLL_FOUND_MESSAGE = &quot;⚠️ Rickroll Alert ⚠️&quot;
  
  bot = commands.Bot(command_prefix = &quot;&gt;&quot;, intents = discord.Intents.default())
  
  @bot.event
  async def on_ready():
     global detector
     detector = RickRollDetector()
  
  @bot.event
  async def on_message(msg):
  for i in msg.content.split(&quot; &quot;):
      i = i.replace(&quot;&lt;&quot;,&quot;&quot;).replace(&quot;&gt;&quot;, &quot;&quot;) #Removes &lt;&gt; that could be used to hide embeds
      if banned in i and await detector.find(i):
          await msg.reply(RICKROLL_FOUND_MESSAGE)
          break
  
  await bot.process_commands(msg)
  
  bot.run(BOT_TOKEN)
  </code></pre>
  <p>I'll add more things to the &quot;banned&quot; list so this is just a test.</p>