Ошибка, которую я получаю: (Я также получаю ту же ошибку с 'startWith').Я не совсем уверен, что я делаю неправильно, я не совсем профессионал во всем этом, поэтому мне нужна помощь.Спасибо
TypeError: Cannot read property 'id' of undefined
at module.exports.message (/root/dvstin.xyz/events/message.js:6:21)
at Client.client.on.args (/root/dvstin.xyz/druggy2.js:14:39)
at Client.emit (events.js:187:15)
at MessageCreateHandler.handle (/root/dvstin.xyz/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/root/dvstin.xyz/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (/root/dvstin.xyz/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/root/dvstin.xyz/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/root/dvstin.xyz/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:182:13)
at Receiver._receiver.onmessage (/root/dvstin.xyz/node_modules/ws/lib/websocket.js:137:47)
Это код, который я использую:
module.exports = message => {
// Define client
const Discord = require("discord.js");
const client = message.client;
// Check who, and the prefix being used
if (message.author.id === "") return;
if (!message.content.startsWith(client.settings.prefix)) return;
// Define command
const command = message.content
.split(" ")[0]
.slice(client.settings.prefix.length)
.toLowerCase();
// Define command paramaters
const params = message.content.split(" ").slice(1);
let cmd;
if (client.commands.has(command)) {
cmd = client.commands.get(command);
}
// If command, run that command
if (cmd) {
cmd.run(client, message, params);
}
};