a
This commit is contained in:
parent
5d0dff688a
commit
75d5c26559
|
@ -68,14 +68,21 @@ class CommandBase {
|
||||||
toJSON() {
|
toJSON() {
|
||||||
const builder = new SlashCommandBuilder()
|
const builder = new SlashCommandBuilder()
|
||||||
.setName(this.name)
|
.setName(this.name)
|
||||||
.setDescription(this.description);
|
.setDescription(this.description)
|
||||||
|
.setDMPermission(true); // Allow commands in DMs
|
||||||
|
|
||||||
// Add options if defined in the child class
|
// Add options if defined in the child class
|
||||||
if (typeof this.addOptions === 'function') {
|
if (typeof this.addOptions === 'function') {
|
||||||
this.addOptions(builder);
|
this.addOptions(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.toJSON();
|
// Get the JSON representation
|
||||||
|
const json = builder.toJSON();
|
||||||
|
|
||||||
|
// Add contexts to make commands available everywhere
|
||||||
|
json.contexts = [0, 1, 2]; // Available in all contexts (DM, GROUP_DM, GUILD)
|
||||||
|
|
||||||
|
return json;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue