how to fix my ping command not work

idk what to put here
6 Replies
d.js toolkit
d.js toolkit14mo 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!
Zacks <3
Zacks <3OP14mo ago
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!'); } });
Danial
Danial14mo ago
What do you mean by not work, did you register it?
Zacks <3
Zacks <3OP14mo ago
wym? it don't show it shows the bot has 0 commands
d.js docs
d.js docs14mo ago
guide Creating Your Bot: Registering slash commands read more
Zacks <3
Zacks <3OP14mo ago
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" };
Want results from more Discord servers?
Add your server