Command Glitch Discord Py

My bot sends a message whenever a member sends a word or phrase banned within the server. Although after it sends the message, it causes the bot to glitch and start sending the same message but instead of it deleting once, it sends multiple duplicates of the message and mentions itself and it sends the message "My prefix is *"

Here's the code:

@bot.listen('on_message') 
async def on_message(message):
    messageAuthor = message.author

    if bannedWords != None and (isinstance(message.channel, discord.channel.DMChannel) == False):
        for bannedWord in bannedWords:
            if msg_contains_word(message.content.lower(), bannedWord):
                await message.delete()
                await message.channel.send(f"{messageAuthor.mention} avoid saying ||{bannedWord}|| within the server :)")

@bot.listen('on_message') 
async def on_message(message):
    if bot.user.mentioned_in(message):
        await message.channel.send(f"My prefix is {prefix}")


Check if the bot is reacting to its own message, if it is then return None thereby terminating the function and not processing further.

You do it like this :

if message.author == bot.user:
    return

This is how you implement it in your code :

@bot.listen("on_message")
async def on_message(message):

    if message.author == bot.user:
        return

    messageAuthor = message.author

    if bannedWords != None and (
        isinstance(message.channel, discord.channel.DMChannel) == False
    ):
        for bannedWord in bannedWords:
            if msg_contains_word(message.content.lower(), bannedWord):
                await message.delete()
                await message.channel.send(
                    f"{messageAuthor.mention} avoid saying ||{bannedWord}|| within the server :)"
                )


@bot.listen("on_message")
async def on_message(message):

    if message.author == bot.user:
        return

    if bot.user.mentioned_in(message):
        await message.channel.send(f"My prefix is {prefix}")