UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

38 lines (35 loc) 1.43 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.thread ? this.ok() : this.makeSharedError(); } async chatInputRun(interaction) { const channel = await this.fetchChannelFromInteraction(interaction); return channel.isThread() ? this.ok() : this.makeSharedError(); } async contextMenuRun(interaction) { const channel = await this.fetchChannelFromInteraction(interaction); return channel.isThread() ? this.ok() : this.makeSharedError(); } makeSharedError() { return this.error({ identifier: Identifiers_cjs.Identifiers.PreconditionThreadOnly, message: "You can only run this command in server thread channels." }); } }; __name(_CorePrecondition, "CorePrecondition"); var CorePrecondition = _CorePrecondition; void pieces.container.stores.loadPiece({ name: "GuildThreadOnly", piece: CorePrecondition, store: "preconditions" }); exports.CorePrecondition = CorePrecondition; //# sourceMappingURL=GuildThreadOnly.cjs.map //# sourceMappingURL=GuildThreadOnly.cjs.map