why my ping.ts doesnt wanna run after being transpiled?

So my slash command doesnt wanna execute after its been transpiled to js even though after I did run it on ts-node, it worked without any issues.
import { CommandInteraction } from 'discord.js';
import { ApplyOptions } from '@sapphire/decorators';
import { Command } from '@sapphire/framework';
import config from '../config.json';

@ApplyOptions<Command.Options>({
name: 'ping',
description: 'Replies with the bot\'s latency!',
})
export class PingCommand extends Command {
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder //
.setName(this.name)
.setDescription(this.description),
{
guildIds: [config.eden.guildId],
idHints: ['1288626547959267360']
}
);
}

public override async chatInputRun(interaction: CommandInteraction) {
const sentMessage = await interaction.reply('Pinging...');
const latency = sentMessage.createdTimestamp - interaction.createdTimestamp;
await interaction.editReply(`Pong! Latency is ${latency}ms`);
}
}
import { CommandInteraction } from 'discord.js';
import { ApplyOptions } from '@sapphire/decorators';
import { Command } from '@sapphire/framework';
import config from '../config.json';

@ApplyOptions<Command.Options>({
name: 'ping',
description: 'Replies with the bot\'s latency!',
})
export class PingCommand extends Command {
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder //
.setName(this.name)
.setDescription(this.description),
{
guildIds: [config.eden.guildId],
idHints: ['1288626547959267360']
}
);
}

public override async chatInputRun(interaction: CommandInteraction) {
const sentMessage = await interaction.reply('Pinging...');
const latency = sentMessage.createdTimestamp - interaction.createdTimestamp;
await interaction.editReply(`Pong! Latency is ${latency}ms`);
}
}
Solution:
it sounds like your passing it the ts code and not the transpiled js
Jump to solution
4 Replies
Seren_Modz 21
Seren_Modz 21•2mo ago
in your package.json, what is your main set to?
Solution
Seren_Modz 21
Seren_Modz 21•2mo ago
it sounds like your passing it the ts code and not the transpiled js
Favna
Favna•2mo ago
:this: Barring that I recommend at least making this ephemeral if you insist on the not having a ping slash commands at all (it's not really useful as a slash command)
Shrewd 💫
Shrewd 💫OP•2mo ago
Im confident I edited it to node the dist folder and yeah ive even executed node dist/bot.js Apparently my main was set to src/bot.js Ive edited everything but not this, thanks for the help, its working And it was a test slash command because I sitll wanna learn ts
Want results from more Discord servers?
Add your server