I’m getting error while making an alias system in discord.js

I was making an alias system for my discord bot, and I wanted to say: “if the user entered the wrong command name or alias then return: invalid command/alias”, but I’m getting an error:

C:UsersPooyanDesktopPDM Bot Maineventsguildmessage.js:16
                    if(!cmd || client.commands.find(a => !a.aliases && !a.aliases.includes(cmd))) return message.channel.send('Invalid command');
                                                                                  ^

TypeError: Cannot read properties of undefined (reading 'includes')
    at C:UsersPooyanDesktopPDM Bot Maineventsguildmessage.js:16:83

My code:

module.exports = async (message, client, Discord) => {
    const prefix = process.env.PREFIX;

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

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

    const command = client.commands.get(cmd) || 
                    client.commands.find(a => a.aliases && a.aliases.includes(cmd));
                    if(!cmd || client.commands.find(a => !a.aliases && !a.aliases.includes(cmd))) return message.channel.send('Invalid command');
}

I’m using discord.js v13 and Node.js v16.14.2