How do you assign roles with the discord.py rewrite?

后端 未结 1 1202
刺人心
刺人心 2021-01-20 03:57

I am creating a discord bot using discord.py rewrite and am hosting iton repl.it. I am trying to add assignment of roles, but I get an error everytime I try to

1条回答
  •  有刺的猬
    2021-01-20 04:58

    I added Alberto Poljak's suggestions and it worked!

    import discord.utils 
    @client.command()
    async def role(ctx, * role: discord.Role):
      user = ctx.message.author
      await user.add_roles(role)
    

    0 讨论(0)
提交回复
热议问题