首页 > 解决方案 > Discord.py 取消静音错误:“协程”对象不可调用

问题描述

我一直在为我的 discord.py 机器人编写取消静音功能。完成后,我尝试运行它,并弹出此错误:'coroutine' object is not callable

这是我的代码顺便说一句:

@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)

我该怎么办?

标签: pythondiscorddiscord.pybots

解决方案


装饰器@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


推荐阅读