6 Replies
- 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!code:
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
restTimeOffset: 0,
});
client.on('ready', () => {
console.log(
Logged in as ${client.user.tag}
);
});
client.on('interactionCreate', (interaction) => {
if (!interaction.isCommand()) return;
const { commandName } = interaction;
if (commandName === 'ping') {
interaction.reply('Pong!');
}
});What do you mean by not work, did you register it?
wym?
it don't show
it shows the bot has 0 commands
let me try
like this?
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
restTimeOffset: 0,
});
client.on('ready', () => {
console.log(
Logged in as ${client.user.tag}
);
});
client.on('interactionCreate', (interaction) => {
if (!interaction.isCommand()) return;
const { commandName } = interaction;
if (commandName === 'ping') {
interaction.reply('Pong!');
}
});
client.login(');
const object = {
"clientId": "1168826476133634138",
"guildId": "1168121439199707176"
};