Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

discord js on message

const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });

client.on("messageCreate", (message) => {
  if (message.author.bot) return false; 
  
  console.log(`Message from ${message.author.username}: ${message.content}`);
});

client.login(process.env.BOT_TOKEN);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #discord #js #message
ADD COMMENT
Topic
Name
8+6 =