From 92a040fbd61a351885f1343b880d4af14142a982 Mon Sep 17 00:00:00 2001 From: Cat++ <69035887+NotGhex@users.noreply.github.com> Date: Sat, 18 Nov 2023 10:18:39 +0800 Subject: [PATCH] shorten method name --- example/modules/Utils/AddCommandHalts.js | 2 +- .../preconditions/CommandPermissionsPrecondition.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/example/modules/Utils/AddCommandHalts.js b/example/modules/Utils/AddCommandHalts.js index 402bddda..9e96d953 100644 --- a/example/modules/Utils/AddCommandHalts.js +++ b/example/modules/Utils/AddCommandHalts.js @@ -90,7 +90,7 @@ export default { createResponse(replyOptions); return true; case CommandHaltReason.PreconditionTrigger: - if (CommandPermissionsPrecondition.isCommandPermissionsPreconditionTriggerData(haltData.data)) { + if (CommandPermissionsPrecondition.isPermissionsPreconditionData(haltData.data)) { preconditionSwitch: switch (haltData.data.data?.type) { case CommandPermissionsPreconditionTriggerDataType.BotNotAllowed: return true; case CommandPermissionsPreconditionTriggerDataType.ClientNotEnoughPermissions: diff --git a/packages/core/src/classes/preconditions/CommandPermissionsPrecondition.ts b/packages/core/src/classes/preconditions/CommandPermissionsPrecondition.ts index 5b41cc5a..9f30cf4b 100644 --- a/packages/core/src/classes/preconditions/CommandPermissionsPrecondition.ts +++ b/packages/core/src/classes/preconditions/CommandPermissionsPrecondition.ts @@ -118,7 +118,14 @@ export class CommandPermissionsPrecondition extends CommandPrecondition { return new PermissionsBitField(permissions?.missing(requiredPermissions)); } + /** + * @deprecated Use `isPermissionsPreconditionData` instead + */ public static isCommandPermissionsPreconditionTriggerData(data: unknown): data is CommandPermissionsPreconditionTriggerData { + return this.isPermissionsPreconditionData(data); + } + + public static isPermissionsPreconditionData(data: unknown): data is CommandPermissionsPreconditionTriggerData { return ((data as CommandPermissionsPreconditionTriggerData).precondition instanceof CommandPermissionsPrecondition); }