TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined

So im making a discord bot and i am getting this error if running
TypeError [ERR_INVALID_ARG_TYPE]: The “listener” argument must be of type function. Received undefined
my code that i put in is

const Discord = require (‘discord.js’);

const client = new Discord.Client();

client.once(‘ready’,); () => {

console.log ('JorisAndCoStudiosBot is now Online!')

};

client.login(‘Bot Token’)

i know this won’t help, but replace the apostrophes ’ with quotes "
console.log ("JorisAndCoStudiosBot is now Online!")

The call to client.once is messed up, its passing in nothing (null) as a listener as the second argument.

A bit of rearranging to pass the arrow function instead

client.once(‘ready’, () => {
    console.log ('JorisAndCoStudiosBot is now Online!')
});

Doh, why did you post the same issue twice?

1 Like