I have an on_message event to prevent users with “Muted” role from sending messages:
JavaScript
x
6
1
@client.event
2
async def on_message(ctx):
3
muted=ctx.author.guild.get_role(673180122768998411)
4
if muted in ctx.author.roles:
5
await ctx.message.delete()
6
But with this event bot doesn’t react to all the commands. They are not working. Example command:
JavaScript
1
5
1
@client.command(passContent = True)
2
@commands.has_role("🍿║Участники")
3
async def rank(ctx):
4
return
5
Advertisement
Answer
You have to use this:
JavaScript
1
2
1
await client.process_commands(ctx)
2
So, your event will look like this:
JavaScript
1
8
1
@client.event
2
async def on_message(ctx):
3
muted = ctx.author.guild.get_role(673180122768998411)
4
if muted in ctx.author.roles:
5
await ctx.delete()
6
7
await client.process_commands(ctx)
8