PS C:\Users\riker\OneDrive\Documents\Discord Assets\Codex Studios\Discord Bot (2)> node . Loaded 7 commands Loaded 1 buttons Loaded 0 dropdowns Loaded 3 modals Loaded 3 events! Started refreshing application (/) commands. Successfully reloaded application (/) commands. Logging in... C:\Users\riker\OneDrive\Documents\Discord Assets\Codex Studios\Discord Bot (2)\node_modules\@discordjs\rest\dist\index.js:727 throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData); ^ DiscordAPIError[50240]: You cannot remove this app's Entry Point command in a bulk update operation. Please include the Entry Point command in your update request or delete it separately. at handleErrors (C:\Users\riker\OneDrive\Documents\Discord Assets\Codex Studios\Discord Bot (2)\node_modules\@discordjs\rest\dist\index.js:727:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SequentialHandler.runRequest (C:\Users\riker\OneDrive\Documents\Discord Assets\Codex Studios\Discord Bot (2)\node_modules\@discordjs\rest\dist\index.js:1128:23) at async SequentialHandler.queueRequest (C:\Users\riker\OneDrive\Documents\Discord Assets\Codex Studios\Discord Bot (2)\node_modules\@discordjs\rest\dist\index.js:959:14) at async _REST.request (C:\Users\riker\OneDrive\Documents\Discord Assets\Codex Studios\Discord Bot (2)\node_modules\@discordjs\rest\dist\index.js:1272:22) { requestBody: { files: undefined, json: [ { options: [], name: 'embedbuilder', name_localizations: undefined, description: 'Embed Builder using modals', description_localizations: undefined, contexts: undefined, default_permission: undefined, default_member_permissions: '8', dm_permission: false, integration_types: undefined, nsfw: undefined, type: 1 }, { options: [], name: 'purge', name_localizations: undefined, description: 'Delete a certain number of messages', description_localizations: undefined, contexts: undefined, default_permission: undefined, default_member_permissions: undefined, dm_permission: false, integration_types: undefined, nsfw: undefined, type: 1 }, { options: [], name: 'say', name_localizations: undefined, description: 'Say something!', description_localizations: undefined, contexts: undefined, default_permission: undefined, default_member_permissions: undefined, dm_permission: false, integration_types: undefined, nsfw: undefined, type: 1 }, { options: [ { name: 'mod', name_localizations: undefined, description: 'The user applying for a staff position', description_localizations: undefined, required: false, type: 6 } ], name: 'apply', name_localizations: undefined, description: 'Apply for staff positions', description_localizations: undefined, contexts: undefined, default_permission: undefined, default_member_permissions: undefined, dm_permission: false, integration_types: undefined, nsfw: undefined, type: 1 }, { options: [], name: 'population', name_localizations: undefined, description: 'Displays the server population', description_localizations: undefined, contexts: undefined, default_permission: undefined, default_member_permissions: undefined, dm_permission: false, integration_types: undefined, nsfw: undefined, type: 1 }, { options: [], name: 'poke', name_localizations: undefined, description: 'Poke the bot!', description_localizations: undefined, contexts: undefined, default_permission: undefined, default_member_permissions: undefined, dm_permission: false, integration_types: undefined, nsfw: undefined, type: 1 }, { options: [], name: 'stats', name_localizations: undefined, description: 'Displays the server data', description_localizations: undefined, contexts: undefined, default_permission: undefined, default_member_permissions: undefined, dm_permission: false, integration_types: undefined, nsfw: undefined, type: 1 } ] }, rawError: { message: "You cannot remove this app's Entry Point command in a bulk update operation. Please include the Entry Point command in your update request or delete it separately.", code: 50240 }, code: 50240, status: 400, method: 'PUT', url: 'https://discord.com/api/v10/applications/1288870448712650914/commands' } Node.js v20.17.0 register commands.js const { REST } = require('@discordjs/rest'); const { Routes } = require('discord-api-types/v10'); module.exports = (client) => { console.log('Started refreshing application (/) commands.'); // Just buckets for everything lol const commands = []; const devCommands = []; const commandNames = []; // loop through each command in the client.commands cache for (const [_, command] of client.commands) { // Attempt to parse the command data const commandData = command.data?.toJSON(); commandData.dm_permission ??= false; // dms disabled by default try { if (!commandData) throw `No command.data found - Did you forget to save the file?`; // If the command is already registered, skip it if (commandNames.includes(commandData?.name)) continue; // Add the command name to the list so we can check for duplicates commandNames.push(commandData.name); // Add it to the respective bucket for processing if (command.dev) { devCommands.push(commandData); } else { commands.push(commandData); } } catch(error) { console.error(`[REGISTER] Failed to register ${command.data.name}: ${error}`); } } // Error if you set a dev command but no guild ID // Nothing will break but it won't register the commands if (devCommands.length > 0 && !client.config.ServerID) { console.warn(`You have dev commands but no ServerID in config.json - These will not be registered!`); } const rest = new REST({ version: '10' }).setToken(client.config.Token); try { // public commands rest.put( Routes.applicationCommands(client.config.AppID), { body: commands }, ); // Only do this if there is a guild id set if (typeof client.config.ServerID === 'string') { // dev commands rest.put( Routes.applicationGuildCommands(client.config.AppID, client.config.ServerID), { body: devCommands }, ); } console.info('Successfully reloaded application (/) commands.'); } catch (error) { console.error(error); } } index.js const { Client, PermissionsBitField } = require('discord.js'); const mongoose = require('mongoose'); const client = new Client({ intents: [ 'Guilds', 'GuildMembers', 'GuildMessages', 'GuildMessageReactions', 'MessageContent', 'DirectMessages', 'GuildPresences' ] }); client.config = require('./config.json'); client.cooldowns = new Map(); client.cache = new Map(); // Each of these exports a function, it's the same as doing // const ComponentLoader = require('./utils/ComponentLoader.js'); // ComponentLoader(client); require('./utils/ComponentLoader.js')(client); require('./utils/EventLoader.js')(client); require('./utils/RegisterCommands.js')(client); ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // Here we connect to the database // It has been moved outside of the ready event so we don't have to wait on discord // [Application startup] -> [client.login()] -> [Discord responds] -> [Ready event] -> [Database connection] // // This way we can connect to the database while waiting for discord to respond // [Application startup] -> [Database connection] -> [client.login()] -> [Discord responds] -> [Ready event] ///////////////////////////////////////////////////////////////////////////////////////////////////////////// ( async function() { if (!client.config.MongoDB) return console.warn('MongoDB URL is not provided in the config.json file, skipping database connection...'); await mongoose.connect(client.config.MongoDB); })(); console.log(`Logging in...`); client.login(client.config.Token); client.on('ready', function () { console.log(`Logged in as ${client.user.tag}!`); require('./utils/CheckIntents.js')(client); }); client.on('messageCreate', () => {} ) async function InteractionHandler(interaction, type) { const component = client[type].get( interaction.customId ?? interaction.commandName ); if (!component) { // console.error(`${type} not found: ${interaction.customId ?? interaction.commandName}`); return; } try { //command properties if (component.admin) { if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) return await interaction.reply({ content: `⚠️ Only administrators can use this command!`, ephemeral: true }); } if (component.owner) { if (interaction.user.id !== '970983906776088596') return await interaction.reply({ content: `⚠️ Only bot owners can use this command!`, ephemeral: true }); } //the mod command property requires additional setup, watch the video here to set it up: https://youtu.be/2Tqy6Cp_10I?si=bharHI_Vw7qjaG2Q /* COMMAND PROPERTIES: module.exports = { admin: true, data: new SlashCommandBuilder() .setName('test') .setDescription('test'), async execute(interaction) { } } You can use command properties in the module.exports statement by adding a valid property to : true, VALID PROPERTIES: admin : true/false owner : true/false dev: true/false You can add more command properties by following the prompt below and pasting it above in location with all the other statements: if (component.propertyname) { if (logic statement logic) return await interaction.reply({ content: `⚠️ response to flag`, ephemeral: true }); } */ await component.execute(interaction, client); } catch (error) { console.error(error); // If there is already a response, say after a deferReply(), we override the response with an error message. await interaction.deferReply({ ephemeral: true }).catch( () => {} ); await interaction.editReply({ content: `There was an error while executing this command!\n\`\`\`${error}\`\`\``, embeds: [], components: [], files: [] }).catch( () => {} ); } } //////////////////////////////////////////////////////////////// // These are all the entry points for the interactionCreate event. // This will run before any command processing, perfect for logs! //////////////////////////////////////////////////////////////// client.on('interactionCreate', async function(interaction) { if (!interaction.isCommand()) return; await InteractionHandler(interaction, 'commands'); }); client.on('interactionCreate', async function(interaction) { if (!interaction.isButton()) return; await InteractionHandler(interaction, 'buttons'); }); client.on('interactionCreate', async function(interaction) { if (!interaction.isStringSelectMenu()) return; await InteractionHandler(interaction, 'dropdowns'); }); client.on('interactionCreate', async function(interaction) { if (!interaction.isModalSubmit()) return; await InteractionHandler(interaction, 'modals'); });