UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

40 lines (38 loc) 1.14 kB
import { Identifiers } from "../lib/errors/Identifiers.mjs"; import { AllFlowsPrecondition } from "../lib/structures/Precondition.mjs"; import { container } from "@sapphire/pieces"; //#region src/preconditions/Enabled.ts var CorePrecondition = class extends AllFlowsPrecondition { constructor(context) { super(context, { position: 10 }); } messageRun(_, command, context) { return command.enabled ? this.ok() : this.error({ identifier: Identifiers.CommandDisabled, message: "This message command is disabled.", context }); } chatInputRun(_, command, context) { return command.enabled ? this.ok() : this.error({ identifier: Identifiers.CommandDisabled, message: "This chat input command is disabled.", context }); } contextMenuRun(_, command, context) { return command.enabled ? this.ok() : this.error({ identifier: Identifiers.CommandDisabled, message: "This context menu command is disabled.", context }); } }; container.stores.loadPiece({ name: "Enabled", piece: CorePrecondition, store: "preconditions" }); //#endregion export { CorePrecondition }; //# sourceMappingURL=Enabled.mjs.map