Как вы добавляете роли в discord.py? - PullRequest
0 голосов
/ 04 июля 2019

Я пытаюсь добавить роль кому-то, но когда я делаю

client.add_roles(member, role)

, я перепробовал все, что мог придумать, с кодом, который просто дает мне это сообщение, я посмотрел на несколько другихвопросы вокруг в поисках ответа, но все говорят, что нужно выполнить ту команду, которую я пробовал, но она не будет работать.

@client.command(pass_context=True)
@commands.has_role('Unverified')
async def verify(ctx, nickname):
    gmember = ctx.message.author #This is the looking for the memeber
    role = discord.utils.get(gmember.server.roles, name='Guild Member')
    channel = client.get_channel(401160140864094209)
    await gmember.edit(nick=f"{nickname}")
    await ctx.channel.purge(limit=1)
    r = requests.get("This is the link to the API but it shows my key and everything so not going to put it here but it works in other commands")
    #if nickname in role:
    #  await ctx.send(f"You have already verified your account.")
    if nickname.encode() in r.content:
        await channel.send(f'@here ``{nickname}`` is in the guild.')
        await client.add_roles(gmember, role)
    else:
        await gmember.kick()

Экземпляр Bot не имеет add_roles член pylint (нет участника)

1 Ответ

0 голосов
/ 04 июля 2019

await gmember.add_roles(role) Вы можете прочитать больше здесь

...