Cannot read properties of undefined (reading 'reply')

I want to create a latency (ping) command, but I got an error message like this : Cannot read properties of undefined (reading 'reply'). How to fix this problem?
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('latency')
.setDescription('Checking the Roundtrip Latency & WebSocket connection in miliseconds'),
async execute(client, interaction) {
const sent = await interaction.reply({ content: 'Measuring...', fetchReply: true });
interaction.editReply(`\`Client: ${sent.createdTimestamp - interaction.createdTimestamp}\` ms | WebSocket: ${client.ws.ping}`);
}
};
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('latency')
.setDescription('Checking the Roundtrip Latency & WebSocket connection in miliseconds'),
async execute(client, interaction) {
const sent = await interaction.reply({ content: 'Measuring...', fetchReply: true });
interaction.editReply(`\`Client: ${sent.createdTimestamp - interaction.createdTimestamp}\` ms | WebSocket: ${client.ws.ping}`);
}
};
3 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Syjalo
Syjalo2y ago
console.log(client.constructor.name)
Catharsis
CatharsisOP2y ago
thank you very much!
Want results from more Discord servers?
Add your server