Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

154
Views
Error Message of " throw new ERR_INVALID_ARG_TYPE(name, 'Function', value); "

So I was working on my discord.js v13, but I got this error message on my console:

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

This is the code of messageCrete.js:

const { messageEmbed, Collection } = require('discord.js');
const client = require('..');
const config = require('../config.json');
const prefix = config.prefix;

//messageCreate events
client.on("messageCreate"), async (message) => {
    if(!message.author.bot) return;
    if(!message.content.startsWith(prefix)) return;
    if(!message.guild) return;
    if(!message.member) message.member = await message.guild.fetchMember(message);
    const args = message.content.slice(prefix.length).trim().split(/ +/g);
    const cmd = args.shift().toLowerCase();
    if(cmd.length === 0 ) return;
    let command = client.commands.get(cmd);
    if(!command) command = client.commands.get(client.aliases.get(cmd));
    command.run(client, message, args);
}
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Try using this instead:

client.on("messageCreate", async (message) => {
// code here
});
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!