From 75d5c2655933275d6beb27e0d2a4916fda702842 Mon Sep 17 00:00:00 2001 From: Xargana Date: Sun, 27 Apr 2025 21:32:27 +0300 Subject: [PATCH] a --- discord/classes/CommandBase.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/discord/classes/CommandBase.js b/discord/classes/CommandBase.js index 03aab87..d220791 100644 --- a/discord/classes/CommandBase.js +++ b/discord/classes/CommandBase.js @@ -68,14 +68,21 @@ class CommandBase { toJSON() { const builder = new SlashCommandBuilder() .setName(this.name) - .setDescription(this.description); + .setDescription(this.description) + .setDMPermission(true); // Allow commands in DMs // Add options if defined in the child class if (typeof this.addOptions === 'function') { 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; } }