简体   繁体   中英

My discord.py bot cannot check roles in command

@client.command()
async def expelliarmus(ctx, member: discord.Member):
  if member.have_roles("protego"):
   await ctx.send("Protego yapan birine saldıramazsın.")
  else:
   duelrole = discord.utils.get(ctx.guild.roles, name="düellocu")
   await member.remove_roles(duelrole)
   await ctx.send("ASASI UÇTU!  blablabla")
   await asyncio.sleep(30)
   await member.add_roles(duelrole)
   await ctx.send("Asasını geri aldı!!")

I'm building a Discord bot and I want the command not to work if the user has the role named Protego. What can I do?

u need to definite exception for unregistered a role 'protego'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM