Answer the question
In order to leave comments, you need to log in
How to issue a role on a specific server, knowing the server ID and user ID?
I am writing a bot with a verification system for my server. The bottom line is this: when entering the server, the bot writes a message to the user's PM, which indicates, for example, "write .verification" (simplified) in the bot's PM. After that, the bot will issue a role on the desired server (the bot will be used only on 1 server). I was able to implement everything except the issuance of a role. When messaging in PM, the bot records the user as a user, not as a member, which is why it cannot give a role. Can someone help?
@bot.command()
@commands.dm_only()
async def верификация(ctx, code):
if code == '162933':
member = ctx.message.author
await member.add_roles(discord.utils.get(member.guild.roles, id=891743318852116490))
await member.edit(nick='123')
await member.send('Верификация прошла успешно! Доступ к серверу открыт.')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question