Starting to think this truly is a .split() error, it applies to all of my commands, with or without arguments. Thought I had found a solution but it was not it. Here's a simple ping command:

Here's my index.js:
const fs = require('fs');
const Discord = require('discord.js');
const { prefix, token } = require('./config.json');
const client = new Discord.Client();
client.commands = new Discord.Collection();
const featureFiles = fs.readdirSync('./commands/features').filter(file => file.endsWith('.js'));
for (const file of featureFiles) {
const command = require(`./commands/features/${file}`);
client.commands.set(command.name, command);
}
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
//.trim() is removed, see notes below on why
const args = message.content.slice(prefix.length).split(/ +/g);
const commandName = args.shift().toLowerCase();
const command = client.commands.get(commandName)
|| client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
if (!command) return;
if (command.guildOnly && message.channel.type !== 'text') {
return message.reply('That command cannot be used inside a DM');
}
if (command.args && !args.length) {
let reply = `You didn't provide any arguments!`;
if (command.usage) {
reply += `\nThe proper usage would be: \`${prefix}${command.name} ${command.usage}\``;
}
return message.channel.send(reply);
}
try {
command.execute(message, client, args);
} catch (error) {
console.error(error);
message.channel.send('Error trying to execute command');
}});
client.login(token);
I removed .trim() as it was reading whitespaces in between the prefix and command name, which I did not want, so one could use 100 spaces between the prefix and command, and it will execute it. Here is the !ping command:
const {prefix} = require('../../config.json')
module.exports = {
name: 'ping',
description: 'Shows latency',
usage: ' ',
execute(message) {
if (message.content.startsWith(prefix + "ping")) {
var ping = Date.now() - message.createdTimestamp + " ms";
message.channel.send(`${Date.now() - message.createdTimestamp}` + " ms");
}
},
};
Any way to get rid of this problem of it still executing with other input after a space across all of my commands would be great, as I simply want it to return; past whatever args or command name I specify. I am stumped. I'm wanting to think this is caused by .split() in my index.js.
args, and if they run the command withargs, you want toreturn? - Mineko Kayuiif (args[0] === 'test') {do something}, and if someone inputs!test test arg1 arg2, it will still execute "do something" even though there's "arg1 arg2" afterwards. Practically I want it to not execute, orreturn;if there's "arg1" or so forth that's not specified in the if statement, but also throughout regular commands like the !ping example shown above. Hopefully this helps, thanks :) - gerapallo