如何为具有discord.py的人添加角色?我遵循了api,但是它不起作用,并说我遇到语法错误。
这是我的代码:
member = message.author
role = discord.utils.get(message.author.server.roles, name="game1")
await client.add_roles(member, role)
答案 0 :(得分:-1)
from discord.ext import commands
@bot.command(pass_context=True)
async def role(ctx):
member = ctx.message.author
role = get(member.server.roles, name="game1")
await bot.add_roles(member, role)