UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

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