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
Advertisement
Answer
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)