#Ignoring exception in command verify

1 messages · Page 1 of 1 (latest)

whole dust
#

code ```import discord
from discord.ext import commands
from discord.commands import slash_command # Importing the decorator that makes slash commands.
import cogs.env as env
import string
import random
from captcha.image import ImageCaptcha
import asyncio

class Verification(commands.Cog):
def init(self, bot):
self.bot = bot

@slash_command(guild_ids=[1009455228313157673], description="Sends you a verification captcha.")
async def verify(self, ctx):
  if ctx.channel.id == 1052705213821239326:
    letters = string.ascii_uppercase
    ltrs = ''.join(random.choice(letters) for i in range(4))
    print(ltrs)

    image = ImageCaptcha(fonts=['fonts/A.ttf'])
    data = image.generate(ltrs)
    image.write(ltrs, 'out.png')

    

    try:
        try:
          embed=discord.Embed(title="Mania Captcha", description="To gain access to our discord, please complete the captcha below.\n**You have 2 minutes.**", colour=0x404eed)
          await ctx.author.send(embed=embed)
          embed2=discord.Embed(title="Mania Captcha", description="Sent a Captcha to your messages.", colour=0x404eed)
          await ctx.respond(embed=embed2, delete_after=10)
          m = await ctx.author.send(file=discord.File("out.png"))

          def check(m):
            return m.content == ltrs and ctx.author.id == ctx.author.id

          msg = await self.bot.wait_for('message', timeout=120.0, check=check)
        except:
            embed = discord.Embed(title="Error! :warning:", description="Check if you have private messages enabled and try again!", colour=0xf3565d)
            embed.set_image(url="https://cdn.discordapp.com/attachments/773676926590124075/908454832111747113/2.png")
            await ctx.respond(embed=embed, delete_after=10, ephemeral=True)
    except asyncio.TimeoutError:
        embed=discord.Embed(title="Mania Captcha", description="Captcha failed, type `/verify` inside #907737722486157322 to try again.", colour=0xf3565d)
        await ctx.author.send(embed=embed)
    else:
        embed=discord.Embed(title="Mania Captcha", description="Captcha has been completed!", colour=0x5cb85c)
        await ctx.author.send(embed=embed)
        role = discord.utils.get(ctx.guild.roles, id=908437334620520468)
        await ctx.author.remove_roles(role)
        role2 = discord.utils.get(ctx.guild.roles, id=906980761654157322)
        await ctx.author.add_roles(role2)
  else:
      await ctx.respond("You're already verified!", delete_after=10, ephemeral=True)

def setup(bot):
try:
bot.add_cog(Verification(bot))
print("Loaded verification.py")
except Exception as e:
print(f"Error loading verification.py: {e}")```

error

worthy venture
#

?tag pastebin

pale quiverBOT
#

dynoError No tag pastebin found.

worthy venture
#

?tag paste

pale quiverBOT
worthy venture
#

Paste the error there

#

@whole dust

whole dust
worthy venture
#

Or whatever library you use for image manipulation

#

TL;DR

#

It's a.ttf

#

Not A.ttf

whole dust
#

i changed it to a.ttf but still got the same error

worthy venture
#

Uh

#

Try arial.ttf

whole dust
#

fixed, thanks for your help