Reputation: 1
I am relatively new to discord bots but I cant for the life of me figure out why I keep getting this error - I have tried to replace message with message creat but it doesn't seem to work at all. Here is my code:
client.on('message', (message) => {
if(message.author.client) return;
if(message.channel.type !== 'text') return;
let prefix = '!';
let MessageArray = message.content.split(' ');
let cmd = MessageArray(0).slice(prefix.length)
let args = MessageArray.slice(1)
if(!message.content.startsWith(prefix)) return;
if(cmd == 'hello') {
message.channel.send({ messages: ['hello'] });
})
Upvotes: 0
Views: 2948
Reputation: 6625
The message
event has been renamed to messageCreate
. Using message
will still work, but you'll receive a deprecation warning until you switch over.
client.on("messageCreate", (message) => {
if (message.author.client) return;
if (message.channel.type !== "text") return;
let prefix = "!";
let MessageArray = message.content.split(" ");
let cmd = MessageArray(0).slice(prefix.length);
let args = MessageArray.slice(1);
if (!message.content.startsWith(prefix)) return;
if (cmd == "hello") {
message.channel.send({ messages: ["hello"] });
}
});
Upvotes: 4