📌  相关文章
📜  discord.py 分配角色 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:34.187000             🧑  作者: Mango

代码示例6
@bot.command()
@commands.has_permissions(manage_roles=True)
async def giverole(ctx, member: commands.MemberConverter, Role: discord.Role):

  if Role in member.roles:
    await ctx.send("**`{0}` already has the `{1}` role!**".format(member.name, Role))
  else:
    await member.add_roles(Role)
    await ctx.send("**Successfully added the role `{0}` to `{1}`**".format(Role, member.name))