Reputation: 33
I'm trying to set the permission of the server, using that code a wait ctx.guild.edit(verification_level=line)
, but I get that error verification_level field must be of type VerificationLevel
. I presume the problem is the variable type. How can I transform any str to a specific type used by Discord.py?
Thank you for any help.
Upvotes: 0
Views: 85
Reputation: 61042
discord.py
Enums implement __getitem__
, and attempt to lookup the supplied key in their internal map. You can do
await ctx.guild.edit(verification_level=VerificationLevel[line])
Upvotes: 1