Skip to content

Commit 3d6522e

Browse files
authored
Merge pull request #36 from m1-dev/master
Deprecation warning for commands using guildOnly
2 parents 9bb4bd8 + a5de7e4 commit 3d6522e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

packages/commandkit/src/handlers/command-handler/CommandHandler.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ export class CommandHandler {
146146
commandObj.category = commandCategory;
147147
}
148148

149+
if (commandObj.options?.guildOnly) {
150+
console.log(
151+
colors.yellow(
152+
`ℹ️ Deprecation warning: The command "${commandObj.data.name}" uses "options.guildOnly", which will be deprecated soon. Use "data.dm_permission" instead.`,
153+
),
154+
);
155+
}
156+
149157
this.#data.commands.push(commandObj);
150158
}
151159
}

packages/commandkit/tests/src/commands/misc/ping.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,7 @@ export async function run({ interaction, client }: SlashCommandProps) {
7474

7575
export const options: CommandOptions = {
7676
devOnly: true,
77+
78+
// Test deprecation warning.
79+
guildOnly: true,
7780
};

0 commit comments

Comments
 (0)