Discord.js script does not reach ready state

Hello!

I’ve been coding together a discord bot as a way of teaching myself Javascript. Recently I was trying to implement some of the slash command features provided by Discord, but one of them gave me an error that seems to have shut down my bot. It was something about the header needing to be “application/json” which I’m not entirely sure of.
This is the tutorial I was following. I basically copied and pasted code into the commands/test.js script of my bot, and then ran the !test command in my discord server. Inefficient, I know, but here we are.
So ever since I got that error, my code has been unable to fully connect to discord. In the following code snippet (from index.js in the project), the function “readyDiscord()” is never run;

process.title = "P1";
console.log("beginning");
require("dotenv").config();
const Discord = require("discord.js");
const client = new Discord.Client();
client.login(process.env.TOKEN);

client.on("ready", readyDiscord);
function readyDiscord() {
  console.log("I'm in");
}

const commandHandler = require("./commands.js");

client.on("message", msg => {
  commandHandler(msg, client);
});

I’ve tried refreshing the project from the terminal, I’ve regenerated my bot token, the debugger didn’t show me anything useful but a handful of warnings about files not found from node modules, nothing has worked. What next?

Link to project code

Never mind, this issue has resolved itself over night.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.