@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
42 lines (39 loc) • 1.46 kB
JavaScript
;
var pieces = require('@sapphire/pieces');
var result = require('@sapphire/result');
var PreconditionError_cjs = require('../errors/PreconditionError.cjs');
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var _Precondition = class _Precondition extends pieces.Piece {
constructor(context, options = {}) {
super(context, options);
this.position = options.position ?? null;
}
ok() {
return result.Result.ok();
}
/**
* Constructs a {@link PreconditionError} with the precondition parameter set to `this`.
* @param options The information.
*/
error(options = {}) {
return result.Result.err(new PreconditionError_cjs.PreconditionError({ precondition: this, ...options }));
}
async fetchChannelFromInteraction(interaction) {
const channel = await interaction.client.channels.fetch(interaction.channelId, {
cache: false,
allowUnknownGuild: true
});
return channel;
}
};
__name(_Precondition, "Precondition");
var Precondition = _Precondition;
var _AllFlowsPrecondition = class _AllFlowsPrecondition extends Precondition {
};
__name(_AllFlowsPrecondition, "AllFlowsPrecondition");
var AllFlowsPrecondition = _AllFlowsPrecondition;
exports.AllFlowsPrecondition = AllFlowsPrecondition;
exports.Precondition = Precondition;
//# sourceMappingURL=Precondition.cjs.map
//# sourceMappingURL=Precondition.cjs.map