Reputation:
I have this command to give a role to a user ,
@commands.command(pass_context=True)
@commands.has_permissions(manage_roles=True)
async def role(self,ctx, user: discord.Member, role: discord.Role):
await user.add_roles(role)
await ctx.send(f"hey {ctx.author.name}, {role.name} Role have been given to {user.mention}")
await ctx.message.add_reaction(emoji="<a:tick:748476262640779276>")
what I is a command like role @role @user1 @user2 @user3.... to give a role to multiple users with a single command. How do I do it?
Upvotes: 0
Views: 504
Reputation: 3426
You can do it as following
@commands.command(pass_context=True)
@commands.has_permissions(manage_roles=True)
async def role(self, ctx, role: discord.Role, *users: discord.Member):
for user in users:
await user.add_roles(role)
{prefix}role @role @user1 @user2
Upvotes: 1