Skip to content

Instantly share code, notes, and snippets.

@Neodevils
Last active February 7, 2025 15:31
Show Gist options
  • Save Neodevils/d91b14f85bba17ca2f0a92fd770ae229 to your computer and use it in GitHub Desktop.
Save Neodevils/d91b14f85bba17ca2f0a92fd770ae229 to your computer and use it in GitHub Desktop.
This is a code for fixing activity entry point error. It fetches commands from API and lets you delete it manually. Which you will get your launch command is ID and delete it manually so you won't have any error message on console.
/*
Author: @neodevils
Feel free to share it for others to don't deal with this issue when launching their activity on bot!
*/
import { REST } from "@discordjs/rest";
import { Routes } from "discord-api-types/v10";
import { CLIENT_ID, TOKEN } from "./config.js";
// Replace these with your actual values or fetch it from your config.js/json file
const token = TOKEN;
const clientId = CLIENT_ID;
// const guildId = "YOUR_GUILD_ID"; Optional, for guild-specific commands
const rest = new REST({ version: "10" }).setToken(token);
async function fetchCommands() {
try {
console.log("Fetching global commands...");
const globalCommands = await rest.get(
Routes.applicationCommands(clientId)
);
console.log("Global Commands:", globalCommands);
console.log("Fetching guild commands...");
/* const guildCommands = await rest.get(
Routes.applicationGuildCommands(clientId, guildId)
);
console.log("Guild Commands:", guildCommands);
*/
console.log("\nList of Commands:");
// Or you can use [...globalCommands, ...guildCommands]
[...globalCommands].forEach((cmd) => {
console.log(
`- Name: ${cmd.name}, ID: ${cmd.id}, Type: ${cmd.type}`
);
});
// The command is ID to delete
// - Name: launch, ID: ********************, Type: 4
const commandIdToDelete = "LAUNCH_COMMAND_ID";
await rest.delete(
Routes.applicationCommand(clientId, commandIdToDelete)
);
console.log(
`Successfully deleted command with ID: ${commandIdToDelete}`
);
} catch (error) {
console.error("Error fetching commands:", error);
}
}
fetchCommands();

Error message

image

After running the code

image image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment