You use :
in parameters when you specify the class
of the parameter. If you want to assign a value, you should use =
like async def removerole(ctx, user: discord.Member, role=763045556200931348):
. But I think that that's not what you want. You want to remove the role from the user. You can do it by mentioning the role.
@bot.command(pass_context=True)
@commands.has_role(764795150424866836)
async def removerole(ctx, user: discord.Member, role: discord.Role):
if role in user.roles:
await user.remove_roles(role)
With that, you just have to mention the that you want to remove from the user.
But if you just want to type the role id to remove the role, you can use guild.get_role(id)
.
@bot.command(pass_context=True)
@commands.has_role(764795150424866836)
async def removerole(ctx, user: discord.Member, role=763045556200931348):
remove_role = ctx.guild.get_role(role)
if remove_role in user.roles:
await user.remove_roles(remove_role)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…