Skip to content

Commit bdb806b

Browse files
committed
update README
1 parent 26f55ce commit bdb806b

1 file changed

Lines changed: 2 additions & 43 deletions

File tree

README.md

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ npm install djs-command-deployer
1515

1616
_The `src` folder it can be any folder. Just the `commands` folder should be a subfolder of the directory your `index.js` is located in._
1717

18+
**Example:**
1819
```
1920
📂src
2021
┣ 📄index.js
@@ -94,49 +95,7 @@ There are two options to do this: Either with the command's ID or his name.
9495

9596
In this example we are building a manager-command that has StringOptions for the command and the guild id where one can paste in the ID or the name.\
9697

97-
````js
98-
const { SlashCommandBuilder } = require("discord.js");
99-
100-
module.exports = {
101-
guildIds: ["the-id-of-my-private-guild"],
102-
data: new SlashCommandBuilder()
103-
.setName("manage-commands")
104-
.setDescription("Replies with Pong!")
105-
.addStringOption((op) =>
106-
op
107-
.setName("command")
108-
.setDescription(
109-
"The command's ID or name to be removed in the given server"
110-
)
111-
)
112-
.addStringOption((op) =>
113-
op
114-
.setName("server-id")
115-
.setDescription("The server's ID to remove the command from")
116-
),
117-
118-
// The function to call whenever the command is executed (Doesnt matter when calling client.deployCommands())
119-
async run(interaction) {
120-
const serverId = ctx.options.getString("server-id");
121-
const command = ctx.options.getString("command");
122-
await interaction.deferReply({ ephemeral: true }); // Defer to remove the risk of not responding in time
123-
try {
124-
await interaction.client.deleteCommand(command, serverId);
125-
} catch (err) {
126-
console.error("Command not deleted due to", err);
127-
return await interaction.editReply({
128-
embeds: [
129-
new EmbedBuilder()
130-
.setTitle("❌ Command not deleted due to an error")
131-
.setDescription("```" + err + "```")
132-
.setColor(0xee0000),
133-
],
134-
});
135-
}
136-
await interaction.editReply("✅ Command deleted");
137-
},
138-
};
139-
````
98+
Please see [the example code](https://github.com/The-LukeZ/djs-command-deployer-tests/blob/main/commands/command.js) for the command file and the [`index.js`](https://github.com/The-LukeZ/djs-command-deployer-tests/blob/main/index.js) on how to do this in general.
14099

141100
#### `logOptions`
142101

0 commit comments

Comments
 (0)