Typerror: args.join is not a function - error on discord.js bot

Getting the error as mentioned on the title.
My command file:

const anime = require("ctk-anime-scraper");

module.exports.run = (message, args) => {
	const query = args.join(" ");
	if(!query) return message.channel.send("Anime not specified").then(m => m.delete({ timeout: 10000 }));
	anime.search(query).then(data => {
		if(!data.length) return message.channel.send("No anime found.");
		anime.fetchAnime(data[0].link).then (d => message.channel.send(d));
	});
};

And my part of the index file which have the error (other parts are right):

client.on("message", async message => {
	// message things needed

	const prefix = ".";
	if (message.author.bot || !message.content.startsWith(prefix)) return;

	const args = message.content.slice(prefix.length).trim().split(/ +/g);
	const commandName = args.shift().toLowerCase();

	// command
	if (!client.commands.has(commandName)) return;
	const command = client.commands.get(commandName);

	try {
		command.run(client, message, args);
	}

Hello there!

Welcome to the community! Here let me explain what’s wrong with your code:

It should be (client, message, args), Not (message, args)

2 Likes

Thank you! But how does client do on this command code? On eslint, no-unused-vars warning (As I setted) will come. Should I have to disable that? I will test it.

EDIT: IT IS NOW FIXED.

Look up! ^^^^^^^

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