UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

31 lines (29 loc) 930 B
import { Identifiers } from "../lib/errors/Identifiers.mjs"; import { AllFlowsPrecondition } from "../lib/structures/Precondition.mjs"; import { container } from "@sapphire/pieces"; //#region src/preconditions/DMOnly.ts var CorePrecondition = class extends AllFlowsPrecondition { messageRun(message) { return message.guild === null ? this.ok() : this.makeSharedError(); } chatInputRun(interaction) { return interaction.guildId === null ? this.ok() : this.makeSharedError(); } contextMenuRun(interaction) { return interaction.guildId === null ? this.ok() : this.makeSharedError(); } makeSharedError() { return this.error({ identifier: Identifiers.PreconditionDMOnly, message: "You cannot run this command outside DMs." }); } }; container.stores.loadPiece({ name: "DMOnly", piece: CorePrecondition, store: "preconditions" }); //#endregion export { CorePrecondition }; //# sourceMappingURL=DMOnly.mjs.map