Discord.py重写:“静音”命令不起作用

时间:2020-09-25 19:27:50

标签: python discord discord.py-rewrite

我正在尝试使用户静音。

@client.command()
@commands.has_permissions(administrator=True)
async def mute(ctx, user: discord.Member, *, reason=None):
    await user.mute(reason=reason)
    await ctx.send(f'{user} has been muted')

我收到以下错误:

Member object has no attribute "mute"

如何使用户静音?

1 个答案:

答案 0 :(得分:0)

尝试一下:

@client.command()
@commands.has_permissions(administrator=True)
async def mute(ctx, user : discord.Member, *, reason = None):
    await user.edit(mute = True, reason = reason)
    await ctx.send(f'{user} has been muted')