jwjw2069
jwjw2069

Reputation: 29

Discord.py Get all roles from mentioned member

is there a way to send all of the mentioned person's roles to a channel?

Start of my code:

@client.command()
@commands.has_role("Enhanced Permissions")
async def softban(ctx, user : discord.Member, 

Not sure what to do next

Upvotes: 1

Views: 666

Answers (1)

InsertCheesyLine
InsertCheesyLine

Reputation: 1373

roles = user.roles
roles = [role.name for role in roles]
await ctx.send(f"```{','.join(roles)}```"

This will fetch the roles belonging to user and print them within codeblocks.

Upvotes: 1

Related Questions