@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
38 lines (36 loc) • 1.28 kB
JavaScript
import { __name } from '../../chunk-PAWJFY3S.mjs';
import { Piece } from '@sapphire/pieces';
import { Result } from '@sapphire/result';
import { PreconditionError } from '../errors/PreconditionError.mjs';
var _Precondition = class _Precondition extends Piece {
constructor(context, options = {}) {
super(context, options);
this.position = options.position ?? null;
}
ok() {
return Result.ok();
}
/**
* Constructs a {@link PreconditionError} with the precondition parameter set to `this`.
* @param options The information.
*/
error(options = {}) {
return Result.err(new 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;
export { AllFlowsPrecondition, Precondition };
//# sourceMappingURL=Precondition.mjs.map
//# sourceMappingURL=Precondition.mjs.map