title: How can I use the on_message_edit event to block swear words? (discord.py)
body: <p>I want my bot to delete the message if someone edits the message into a swear word message using the <code>on_message_edit</code> event, but I've been trying to figure this out and nothing has worked so far. Here is the code that doesn't work.</p>
  <pre><code>with open(&quot;badwords.txt&quot;) as file:
      blacklist = file.read().split('\n')
  
  @client.event
  async def on_message_edit(before, after, message):
      for word in blacklist:
          regex_match_true = re.compile(fr&quot;[{symbols}]*&quot;.join(list(word)), re.IGNORECASE)
          regex_match_none = re.compile(fr&quot;([{letters}]+{word})|({word}[{letters}]+)&quot;, re.IGNORECASE)
          if regex_match_true.search(message.content) and regex_match_none.search(message.content) is None:
              #embed here
              await message.delete()
              break
  </code></pre>