Install the Node.js Javascript framework. If you are on Windows, use the link below:
For Linux, check if node is already installed:
node --version
If not, install with apt-get or dnf accordingly:
Debian/Ubuntu
sudo apt-get install node
CentOS/Fedora
sudo dnf -y install node
sudo dnf -y install python
npm install -y discord.js
const { Client, Intents } = require('discord.js')
const client = new Client({intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]})
client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`)
})
client.on("messageCreate", msg => ({
console.log(`Message from ${msg.author}: ${msg.content}`)
})
client.login('bot-token')