I want that if the author's messages are above the bot role, then the event will not work accordingly, how can I do this? Here is my code:

async def on_message(message):
    if message.author== bot.user:
    if message.author.top_role != bot.user:
    elif message.content.startswith("text"):
        channel= message.channel
        await message.channel.send(f"{message.author.mention} text")
        await message.delete()
    await bot.process_commands(message)

You seem to have written in the comments under the answer to the previous question that this issue has already been resolved for you. In this case, you can write and accept the answer yourself.

denisnumb2022-02-15 10:30:12

yes, I already made the code, it works, but in one server for some reason member is taken as user, although the channel is not private, probably the server is private or I don’t know, in another server where I am an admin, not a user, then everything works.

mafinpy2022-02-14 10:34:36