UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

36 lines (33 loc) 1.26 kB
'use strict'; var pieces = require('@sapphire/pieces'); var Identifiers_cjs = require('../lib/errors/Identifiers.cjs'); var Precondition_cjs = require('../lib/structures/Precondition.cjs'); var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var _CorePrecondition = class _CorePrecondition extends Precondition_cjs.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_cjs.Identifiers.PreconditionGuildOnly, message: "You cannot run this command in DMs." }); } }; __name(_CorePrecondition, "CorePrecondition"); var CorePrecondition = _CorePrecondition; void pieces.container.stores.loadPiece({ name: "GuildOnly", piece: CorePrecondition, store: "preconditions" }); exports.CorePrecondition = CorePrecondition; //# sourceMappingURL=GuildOnly.cjs.map //# sourceMappingURL=GuildOnly.cjs.map