giv role pls?
it registers when the code is incorrect, but when correct, it won't give the role.hisoka
python
2 years ago
2.3 kB
7
Indexable
############ class VerifyModal(discord.ui.Modal, title="Verification"): correctcode = ui.TextInput( label="Captcha", placeholder="Input Captcha Code", style=discord.TextStyle.short, ) # MODAL SUBMIT WILL TRIGGER THIS async def on_submit(self, interaction: discord.Interaction): await interaction.response.edit_message(view=DisabledButton()) # SUCCESS EMBED successembed = discord.Embed( title="Verification Success!", description=f"Congrats <@{interaction.user.id}>, you're human!\n\nAccess to `{interaction.guild.name}` has been granted.", color=0x8FCE00) # FAIL EMBED failembed = discord.Embed( title="Incorrect Code!", description="The code you submitted was incorrect, please try again.\n\n**Note**: This captcha is **case-sensitive.**", color=0xFF4040) # ERROR EMBED errorembed = discord.Embed( title="Verification Error!", description=f"An error has occured while attempting to verify in `{interaction.guild.name}`, please try again.\n\n **Note:** Error could be caused by high volume. Please remain patient.", color=0xFFC45F) verifyrole = verifyguild.get_role(verifyconfig["verifyrole"]) # CHECKING THE USER INPUTTED TEXT AGAINST CAPTCHA try: # IF CODE IS CORRECT if self.correctcode.value == captchatext: print(" Verified Role = "(verifyrole)) await interaction.member.add_role(verifyrole, reason = "Passed Verification.") print(" Error adding role.") await interaction.edit_original_response( embed=successembed, attachments=[], view=CasualButton()) print(" Correct code was submitted!") return if self.correctcode.value != captchatext: await interaction.edit_original_response( embed=failembed, attachments=[], view=None) print(" Incorrect code has been submitted.") return ######
Editor is loading...