Epic
Epic

Reputation: 19

How to fix nested asn1 error in discord.py?

Whenever I try to run my code with discord.py package i get some nested asn1 error. Here is my code:

import discord
from discord.ext import commands

client = commands.Bot(command_prefix = "epic")

@client.event
async def on_ready():
    print("Bot is ready!")

client.run('NzcxMDIxMjQyNDk2MzE5NTQ4.X5mDfQ.chrdyrxO6OBcQOPRKTIhw05eeAc')

Also, here is the error i get:

Message=[ASN1] nested asn1 error (_ssl.c:4145)
Source=C:\Users\Vesna\source\repos\DiscordBot\DiscordBot\DiscordBot.py StackTrace: File "C:\Users\Vesna\source\repos\DiscordBot\DiscordBot\DiscordBot.py", line 10, in client.run('NzcxMDIxMjQyNDk2MzE5NTQ4.X5mDfQ.chrdyrxO6OBcQOPRKTIhw05eeAc')

Upvotes: 0

Views: 1492

Answers (1)

Mark Brown
Mark Brown

Reputation: 914

That nested asn1 error (_ssl.c:4145) indicates there is an issue communicating with the server. More than likely, you have a bad CA Root certificate.

  1. Go to start, type internet explorer. Run as admin.
  2. Go to discord.com click on the padlock icon.
  3. Click view certificates
  4. Click install certificates, choose either user or local machine.
  5. Click Place all certificates in the following store
  6. Choose Trusted Root Certification Authorities

You may also inspect the certificate chain with: openssl s_client -showcerts -connect discordapp.com:443

You may also want to regenerate that bot token within the Discord Application interface, as sharing it could allow others to use your bot.

Upvotes: 1

Related Questions