Hey everyone,
Just to clarify before you read the rest of this post, I myself do not require any help, im just giving some help for the ones who are willing to try it instead of complaining,
Im aware of the meaning of the status codes and im aware of the watch.json and vice versa. Please if you are here just to hate on me, complain or try to help me, do not comment as i do not want to waste my time replying to comments that arent relevant to helping others, that instead try to help me
Lately alot of my discord bots just would not want to connect and it has been bothering me a bit.
But i found a solution to this problem and this may help you guys out too.
If your bot doesnt connect, gives a 429 status code or just returns a something took too look error you should do the following
either remix this extremely basic base project and create a bot in it:
https://glitch.com/edit/#!/fftr
or
after importing the Client from the discord.js module and creating a new client i.e:
const {Client} = require("discord.js");
const bot = new Client();
just add this simple line
bot.options.http.api = "https://discord.com/api"
You should end up with something like the following:
const {Client} = require("discord.js");
const bot = new Client();
bot.options.http.api = "https://discord.com/api"
ofcourse make sure that if you have a different variable name to change it, in my case its bot.
This seemed to fix the issue, many of you might have noticed that discord recently switched their domain from https://discordapp.com
to just https://discord.com
and that seems to cause the issue. By changing the api url inside the discord.js Client we can get the bot up and running.
If you check the documentation over at discord you can see that the base url is now only discord.com instead of discordapp.com
If it does not work for you, i’m sorry but i do not know what to do.
Peace