Skip to content

Catch exception and reply when the user has disabled private messages #3

@niklas-pernter

Description

@niklas-pernter

Sup, here a quick fix

            try:
                # Create a QrCode with that accessToken
                qrCodePath = f"QRCode_{message.author.id}_{str(uuid.uuid4())[0:8]}.png"
                qrcode.make(accessToken).save(qrCodePath)

                # Send the QrCode the the user who asked for
                await message.author.send(
                    "------------------------------------------------\n\n\nHello " + message.author.name + "\nHere is your new QR Code to login : ")
                await message.author.send(file=discord.File(qrCodePath))
                os.remove(qrCodePath)
                return
            except:
                await message.reply("Seems you have turned off private messages. Please activate them in the discord privacy settings!")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions