How do i make commands

const {Client, Events, GatewayIntentBits} = require('discord.js');


const client = new Client({intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages]});




client.on(Events.ClientReady, () => {
console.log(`Logged in as ${client.user.tag}!`);
});

client.on(Events.MessageCreate, (message) => {
if (message.content === 'ping') {
message.reply('pong');
}});

client.login("Token")
const {Client, Events, GatewayIntentBits} = require('discord.js');


const client = new Client({intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages]});




client.on(Events.ClientReady, () => {
console.log(`Logged in as ${client.user.tag}!`);
});

client.on(Events.MessageCreate, (message) => {
if (message.content === 'ping') {
message.reply('pong');
}});

client.login("Token")
its not workign rn and where do i put the prefix
2 Replies
d.js toolkit
d.js toolkit17mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
d.js docs
d.js docs17mo ago
Tag suggestion for @dylans: If you aren't getting content, embeds or attachments of a message, make sure you have the MessageContent intent enabled in the Developer Portal and provide it to your client:
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
});
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
});
Want results from more Discord servers?
Add your server