Skip to content

Commit

Permalink
Merge pull request #36 from m1-dev/master
Browse files Browse the repository at this point in the history
Deprecation warning for commands using guildOnly
  • Loading branch information
notunderctrl authored Dec 9, 2023
2 parents 9bb4bd8 + a5de7e4 commit 3d6522e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ export class CommandHandler {
commandObj.category = commandCategory;
}

if (commandObj.options?.guildOnly) {
console.log(
colors.yellow(
`ℹ️ Deprecation warning: The command "${commandObj.data.name}" uses "options.guildOnly", which will be deprecated soon. Use "data.dm_permission" instead.`,
),
);
}

this.#data.commands.push(commandObj);
}
}
Expand Down
3 changes: 3 additions & 0 deletions packages/commandkit/tests/src/commands/misc/ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,7 @@ export async function run({ interaction, client }: SlashCommandProps) {

export const options: CommandOptions = {
devOnly: true,

// Test deprecation warning.
guildOnly: true,
};

0 comments on commit 3d6522e

Please sign in to comment.