1

I have an on_message event to prevent users with "Muted" role from sending messages:

@client.event
async def on_message(ctx):
    muted=ctx.author.guild.get_role(673180122768998411)
    if muted in ctx.author.roles:
        await ctx.message.delete()

But with this event bot doesn't react to all the commands. They are not working. Example command:

@client.command(passContent = True)
@commands.has_role("🍿║Участники")
async def rank(ctx):
    return

1 Answer 1

2

You have to use this:

await client.process_commands(ctx)

So, your event will look like this:

@client.event
async def on_message(ctx):
    muted = ctx.author.guild.get_role(673180122768998411)
    if muted in ctx.author.roles:
        await ctx.delete()

    await client.process_commands(ctx)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.