@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
32 lines (29 loc) • 1.62 kB
JavaScript
;
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 Reflect.get(message.channel, "nsfw") === true ? this.ok() : this.error({ identifier: Identifiers_cjs.Identifiers.PreconditionNSFW, message: "You cannot run this message command outside NSFW channels." });
}
async chatInputRun(interaction) {
const channel = await this.fetchChannelFromInteraction(interaction);
return Reflect.get(channel, "nsfw") === true ? this.ok() : this.error({ identifier: Identifiers_cjs.Identifiers.PreconditionNSFW, message: "You cannot run this chat input command outside NSFW channels." });
}
async contextMenuRun(interaction) {
const channel = await this.fetchChannelFromInteraction(interaction);
return Reflect.get(channel, "nsfw") === true ? this.ok() : this.error({ identifier: Identifiers_cjs.Identifiers.PreconditionNSFW, message: "You cannot run this command outside NSFW channels." });
}
};
__name(_CorePrecondition, "CorePrecondition");
var CorePrecondition = _CorePrecondition;
void pieces.container.stores.loadPiece({
name: "NSFW",
piece: CorePrecondition,
store: "preconditions"
});
exports.CorePrecondition = CorePrecondition;
//# sourceMappingURL=NSFW.cjs.map
//# sourceMappingURL=NSFW.cjs.map