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