Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(reloading commands): Remove command deletion in code snippet #1549

Merged
merged 2 commits into from
May 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions guide/additional-features/reloading-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ In theory, all there is to do is delete the previous command from `client.comman
delete require.cache[require.resolve(`./${command.data.name}.js`)];

try {
interaction.client.commands.delete(command.data.name);
const newCommand = require(`./${command.data.name}.js`);
interaction.client.commands.set(newCommand.data.name, newCommand);
await interaction.reply(`Command \`${newCommand.data.name}\` was reloaded!`);
Expand All @@ -69,4 +68,4 @@ The snippet above uses a `try...catch` block to load the command file and add it

## Resulting code

<ResultingCode path="additional-features/reloading-commands" />
<ResultingCode path="additional-features/reloading-commands" />