我正在制作一个不和谐的机器人,我真的想发出一个静音命令来静音有毒用户。这是我目前完成的代码,这不是重写版本。
@bot.command(pass_context = True)
async def mute(ctx, user_id, userName: discord.User):
if ctx.message.author.server_permissions.administrator:
user = ctx.message.author
role = discord.utils.get(user.server.roles, name="Muted")
await client.add_roles(user, role)
else:
embed=discord.Embed(title="Permission Denied.", description="You don't have permission to use this command.", color=0xff00f6)
await bot.say(embed=embed)