xxxxxxxxxx
// Import the required libraries
const Discord = require('discord.js');
const client = new Discord.Client();
// Bot token (replace with your own)
const token = 'YOUR_DISCORD_BOT_TOKEN';
// Event triggered when the bot is ready
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}`);
});
// Event triggered when a message is received
client.on('message', (message) => {
// Check if the message content is 'red'
if (message.content.toLowerCase() === 'red') {
// Send a response in the channel where the message was received
message.channel.send('The color red!');
}
});
// Log in to Discord using the bot token
client.login(token);