Reputation: 39
Here is my code
@client.command()
async def roledm(ctx):
member = ctx.message.author
When you dm the bot with !roledm it gets your name but how would it go to my discord server and role them? how do I role people without using discord.utils.get( member.server.roles) , I just want to use my server ID to role them.
Upvotes: 0
Views: 216
Reputation: 2041
You need to use get
to return the roles in your guild.
@client.command()
async def roledm(ctx):
guild = client.get_guild(id=0000000000000000000000) # Guild ID
role = discord.utils.get(guild.roles, id=0000000000000000000000) # Role ID
member = guild.get_member(ctx.message.author.id)
await member.add_roles(role)
Upvotes: 2