How can I make my chat filter send one embed if there are 2 swear words?

I'm having an issue where if there are 2 swear words in a message, it will send 2 embeds. Does anyone know fixes for this?

@client.event
async def on_message(message):    
    for bad_word in bad_words:
        if bad_word in message.content.lower().split(" "):
            t = discord.Embed(color=0x039e00, title="Message Removed", description=f":x:   Please don't say that here, {message.author.mention}.")
            t.set_footer(text="DM TheSuperRobert2498#2498 for bot suggestions.")
            await message.channel.send(embed=t, delete_after=5)
            await message.delete()
        else:
            await client.process_commands(message)


Read more here: https://stackoverflow.com/questions/66340855/how-can-i-make-my-chat-filter-send-one-embed-if-there-are-2-swear-words

Content Attribution

This content was originally published by TheSuperRobert 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: