Ping not working

Code:

const { SlashCommandBuilder } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('Get the ping to discord'),
    async execute(client, interaction) {
        interaction.followUp(`Ping to discord :- ${Math.round(client.ws.ping)}ms`);
    },
};


The error:
Error executing ping
TypeError: Cannot read properties of undefined (reading 'followUp')
    at Object.execute (C:\Users\awash\Downloads\all mod\commands\ping.js:9:15)
    at Object.execute (C:\Users\awash\Downloads\all mod\events\interactionCreate.js:16:18)
    at Client.<anonymous> (C:\Users\awash\Downloads\all mod\index.js:38:44)
    at Client.emit (node:events:513:28)
    at InteractionCreateAction.handle (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
    at module.exports [as INTERACTION_CREATE] (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
    at WebSocketShard.onPacket (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\websocket\WebSocketShard.js:489:22)
    at WebSocketShard.onMessage (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\websocket\WebSocketShard.js:328:10)
    at callListener (C:\Users\awash\Downloads\all mod\node_modules\ws\lib\event-target.js:290:14)


node = v18.13.0
djs = 14.7.1
Was this page helpful?