discord.js get message content code example

Example 1: how to send a message discord.js

message.reply("message here");
message.channel.send("message here");

Example 2: discord.js get the message before

message.channel.fetchMessages({limit: 2})
.then(messageMappings => {
let messages = Array.from(messageMappings.values());
let previousMessage = messages[1];
// do something with previous message
})
.catch(error => console.log(error))

Example 3: send a message using discord.js

message.channel.send("test")

Example 4: discord js message

client.on("message", message => {
    if (message.content.toLowerCase() === 'Hello') {
        message.channel.send("**Hey! What's Up?**")
    }
})
// This Will Print "Hey! What's Up?" When Someone Says "Hello" //

Tags:

Misc Example