@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
37 lines (35 loc) • 1.52 kB
JavaScript
;
const require_lib_errors_Identifiers = require('../lib/errors/Identifiers.cjs');
const require_lib_structures_Precondition = require('../lib/structures/Precondition.cjs');
let __sapphire_pieces = require("@sapphire/pieces");
//#region src/preconditions/NSFW.ts
var CorePrecondition = class extends require_lib_structures_Precondition.AllFlowsPrecondition {
messageRun(message) {
return Reflect.get(message.channel, "nsfw") === true ? this.ok() : this.error({
identifier: require_lib_errors_Identifiers.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: require_lib_errors_Identifiers.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: require_lib_errors_Identifiers.Identifiers.PreconditionNSFW,
message: "You cannot run this command outside NSFW channels."
});
}
};
__sapphire_pieces.container.stores.loadPiece({
name: "NSFW",
piece: CorePrecondition,
store: "preconditions"
});
//#endregion
exports.CorePrecondition = CorePrecondition;
//# sourceMappingURL=NSFW.cjs.map