Discord API error [50035] : invalid form body
heres the code of slash command
code of one of my slash command
// Slash
const slashcommands = [];
readdirSync("./src/commands/slash").forEach(async (file) => {
const command = require(`./src/commands/slash/${file}`);
slashcommands.push(JSON.stringify(command.data))
client.slashcommands.set(command.data.name, command);
});// Slash
const slashcommands = [];
readdirSync("./src/commands/slash").forEach(async (file) => {
const command = require(`./src/commands/slash/${file}`);
slashcommands.push(JSON.stringify(command.data))
client.slashcommands.set(command.data.name, command);
});code of one of my slash command
const { SlashCommandBuilder } = require("@discordjs/builders");
const { EmbedBuilder } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("ping")
.setDescription("Pong!"),
run: async (client, interaction) => {
const startTime = Date.now();
const reply = await interaction.reply({ content: "Pinging...", ephemeral: true });
const endTime = Date.now();
const ping = endTime - startTime;
const embed = new EmbedBuilder()
.setTitle("Pong! š")
.setDescription(`Bot latency: ${ping}ms\nAPI latency: ${client.ws.ping}ms`)
.setColor("#00ff00");
reply.edit({ content: "\u200B", embeds: [embed], ephemeral: true });
},
};const { SlashCommandBuilder } = require("@discordjs/builders");
const { EmbedBuilder } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("ping")
.setDescription("Pong!"),
run: async (client, interaction) => {
const startTime = Date.now();
const reply = await interaction.reply({ content: "Pinging...", ephemeral: true });
const endTime = Date.now();
const ping = endTime - startTime;
const embed = new EmbedBuilder()
.setTitle("Pong! š")
.setDescription(`Bot latency: ${ping}ms\nAPI latency: ${client.ws.ping}ms`)
.setColor("#00ff00");
reply.edit({ content: "\u200B", embeds: [embed], ephemeral: true });
},
};
