Discord API Error need help

I got a DiscordAPIError. (UnhandledPromiseRejectionWarning: DiscordAPIError)

After searching on internet I found 2 similar topics : one 40 mins ago but one 2 months ago (Discord API Error 6). Following to the informations on the second one I would like to know if it’s on my side or due to the same error. For sure if it’s the same error here are my project settings:

Project Name : saafpro1
Project website : https://saafpro1.glitch.me/

Thank you for any answer,

What is the error message that you received?

(node:21488) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 40)
(node:21488) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT

@ihack2712 ^^^^^^^^ this the Error

I buy a boost from glitch and i boost my project I thought The problem will be solved

Anyyyoneeee can helllp??

There is an error throw inside an async function, you need to add .catch calls after async functions

How can I add it
I don’t know anything about programming
Can you explain?

@ihack2712 please Explain, i need you to help Me

Firstly, welcome to Glitch @Alisaaf!

Secondly, by the looks of it, I assume you are very new to the javascript programming language, it looks like you’re having these issues because you don’t know how to debug javascript, I totally understand that this may be very frustrating. I’m going to say something you’re probably not gonna want to hear, but it is the best advice I can give.

Building a Discord bot is really not an easy task, there is so many different things that you have to know about javascript, and how to write good code. There is also advanced topics within discord.js like writing a command handler, interacting with databases and so on.

The best thing I can recommend is not trying to learn how to use discord.js, but how to use javascript. That means don’t try to start with a very hard task like writing a discord.js bot, but start with the easy things like writing a fizzbuzz program. When you are learning a new language there is going to be a lot of reading, doing, failing, doing again, and more failing. This is very repetitive thing when it comes to learning a new language.

I recommend you read on how to learn a new language or framework.



But i need to Run this project and i will learn
But first i need to Run this project
I just need to explain my mistake where

The mistake is that there is an async function that is throwing an error, you need to catch that error. You can look up async/await and a recent discord.js tutorial.

Anyhow, you need to understand the programming language before you try to write stuff like discord bots. For instance, you don’t move to spain and expect to get a job before you know Spanish.


I highly recommend that you learn JavaScript, this course will teach you the basics and make building anything in JavaScript whether that’s a website or something in NodeJS:

1 Like

I will try to look for the problem and soon I will learn to program
Thank you so much

1 Like