'Discord.JS bot not replying to commands nor returning a error in console regarding it

I've been struggling to get my new Discord bot's command handler to work, While it is seeing the command files (as indicated by its log entry on startup stating the amount of commands it has loaded) it either isn't sending the messages, or it isn't even executing them.

Here's my code:

const { Client, Intents, Collection } = require('discord.js');
const { token, ownerid, statuses, embedColors, prefix } = require('./cfg/config.json');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
const fs = require('fs');
const { config } = require('process');
client.commands = new Collection();
const commands = [];
const cmdfiles = fs.readdirSync('./cmds').filter(file => file.endsWith('.js'));
client.once('ready', () => {
    console.clear
    console.log(`Ready to go, Found ${cmdfiles.length} commands and ${statuses.length} statuses!`)
    setInterval(() => {
        var status = Math.floor(Math.random() * (statuses.length -1) +1)
        client.user.setActivity(statuses[status]);
}, 20000)
}),
client.on("error", (e) => console.log(error(e)));
client.on("warn", (e) => console.log(warn(e)));
// Command Handler
    for (const file of cmdfiles) {
        const command = require(`./cmds/${file}`);
        commands.push(command.data);
    }
client.on('messageCreate', message => {
    if (!message.content.startsWith(prefix) || message.author.bot) return;
    const args = message.content.slice(prefix.length).trim().split(/ +/);
    const command = args.shift().toLowerCase();

    if (!client.commands.has(command)) {
        embeds: [{
            title: ":x: Oopsie!",
            color: config.embedColors.red,
            description: `Command ${args.[0]} doesn't exist! Run ${config.prefix}help to see the avaliable commands!`,
            footer: app.config.footer + " Something went wrong! :("
        }];
    } else {
        try {
            client.commands.get(command).execute(message, args);
        } catch (error) {
            console.error(error);
            embeds: [{
                title: ":x: Oopsie!",
                description: "Command execution failed",
                fields: [
                { name: "Error Message", value: `${e.message}` }
                ],
                footer: app.config.footer + " Something went wrong :("
            }];
        }
        message.channel.send
    }});
client.login(token);

and the test command is

module.exports = {
    name: "test",
    description: "does as it implies, dingusA",
    async execute(client, message, args) {
        message.channel.send("This is a message!");
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source