Я не совсем уверен, что вы спрашиваете, но у меня может быть идея, почему этот кусок кода не работает
const prefix = '-';
bot.on('message', msg => {
let args = msg.content.substring(prefix.length).split(" ");
if (message.content.indexOf(prefix) !== 0 || message.author.bot) return;
//the line above means, stop working when the message doesn't start with the prefix or is sent by a bot
switch (args[0]) {
case 'ping':
msg.channel.send('pong');
break;
}
});
Это то, что вы ищете (также было ненужный }
в какой-то момент, что, вероятно, сделает бот кр sh)