I wouuld like to give a user who private messages the bot a specific role in a specific server. How can I do this, I can not find anything in the internet. Code I have right now (doesnt work and is outdated):
target_server_id = "623597980175433749"
target_role_id = "656158110179655701"
#if not ctx.message.channel.is_private:
#await client.say("Private command only")
server = await client.get_guild(target_server_id)
role = discord.utils.get(guild.roles, id=target_role_id)
member = guild.get_member(ctx.message.author.id)
if member:
await client.add_roles(member, role)
else:
await client.say("You are not a member")