@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
33 lines (31 loc) • 1.1 kB
JavaScript
import { __name } from '../chunk-PAWJFY3S.mjs';
import { Identifiers } from '../lib/errors/Identifiers.mjs';
import { AllFlowsPrecondition } from '../lib/structures/Precondition.mjs';
import { container } from '@sapphire/pieces';
var _CorePrecondition = class _CorePrecondition extends AllFlowsPrecondition {
messageRun(message) {
return message.guild === null ? this.ok() : this.makeSharedError();
}
chatInputRun(interaction) {
return interaction.guildId === null ? this.ok() : this.makeSharedError();
}
contextMenuRun(interaction) {
return interaction.guildId === null ? this.ok() : this.makeSharedError();
}
makeSharedError() {
return this.error({
identifier: Identifiers.PreconditionDMOnly,
message: "You cannot run this command outside DMs."
});
}
};
__name(_CorePrecondition, "CorePrecondition");
var CorePrecondition = _CorePrecondition;
void container.stores.loadPiece({
name: "DMOnly",
piece: CorePrecondition,
store: "preconditions"
});
export { CorePrecondition };
//# sourceMappingURL=DMOnly.mjs.map
//# sourceMappingURL=DMOnly.mjs.map