Discord.py | add role to someone

后端 未结 4 1662
别跟我提以往
别跟我提以往 2021-01-07 01:44

I have trouble with making an "add role" command in discord.py. I don\'t know what is wrong; it just doesn\'t work.

@client.command()
@commands.has_         


        
4条回答
  •  半阙折子戏
    2021-01-07 02:25

    @bot.command(pass_context=True)
    async def giverole(ctx, user: discord.Member, role: discord.Role):
        await user.add_roles(role)
        await ctx.send(f"hey {ctx.author.name}, {user.name} has been giving a role called: {role.name}")
    

    Let me know if it works!

提交回复
热议问题