Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
niklas-pernter opened this issue Aug 1, 2021 · 0 comments

Comments

@niklas-pernter
Copy link

niklas-pernter commented Aug 1, 2021

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!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant