我一直在为我的discord.py bot编写静音函数。一旦我完成,我试图运行它,这个错误弹出:'协程'对象不可调用
这是我的代码:
@bot.command(description="Unmutes a specified user.")
@commands(manage_messages=True)
async def unmute(ctx, member: discord.Member):
mutedRole = discord.utils.get(ctx.guild.roles, name="Muted")
await member.remove_roles(mutedRole)
await member.send(f" you have unmutedd from: - {ctx.guild.name}")
embed = discord.Embed(title="unmute", description=f" unmuted-{member.mention}",colour=discord.Colour.green())
await ctx.send(embed=embed)
我该怎么办?
装饰器@commands(manage_messages=True)
不存在。
我想你指的是@commands.has_permissions(manage_messages=True)
。应该可以了
https://discordpy.readthedocs.io/en/master/ext/commands/api.html?highlight=has%20permissions discord.ext.commands.has_permissions